export NLS_LANG="SIMPLIFIED CHINESE_CHINA".AL32UTF8
source /etc/profile
# 重启数据库
sqlplus /nolog
conn / as sysdba
shutdown immediate
SQL> shutdown immediate
SQL> startup
SQL> alter session set sql_trace=true;
SQL> alter system enable restricted session;
SQL> alter database character set INTERNAL_USE AL32UTF8;
SQL> update props$ set VALUE$='UTF8' where NAME='NLS_NCHAR_CHARACTERSET';
SQL>ALTER SYSTEM DISABLE RESTRICTED SESSION;
sudo vi /etc/profile
#加入
export NLS_LANG="SIMPLIFIED CHINESE_CHINA".AL32UTF8
source /etc/profile
# 查看客户端的字符集
SQL>select userenv('language') from dual;
#输出
#USERENV('LANGUAGE')
#----------------------------------------------------
#SIMPLIFIED CHINESE_CHINA.AL32UTF8
用PL/SQL连接数据库,注释的内容全部乱码为“靠靠靠”字样;
# 查看服务端的字符集
SQL> select * from nls_database_parameters where parameter like '%CHARACTERSET%%';
#PARAMETER
#------------------------------
#VALUE
#--------------------------------------------------------------------------------
#NLS_CHARACTERSET
#AL32UTF8
#NLS_NCHAR_CHARACTERSET
#UTF8
客户端与服务端的字符集都是AL32UTF8,是一致的
因为我的数据都是imp进来的,所以我这里尝试了清空数据,重新导入,发现数据正常了
网友评论