Oracle Sql Loader中文字符导入乱码的解决方案[@more@]
服务器端字符集NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
控制文件ctl:
LOAD DATA
CHARACTERSET ZHS16GBK
INFILE 'c:test.csv'
APPEND INTO TABLE stk_al_version
FIELDS TERMINATED BY ","
(org_no,stk_c,version,name)
加入红色这段文字
导入成功
查看和修改Oracle服务器端字符集:
方法一:
1) 查看服务器端字符集:
select * from v$nls_parameters;
select * from nls_database_parameters;
select * from sys.props$;
2) 修改服务器端字符集(用sys用户):
首先执行:update props$ set value$ = 'WE8ISO8859P1' where name ='NLS_CHARACTERSET';
update props$ set value$ = 'china' where name ='NLS_LANGUAGE';
提交(commit),然后,重新启动数据库;
3)用客户端工具(PL/SQL DEVELOP or PB etc.)查询数据库,若显示乱码,先查询出数据库端的字符集,然后,从注册表中修改NLS_LANG字段的值,可能为AMERICAN_AMERICA.WE8ISO8859P1或者SIMPLIFIED CHINESE_CHINA.ZHS16GBK或者NA等。
方法二:
alter system enable restricted session;
alter database ORCL character set ZHS16GBK;
alter database ORCL national character set ZHS16GBK;
控制文件ctl:
LOAD DATA
CHARACTERSET ZHS16GBK
INFILE 'c:test.csv'
APPEND INTO TABLE stk_al_version
FIELDS TERMINATED BY ","
(org_no,stk_c,version,name)
加入红色这段文字
导入成功
查看和修改Oracle服务器端字符集:
方法一:
1) 查看服务器端字符集:
select * from v$nls_parameters;
select * from nls_database_parameters;
select * from sys.props$;
2) 修改服务器端字符集(用sys用户):
首先执行:update props$ set value$ = 'WE8ISO8859P1' where name ='NLS_CHARACTERSET';
update props$ set value$ = 'china' where name ='NLS_LANGUAGE';
提交(commit),然后,重新启动数据库;
3)用客户端工具(PL/SQL DEVELOP or PB etc.)查询数据库,若显示乱码,先查询出数据库端的字符集,然后,从注册表中修改NLS_LANG字段的值,可能为AMERICAN_AMERICA.WE8ISO8859P1或者SIMPLIFIED CHINESE_CHINA.ZHS16GBK或者NA等。
方法二:
alter system enable restricted session;
alter database ORCL character set ZHS16GBK;
alter database ORCL national character set ZHS16GBK;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/93880/viewspace-1022472/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/93880/viewspace-1022472/