Friday, October 14, 2011

Oracle NLS_LANG Setting for Language/Territory/Character Set

Oracle NLS_LANG Setting for Language/Territory/Character Set
Stage NLS_LANG tells Vaticinator what characterset the client is using so that Seer can do salvation if required from client\'s characterset to the database characterset and service this parameter on the client does not replace the client\'s characterset. Stage Faculty and Dominion in nls_lang has nonentity to do with storing characters in database, it\'s disciplined by the characterset and of course if the database can fund that characterset..Beneath is the structure of service NLS_LANG . NLS_LANG=_. Example: NLS_LANG= BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252 To check session NLS session parameters,( note this doesn't return the characterset set by NLS_LANG) SQL> select * from nls_session_parameters ; To find the NLS_LANG of the database one can run the following SQL: SQL> select DECODE(parameter, \'NLS_CHARACTERSET\', \'CHARACTER SET\',\'NLS_LANGUAGE\', \'LANGUAGE\', \'NLS_TERRITORY\', \'TERRITORY\') name, value from v$nls_parameters WHERE parameter IN ( \'NLS_CHARACTERSET\', \'NLS_LANGUAGE\', \'NLS_TERRITORY\'); Sample Output : NAME VALUE ------------- --------------------- LANGUAGE AMERICAN TERRITORY AMERICA CHARACTER SET WE8MSWIN1252 Setting NLS_LANG for export/import : If you are encounter character set conversion problems during exported or imported a database or table(s) check the following information to confirm whether the export/import procedure was performed correctly: When exporting/importing one can minimize risk of losing data during import/export by setting NLS_LANG. 1.) Before starting export set NLS_LANG to be the same character set of the database being exported which means no conversion takes place, all the data will be stored in the export file as it was stored in the database. 2.) Before starting import set NLS_LANG to be the same value as the it was set during export which means no conversion will take place in the import session, but if the character set of the target database is different the data will automatically be converted when import inserts the data in the database. 3.) Before starting export set NLS_LANG to be the same character set of the database being imported to which means conversion takes place at this step it will automatically convert during export. 4.) Before starting import set NLS_LANG to be the same value as the it was set during import which means no conversion will take place as it was already converted during export. 5.) Settings on the machine from which u are trying to take the import of the data.Even though the NLSCHAR AND NLS NCHA Settings on the source and destination databases are same unless the console from where u are trying to take export and import also should same other wise u will get all the junk characters . 6.) Sometimes we make import and get some special character ( like ?,! ) that means, we need to go \'region settings\' and change the location to "brazil\" and default language make as " brazil" . (if we are importing American to brazil). 7.) check the export log file and see what is specified.