安装Oracle10g XE之后中文乱码解决办法

作者:袖梨 2022-06-29

在安装Oracle 10G XE版本之后,由于默认字符集原因,中文是乱码的,通过调整字符集,解决中文乱码问题。

C:\Users\guan>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 11月 2 23:56:23 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Enter user-name: sys as sysdba
Enter password:

  登陆后,执行以下命令:

SQL> shutdown immediate;
SQL> startup mount
ORACLE instance started.

Total System Global Area  805306368 bytes
Fixed Size                  1289996 bytes
Variable Size             218104052 bytes
Database Buffers          583008256 bytes
Redo Buffers                2904064 bytes
Database mounted.
SQL> alter session set sql_trace=true;

Session altered.

SQL> alter system enable restricted session;

System altered.

SQL> alter system set job_queue_processes=0;

System altered.

SQL> alter system set aq_tm_processes=0;

System altered.

SQL> alter database open;

Database altered.
SQL> alter database character set internal_use AL32UTF8;

Database altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  805306368 bytes
Fixed Size                  1289996 bytes
Variable Size             218104052 bytes
Database Buffers          583008256 bytes
Redo Buffers                2904064 bytes
Database mounted.
Database opened.

如果安装保存数据是否则还有一种解决办法

查看服务器段的字符集:

select userenv('language') from dual的结果是amercian_america.zhs16gbk

数据库字符集相关的只是zhs16gbk字段,完全没有任何问题

查看客户端的字符集:

在注册表里查找HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_OraDb10g_service/NLS_LANG对应的值为空,手动更改成和服务器端相同的配置amercian_america.zhs16gbk

 重新登陆sqlplus,出现了完美的中文

相关文章

精彩推荐