oracle查看字符集 修改字符集

栏目: 数据库 · 发布时间: 6年前

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')

-----------------------------------------------------------

SIMPLIFIED CHINESE_CHINA.WE8ISO8859P1

从NLS_LANG的组成我们可以看出,真正影响数据库字符集的其实是第三部分。

所以两个数据库之间的字符集只要第三部分一样就可以相互导入导出数据,前面影响的只是提示信息是中文还是英文。

1、查看字符集

数据库服务器字符集 select * from nls_database_parameters ,其来源于props$,是表示数据库的字符集。

客户端字符集环境 select * from nls_instance_parameters,其来源于v$parameter,表示客户端的字符集的设置,可能是参数文件,环境变量或者是注册表

会话字符集环境 select * from nls_session_parameters,其来源于v$nls_parameters,表示会话自己的设置,可能是会话的环境变量或者是alter session完成,如果会话没有特殊的设置,将与nls_instance_parameters一致。

客户端的字符集要求与服务器一致,才能正确显示数据库的非Ascii字符。如果多个设置存在的时候,alter session>环境变量>注册表>参数文件

字符集要求一致,但是语言设置却可以不同,语言设置建议用英文。如字符集是zhs16gbk,则nls_lang可以是American_America.zhs16gbk。

2、修改数据库的字从字符集

SQL> ALTER DATABASE NATIONAL CHARACTER SET JAPANSE_JAPAN JA16SJIS;

ALTER DATABASE NATIONAL CHARACTER SET JAPANSE_JAPAN JA16SJIS

*

第 1 行出现错误:

ORA-00933: SQL command not properly ended

ALTER DATABASE NATIONAL CHARACTER SET 'JAPANSE_JAPAN JA16SJIS';

SQL> ALTER DATABASE NATIONAL CHARACTER SET 'JAPANSE_JAPAN JA16SJIS';

ALTER DATABASE NATIONAL CHARACTER SET 'JAPANSE_JAPAN JA16SJIS'

*

第 1 行出现错误:

ORA-24329: invalid character set identifier

SQL> select * from V$NLS_VALID_VALUES where parameter ='CHARACTERSET';

PARAMETER                                                        VALUE

---------------------------------------------------------------- ----------------------------------------------------------------

CHARACTERSET                                                     AR8MUSSAD768

CHARACTERSET                                                     AR8ADOS710

CHARACTERSET                                                     AR8ADOS720

CHARACTERSET                                                     AR8APTEC715

CHARACTERSET                                                     AR8MSWIN1256

CHARACTERSET                                                     AR8MSAWIN

CHARACTERSET                                                     AR8NAFITHA721

CHARACTERSET                                                     AR8SAKHR706

CHARACTERSET                                                     AR8ARABICMAC

CHARACTERSET                                                     AR8ARABICMACS

CHARACTERSET                                                     AR8ARABICMACT

CHARACTERSET                                                     LA8ISO6937

CHARACTERSET                                                     WE8DECTST

CHARACTERSET                                                     JA16VMS

CHARACTERSET                                                     JA16EUC

CHARACTERSET                                                     JA16EUCYEN

CHARACTERSET                                                     JA16SJIS

CHARACTERSET                                                     JA16DBCS

CHARACTERSET                                                     JA16SJISYEN

CHARACTERSET                                                     JA16EBCDIC930

CHARACTERSET                                                     JA16MACSJIS

ALTER DATABASE NATIONAL CHARACTER SET 'JA16SJIS';

SQL文修改编码方法:

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 GB2312;

shutdown immediate;

startup;

我没有测试成功,唉!重安装库吧……


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Big Java Late Objects

Big Java Late Objects

Horstmann, Cay S. / 2012-2 / 896.00元

The introductory programming course is difficult. Many students fail to succeed or have trouble in the course because they don't understand the material and do not practice programming sufficiently. ......一起来看看 《Big Java Late Objects》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具