Oracle NLS_LANG Setting for Language/Territory/Character Set
Setting NLS_LANG
tells Oracle what characterset the client is using so that Oracle can
do conversion if needed from client’s characterset to the database
characterset and setting this parameter on the client does not change
the client’s characterset. Setting Language and Territory in nls_lang
has nothing to do with storing characters in database, it’s controlled
by the characterset and of course if the database can store that
characterset..Below is the syntax of setting NLS_LANG .
NLS_LANG=<language>_<territory>.<character set>
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
When exporting/importing one can minimize risk of losing data during import/export by setting NLS_LANG.
NAME VALUE
------------ -------------------
LANGUAGE AMERICAN
TERRITORY AMERICA
CHARACTER SET WE8MSWIN1252
Setting NLS_LANG for export/import :
we encounter character set conversion problems during exporting or
importing a database or table(s) then we should check the following
information to confirm whether the export/import procedure was performed
correctly .
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 (say) ”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
No comments:
Post a Comment