oracle修改字符集

时间:2021-01-31 08:15:27

在linux下面安装了oracle 11G,由于安装的时候没有注意导致字符集问题,impdp导入操作后中文乱码。

1.用命令select userenv('language') from dual;  查看了正常oracle和乱码oracle的字符,发现分别为  SIMPLIFIED CHINESE_CHINA.AL32UTF8SIMPLIFIED CHINESE_CHINA.WE8MSWIN1252,发现字符集WE8MSWIN1252错误。

2.修改字符集

 

>shutdown immediate; (database停了)

>startup mount; (database重开去可更改情況)

>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 se AL32UTF8;  (OR   >alter database character set internal_use AL32UTF8;

>shutdown immediate;

>startup; (重开正常oracle)

 3.进行导入操作

    impdp jmkj/123456 directory=jmkjdir  DUMPFILE=201611080000.dmp REMAP_SCHEMA=JMKJ:jmkj logfile=impdp.log;

    出现错误

    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

 

    With the Partitioning, OLAP, Data Mining and Real Application Testing options     ORA-39006: internal error     ORA-39213: Metadata processing is not available

 4.修复ORA-39006,ORA-39213

     sqlplus / as sysdba

     SQL> execute dbms_metadata_util.load_stylesheets;

              PL/SQL procedure successfully completed.      SQL> exit

5.再次导入成功

    impdp jmkj/123456 directory=jmkjdir  DUMPFILE=201611080000.dmp REMAP_SCHEMA=JMKJ:jmkj logfile=impdp.log;