Oracle修改默认字符集

在使用Oracle数据泵进行数据的迁移过程中,由于源端数据库字符集与目标端数据库字符集不同,导致数据导入过程中总是出现数据导入失败的问题;

1、查看字符集

select * from v$nls_parameters; 

2、修改字符集

SQL> conn /as sysdba 

Connected. 

SQL> shutdown immediate; 

Database closed. 

Database dismounted. 

ORACLE instance shut down. 

SQL> startup mount 

ORACLE instance started. 

Total System Global Area  236000356 bytes 

Fixed Size                   451684 bytes 

Variable Size             201326592 bytes 

Database Buffers           33554432 bytes 

Redo Buffers                 667648 bytes 

Database mounted. 

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

ALTER DATABASE CHARACTER SET ZHS16GBK 

* 

ERROR at line 1: 

ORA-12712: new character set must be a superset of old character set 

提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改:

SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; 

Database altered. 

SQL> select * from v$nls_parameters; 

重启检查是否更改完成:

SQL> shutdown immediate; 

Database closed. 

Database dismounted. 

ORACLE instance shut down. 

SQL> startup 

ORACLE instance started. 

Total System Global Area  236000356 bytes 

Fixed Size                   451684 bytes 

Variable Size             201326592 bytes 

Database Buffers           33554432 bytes 

Redo Buffers                 667648 bytes 

Database mounted. 

Database opened. 

SQL> select * from v$nls_parameters; 

3、过程中可能出现的问题:

  • startup报错ORA-00119 ORA-00132
    找到Oracle示例的ora文件,我的是/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/inithelowin.ora
    在文件中添加:
 *.local_listener='(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (HOST=serverIP)(PORT=1521)))'

以pfile文件启动Oracle:

startup pfile='/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/inithelowin.ora'

Oracle启动成果。

  • startup mount报错,同样是ORA-00119 ORA-00132
    解决方法和上面一样。

猜你喜欢

转载自blog.csdn.net/weixin_44455388/article/details/107409653