1.oracle 在使用AL32UFT8的使用,需要系统支持多字符集,这时NLS_LENGTH_SEMANTICS需要设置成char。具体的做法来自于ORACLE官方网站。
To convert an existing schema and its associated data from byte semantics and a single-byte character set to character semantics and a multibyte character set, such as UTF-8, you need only follow these steps: [The following steps have been corrected since the magazine was printed.]
- Export the schema.
- Issue an ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR SCOPE=BOTH command on the target database.
- Stop and restart the instance so that the parameter change takes effect.
- Drop the original schema.
- Recreate the original schema and its tables (you can use import's show=Y option to get the CREATE TABLE statements). Columns in the recreated tables will use character semantics, because that's now the default.
- Import the schema into the target database using the IGNORE=Y import option.
此外:
1.数据库服务器字符集select * from nls_database_parameters,其来源于props$,是表示数据库的字符集。
2.客户端字符集环境select * from nls_instance_parameters,其来源于v$parameter,
3.表示客户端的字符集的设置,可能是参数文件,环境变量或者是注册表
会话字符集环境 select * from nls_session_parameters,其来源于v$nls_parameters,表示会话自己的设置,可能是会话的环境变量或者是alter session完成,如果会话没有特殊的设置,将与nls_instance_parameters一致。
客户端的字符集要求与服务器一致,才能正确显示数据库的非Ascii字符。如果多个设置存在的时候,alter session>环境变量>注册表>参数文件
字符集要求一致,但是语言设置却可以不同,语言设置建议用英文。如字符集是zhs16gbk,则nls_lang可以是American_America.zhs16gbk。