ORACLE 11G在同一台linux伺服器從執行個體1全庫匯入到執行個體2上

來源:互聯網
上載者:User

標籤:oracle   多執行個體   匯入匯出   expdp   impdp   

前期匯出命令:

[root@powerlong4 ~]# su - oracle[oracle@powerlong4 ~]$ export ORACLE_SID=pt1;[oracle@powerlong4 ~]$ expdp \‘sys/systestpd as sysdba\‘ DIRECTORY=dir_dump_t3 FULL=YES DUMPFILE=expdpfull_pd_20150529_02.dmp......
1,開始匯入

先在執行個體2上建立管道目錄:

[[email protected] ~]$ export ORACLE_SID=pt2;[[email protected] ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 3 21:22:43 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>  CREATE OR REPLACE DIRECTORY dir_dump_t3  AS ‘/home/oracle/expdpimpdp/‘;Directory created.SQL> 

開始匯入全庫備份組:

impdp \‘sys/[email protected] as sysdba\‘ directory=dir_dump_t3 dumpfile=expdpfull_pd_20150529_02.dmp nologfile=y TABLE_EXISTS_ACTION=REPLACE ......

<著作權,文章允許轉載,但必須以連結方式註明源地址,否則追究法律責任!>
原部落格地址: http://blog.csdn.net/mchdba/article/details/46335861
原黃杉 (mchdba)

2,匯入報錯:
ORA-02374: conversion error loading table "puser"."RES_APPROVE_CONTENT"ORA-12899: value too large for column CREATED_POSITION_CD (actual: 24, maximum: 20)
3,懷疑匯入目標錯誤,驗證:
 [[email protected] admin]$ export ORACLE_SID=pt2;[[email protected] admin]$ [[email protected] admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 21:06:27 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> SQL> SQL> select name from v$database;NAME------------------pt2SQL>
4,檢查兩者的編碼

到出庫執行個體庫1:

SQL> SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER IN (‘NLS_CHARACTERSET‘, ‘NLS_NCHAR_CHARACTERSET‘);PARAMETER                                                        VALUE---------------------------------------------------------------- ----------------------------------------------------------------NLS_CHARACTERSET                                                 ZHS16GBKNLS_NCHAR_CHARACTERSET                                           AL16UTF16SQL> 

到匯入的庫執行個體2庫

SQL> SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER IN (‘NLS_CHARACTERSET‘, ‘NLS_NCHAR_CHARACTERSET‘);PARAMETER                                                        VALUE---------------------------------------------------------------- ----------------------------------------------------------------NLS_CHARACTERSET                                                 AL32UTF8NLS_NCHAR_CHARACTERSET                                           AL16UTF16SQL> 

看到匯出匯入庫執行個體1執行個體2的字元集不同,所以問題就在這裡了

5,解決:
[[email protected] admin]$ export ORACLE_SID=pt2;[[email protected] admin]$ [[email protected] admin]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 21:06:27 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> SQL>connect username/password as SYSDBA;SQL>SHUTDOWN IMMEDIATE;SQL>STARTUP MOUNT;SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION;SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0;SQL>ALTER DATABASE OPEN;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報字元集不相容,此時下INTERNAL_USE指令不對字元集超集進行檢查:SQL>ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;SQL>SHUTDOWN IMMEDIATE;SQL>STARTUP;
6,再去檢查兩個執行個體的編碼
[[email protected] expdpimpdp]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 21:32:12 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> select name from v$database;NAME---------pt2SQL> SQL> SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER IN (‘NLS_CHARACTERSET‘, ‘NLS_NCHAR_CHARACTERSET‘);Warning: connection was lost and re-establishedPARAMETER                                                        VALUE---------------------------------------------------------------- ----------------------------------------------------------------NLS_CHARACTERSET                                                 ZHS16GBKNLS_NCHAR_CHARACTERSET                                           AL16UTF16SQL> 

匯出執行個體上:

[[email protected] expdpimpdp]$ export ORACLE_SID=pt1;[[email protected] expdpimpdp]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 21:32:50 2015Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> select name from v$database;NAME---------pt1SQL> SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER IN (‘NLS_CHARACTERSET‘, ‘NLS_NCHAR_CHARACTERSET‘);PARAMETER                                                        VALUE---------------------------------------------------------------- ----------------------------------------------------------------NLS_CHARACTERSET                                                 ZHS16GBKNLS_NCHAR_CHARACTERSET                                           AL16UTF16SQL> 

此時,兩個執行個體上字元集一模一樣了,保持一致。

7,重新匯入impdp
[oracle@pttest4 admin]$ export ORACLE_SID=pt2;[oracle@pttest4 admin]$ impdp \‘sys/[email protected] as sysdba\‘ directory=dir_dump_t3 dumpfile=expdpfull_pd_20150529_02.dmp nologfile=y TABLE_EXISTS_ACTION=REPLACE

OK,一切正常,可以匯入到執行個體2上面了。

ORACLE 11G在同一台linux伺服器從執行個體1全庫匯入到執行個體2上

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.