Oracle修改字符集记录

2023-10-25 14:47:05 浏览数 (1)

Server端修改

代码语言:javascript复制
shutdown immediate;
startup mount;
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database character set internal_use WE8MSWIN1252;

alter system set nls_language='AMERICAN' scope = spfile;
alter system set nls_territory='AMERICA' scope=spfile;

shutdown immediate;
startup; 

修改后确认,注意没改language:

代码语言:javascript复制
select userenv('language') from dual;

select * from nls_database_parameters  where parameter  in('NLS_LANGUAGE','NLS_TERRITORY','NLS_CHARACTERSET');
select * from v$nls_parameters where parameter in ('NLS_LANGUAGE','NLS_TERRITORY','NLS_CHARACTERSET');

修改后记得把客户端nls_language也改了:

代码语言:javascript复制
export NLS_LANG='AMERICAN_AMERICA.WE8MSWIN1252'

检查编码

代码语言:javascript复制
create table o_3222(i varchar(128));
insert into o_3222 values ('的是不了人我在有他这为之大来以个中上们');
select i, rawtohex(i) from o_3222;

0 人点赞