誇平臺多個schame資料遷移(exp,imp)
誇平臺多個schame同時匯入匯出
SQL> col file_name for a45
SQL> set linesize 200
SQL> set pagesize 200
SQL> r
1* select file_name,tablespace_name from dba_data_files
FILE_NAME TABLESPACE_NAME
--------------------------------------------- ------------------------------
/u01/app/oracle/oradata/test/users01.dbf USERS
/u01/app/oracle/oradata/test/undotbs01.dbf UNDOTBS1
/u01/app/oracle/oradata/test/sysaux01.dbf SYSAUX
/u01/app/oracle/oradata/test/system01.dbf SYSTEM
/u01/app/oracle/oradata/test/example01.dbf EXAMPLE
/u01/app/oracle/oradata/soraeuc/gguser.dbf TBS_GGUSER
/u01/app/oracle/oradata/test/tbs01.dbf TBS1
7 rows selected.
SQL> create user pan1 identified by oracle default tablespace TBS1;
User created.
SQL> grant connect,resource to pan1;
Grant succeeded.
SQL> grant select on scott.emp to pan1;
Grant succeeded.
SQL> conn pan1/oracle;
Connected.
SQL> create table test1 as select * from scott.emp;
Table created.
SQL> create tablespace tbs2 datafile'/u01/app/oracle/oradata/test/tbs02.dbf' size 10m
autoextend on next 10m;
Tablespace created.
SQL> create user pan2 identified by oracle default tablespace tbs2;
User created.
SQL> grant connect,resource to pan2;
Grant succeeded.
SQL> grant select on scott.dept to pan2;
Grant succeeded.
SQL> conn pan2/oracle
Connected.
SQL> create table dept1 as select * from scott.dept;
Table created.
SQL> select * from dept1;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
目標資料庫
匯入schame失敗,因為目標庫裡面沒有這裡pan1,pan2兩個使用者
[oracle@solaris102:/export/home/oracle/dump_dir]$ imp system/oracle file=pan_1_2.dmp
fromuser=pan1,pan2 log=pan_1_2_imp.log
Import: Release 11.2.0.3.0 - Production on Wed Apr 2 20:28:41 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing SYSTEM's objects into SYSTEM
. importing PAN1's objects into PAN1
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing PAN2's objects into PAN2
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
Import terminated successfully with warnings.
[oracle@solaris102:/export/home/oracle/dump_dir]$ imp system/oracle file=pan_1_2.dmp fromuser=
(pan1,pan2) touser=(pan1,pan2) log=pan_1_2_imp.log
Import: Release 11.2.0.3.0 - Production on Wed Apr 2 20:34:56 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing PAN1's objects into PAN1
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing PAN2's objects into PAN2
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
Import terminated successfully with warnings.
在目標資料庫新建使用者pan1 pan2
idle>conn / as sysdba
Connected.
sys@TESTDB>create user pan1 identified by oracle;
User created.
sys@TESTDB>create user pan2 identified by oracle;
User created.
sys@TESTDB>grant resource,connect to pan1;
Grant succeeded.
sys@TESTDB>grant resource,connect to pan2;
Grant succeeded.
這裡的touser可以不指定,如果匯入的和匯出的使用者名稱相同且已經建立,如果匯入到另外的已經建立的使用者則必須指定
[oracle@solaris102:/export/home/oracle/dump_dir]$ imp system/oracle file=pan_1_2.dmp fromuser=
(pan1,pan2) log=pan_1_2_imp.log
Import: Release 11.2.0.3.0 - Production on Wed Apr 2 20:39:15 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses ZHS16GBK character set (possible charset conversion)
export client uses ZHS16GBK character set (possible charset conversion)
. importing SYSTEM's objects into SYSTEM
. importing PAN1's objects into PAN1
. importing PAN2's objects into PAN2
. importing PAN1's objects into PAN1
. . importing table "TEST1" 14 rows imported
. importing PAN2's objects into PAN2
. . importing table "DEPT1" 4 rows imported
Import terminated successfully without warnings.
sys@TESTDB>select * from pan1.test1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
sys@TESTDB>select * from pan2.dept1;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
注:匯入成功
1,可見匯入的時候必須在目標庫建立相應的使用者,當然在full模式下oracle會自動建立使用者。
2,在生產環境下最好建立表空間,指定使用者的預設表空間。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-1134951/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 用exp、imp遷移包含物化檢視日誌的資料
- oracle資料匯出匯入(exp/imp)Oracle
- oracle exp和impOracle
- 使用imp/exp遇到兩個問題
- EF 中多個資料庫遷移資料庫
- 【exp/imp不同版本】Oracle不同版本的exp/imp使用注意事項Oracle
- exp和imp詳解
- exp匯出遭遇IMP-00020
- [20190520]exp imp on th fly.txt
- exp&imp的使用方法
- 用傳輸表空間跨平臺遷移資料
- 高途資料平臺遷移與成本治理實踐
- Elasticsearch 叢集誇網路快照遷移Elasticsearch
- 不同版本exp/imp使用注意事項
- 從 Oracle 到 TiDB,全鏈路資料遷移平臺核心能力和杭州銀行遷移實踐OracleTiDB
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- 【資料遷移】XTTS跨平臺傳輸表空間v4TTS
- 如何實現CDH到雲原生大資料平臺的快速平滑遷移?大資料
- Kafka資料遷移Kafka
- Harbor資料遷移
- gitlab資料遷移Gitlab
- 資料庫遷移資料庫
- EXP、IMP、SQLLOADER、EXPDP、IMPDP、DBMS_METADATA、SQLPLUS等方面SQL
- 【資料遷移】XTTS跨平臺傳輸表空間(1.傳統方式)TTS
- GBASE助力山東移動大資料平臺PB級資料主倉業務跨機房無感知遷移大資料
- 支援多種資料庫型別的遷移工具資料庫型別
- 使用 Velero 跨雲平臺遷移叢集資源到 TKE
- 資料遷移(1)——通過資料泵表結構批量遷移
- Mysql資料遷移方法MySql
- 【Hive】hive資料遷移Hive
- 【Redis】 redis資料遷移Redis
- redis資料庫遷移Redis資料庫
- congregate遷移gitlab資料Gitlab
- 系統資料遷移
- 資料庫遷移 :理解資料庫
- laravel資料庫遷移Laravel資料庫
- Fastdfs資料遷移方案AST
- 伺服器資料遷移的方法-硬體不同如何遷移資料伺服器
- 【資料遷移】XTTS跨平臺傳輸表空間v3(3.DFT方式)TTS