expdp 和network 不落地資料遷移
本地庫建立dblink
1,新增tnsname
[oracle@node1 ~]$ cd $ORACLE_HOME/dbs
[oracle@node1 dbs]$ ls
hc_DBUA0.dat init.ora lkTEST peshm_DBUA0_0 snapcf_test.f
hc_test.dat inittest.ora orapwtest peshm_test_0 spfile.ora
[oracle@node1 dbs]$ cd ..
[oracle@node1 db_1]$ cd network/admin
[oracle@node1 admin]$ vi tnsnames.ora
testdb=
(DESCRIPTION=
(ADDRESS= (PROTOCOL=tcp)(HOST=192.168.10.102)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=testdb)
(SERVER=dedicated)
)
)
2,本地庫 建立dblink
SYS@ test>CREATE PUBLIC DATABASE LINK "testdb"
2 CONNECT TO scott
3 IDENTIFIED BY "oracle"
4 USING 'testdb';
3,資源庫開啟監聽
[oracle@solaris102:/export/home/oracle]$ lsnrctl start
LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 24-MAY-2014 15:21:07
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
[oracle@solaris102:/export/home/oracle]$ lsnrctl status
LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 24-MAY-2014 15:21:13
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production
Start Date 24-MAY-2014 15:20:39
Uptime 0 days 0 hr. 0 min. 34 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/solaris102/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.102)(PORT=1521)))
Services Summary...
Service "ORCLXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testdb" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
4,檢視本地庫的目錄
SYS@ test>select * from dba_directories;
SYS DUMP_DIR
/home/oracle/dump_dir
5,資源庫上建立一張表
scott@TESTDB>select count(*) from test;
COUNT(*)
----------
14257
如果匯出不成功需要在資源庫上執行
grant這個命令要在源端資料庫上面執行
grant exp_full_database to scott
6,在本地匯出資源庫的test表
[oracle@node1 dump_dir]$ expdp scott/oracle directory=dump_dir dumpfile=test.dmp network_link=testdb tables=test
Export: Release 11.2.0.1.0 - Production on Sat May 24 15:34:00 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=dump_dir dumpfile=test.dmp network_link=testdb tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."TEST" 1.269 MB 14257 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
/home/oracle/dump_dir/test.dmp
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 15:34:04
7,將資源庫的test表直接匯入到本地庫
[oracle@node1 dump_dir]$ impdp scott/oracle directory=dump_dir network_link=testdb tables=test
Import: Release 11.2.0.1.0 - Production on Sat May 24 15:37:36 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_IMPORT_TABLE_01": scott/******** directory=dump_dir network_link=testdb tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . imported "SCOTT"."TEST" 14257 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SCOTT"."SYS_IMPORT_TABLE_01" successfully completed at 15:37:42
[oracle@node1 dump_dir]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat May 24 15:38:05 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
@ >conn scott/oracle
Connected.
SCOTT@ test>select count(*) from test;
COUNT(*)
----------
14257
刪除dblink
SYS@ test>drop public database link "testdb";
Database link dropped.
重新建立dblink
SYS@ test>create public database link "testdb" connect to system identified by "oracle" using 'testdb';
Database link created.
1,新增tnsname
[oracle@node1 ~]$ cd $ORACLE_HOME/dbs
[oracle@node1 dbs]$ ls
hc_DBUA0.dat init.ora lkTEST peshm_DBUA0_0 snapcf_test.f
hc_test.dat inittest.ora orapwtest peshm_test_0 spfile.ora
[oracle@node1 dbs]$ cd ..
[oracle@node1 db_1]$ cd network/admin
[oracle@node1 admin]$ vi tnsnames.ora
testdb=
(DESCRIPTION=
(ADDRESS= (PROTOCOL=tcp)(HOST=192.168.10.102)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=testdb)
(SERVER=dedicated)
)
)
2,本地庫 建立dblink
SYS@ test>CREATE PUBLIC DATABASE LINK "testdb"
2 CONNECT TO scott
3 IDENTIFIED BY "oracle"
4 USING 'testdb';
3,資源庫開啟監聽
[oracle@solaris102:/export/home/oracle]$ lsnrctl start
LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 24-MAY-2014 15:21:07
Copyright (c) 1991, 2011, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
[oracle@solaris102:/export/home/oracle]$ lsnrctl status
LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 24-MAY-2014 15:21:13
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 11.2.0.3.0 - Production
Start Date 24-MAY-2014 15:20:39
Uptime 0 days 0 hr. 0 min. 34 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/solaris102/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.102)(PORT=1521)))
Services Summary...
Service "ORCLXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testdb" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
4,檢視本地庫的目錄
SYS@ test>select * from dba_directories;
SYS DUMP_DIR
/home/oracle/dump_dir
5,資源庫上建立一張表
scott@TESTDB>select count(*) from test;
COUNT(*)
----------
14257
如果匯出不成功需要在資源庫上執行
grant這個命令要在源端資料庫上面執行
grant exp_full_database to scott
6,在本地匯出資源庫的test表
[oracle@node1 dump_dir]$ expdp scott/oracle directory=dump_dir dumpfile=test.dmp network_link=testdb tables=test
Export: Release 11.2.0.1.0 - Production on Sat May 24 15:34:00 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** directory=dump_dir dumpfile=test.dmp network_link=testdb tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."TEST" 1.269 MB 14257 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
/home/oracle/dump_dir/test.dmp
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 15:34:04
[oracle@node1 dump_dir]$ impdp scott/oracle directory=dump_dir network_link=testdb tables=test
Import: Release 11.2.0.1.0 - Production on Sat May 24 15:37:36 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SCOTT"."SYS_IMPORT_TABLE_01": scott/******** directory=dump_dir network_link=testdb tables=test
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . imported "SCOTT"."TEST" 14257 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SCOTT"."SYS_IMPORT_TABLE_01" successfully completed at 15:37:42
[oracle@node1 dump_dir]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Sat May 24 15:38:05 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
@ >conn scott/oracle
Connected.
SCOTT@ test>select count(*) from test;
COUNT(*)
----------
14257
刪除dblink
SYS@ test>drop public database link "testdb";
Database link dropped.
SYS@ test>create public database link "testdb" connect to system identified by "oracle" using 'testdb';
Database link created.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-1168939/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用expdp、impdp遷移資料庫資料庫
- 使用資料泵(expdp、impdp)遷移資料庫流程資料庫
- 使用impdp,expdp資料泵進入海量資料遷移
- Oracle使用資料泵 (expdp/impdp)實施遷移Oracle
- expdp/impdp使用sysdba許可權遷移資料
- expdp 遷移測試
- expdp/impdp 使用version引數跨版本資料遷移
- 關於資料庫使用impdp+network_link遷移時,job的遷移資料庫
- 【Datapump】Oracle資料泵遷移資料命令參考(expdp/impdp說明)Oracle
- MongoDB 資料遷移和同步MongoDB
- Oracle使用impdp的network_link遷移資料庫Oracle資料庫
- expdp的一次遷移
- expdp/impdp 遷移表空間
- Oracle Expdp/Impdp 進行資料遷移的 幾點注意事項Oracle
- Laravel 中資料遷移和資料填充Laravel
- 一次expdp/impdp遷移案例
- 遷移資料.
- exp/imp和expdp/imp在跨使用者邏輯遷移資料時的差異
- 【遷移】使用rman遷移資料庫資料庫
- 醬油DBA奉獻expdp,impdp多使用者遷移資料(二)
- redis 單機和cluster資料遷移Redis
- 【資料遷移】使用傳輸表空間遷移資料
- expdp,impdp的多使用者遷移
- Kafka資料遷移Kafka
- 資料庫遷移資料庫
- redis資料遷移Redis
- 轉資料遷移
- ORACLE 資料遷移Oracle
- DXWB 資料遷移
- 資料的遷移
- Harbor資料遷移
- 【資料遷移】RMAN遷移資料庫到ASM(三)遷移onlinelog等到ASM資料庫ASM
- Laravel資料庫遷移和填充(支援中文)Laravel資料庫
- Grafana的版本升級和資料遷移Grafana
- ORACLE資料庫切換和遷移方案Oracle資料庫
- 阿里雲資料庫遷移方案-不間斷業務阿里資料庫
- 資料遷移(1)——通過資料泵表結構批量遷移
- 使用impdp network link 跳過expdp直接匯入資料