Alter Database Character Set Clauses
To set the character set
ALTER DATABASE CHARACTER SET INTERNAL_CONVERT <CHARACTER SET>;
To set the national character set
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_CONVERT <CHARACTER SET>;
Export database with setting CHARACTER SET to avoid character set mismatch b/w databases
To set the character set
ALTER DATABASE CHARACTER SET INTERNAL_CONVERT <CHARACTER SET>;
1 | ALTER DATABASE CHARACTER SET INTERNAL_CONVERT WE8MSWIN1252; |
To set the national character set
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_CONVERT <CHARACTER SET>;
1 | ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_CONVERT AL16UTF16; |
Export database with setting CHARACTER SET to avoid character set mismatch b/w databases
1) Change the environment variable of NLS_LANG to that of your target database:
1 2 3 4 5 | echo $NLS_LANG export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1 echo $NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1 |
The above can be queried using
1 | SQL> select * from v$nls_parameters; |
Format:
NLS_LANG = LANGUAGE_TERRITORY.CHARACTER_SET
2) Do your export. You should see something like this before the data starts to get exported:
1 2 3 4 5 6 | .. .. Export done in WE8ISO8859P1 character set and UTF8 NCHAR character set server uses UTF8 character set (possible charset conversion) .. .. |
Conversely you can do this on the import too. Change the NLS_LANG variable before importing and this should convert the .dmp file to the target database compatible but I personally think it's easier doing this on the export.
In Windows you do:
set NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
Then do the export.