data pump (資料抽取)測試

張衝andy發表於2016-12-06
data pump (資料抽取)測試

背景介紹>利用db_link直接pump抽取,減少轉儲檔案集。

前提:   授權>  grant create public database link,create database link to myAccount;  

1.建立dblink

SQL> create database link demob connect to dblink identified by dblink using '(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.25.14)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))';

Database link created.

引數說明> 

demob --link_name

dblink -- 遠端資料庫的使用者賬號與密碼

(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.100.25.14)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))  -- 遠端資料庫的tnsnames.ora

------------------------------------------------------------------------------------------------------------------------------

2.使用dblink

SQL> select * from dblink.dblink@demob;

ID
----------
1
2

引數說明

@demob  --dblink_name

___________________________________________________________________________________________________

3.遠端資料庫(要被匯出資料庫)授權

SQL> grant exp_full_database to dblink;

Grant succeeded.

SQL>grant imp_full_database to dblink;

Grant succeeded.

——————————————————————————————————————————————————————————————

4.在匯入資料庫中建立parfile檔案。

[oracle@11g ~]$ pwd
/home/oracle
[oracle@11g ~]$ ls
app database imp.txt oradiag_oracle oraInventory
[oracle@11g ~]$ cat imp.txt
network_link=demob     (db_link的名字)
schemas=dblink            (要被匯入使用者名稱)

————————————————————————————————————————————————————————————————

5.目標資料庫進行匯入。

[oracle@11g ~]$ impdp \'sys/oracle as sysdba\' parfile=/home/oracle/imp.txt

Import: Release 11.2.0.1.0 - Production on Fri Oct 17 15:13:07 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 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "SYS"."SYS_IMPORT_SCHEMA_01": "sys/******** AS SYSDBA" parfile=/home/oracle/imp.txt 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . imported "DBLINK"."DBLINK" 2 rows
Job "SYS"."SYS_IMPORT_SCHEMA_01" successfully completed at 15:14:05

———————————————————————————————————————————————————————————————————————————————

6.登入檢查

[oracle@11g ~]$ sqlplus dblink/dblink

SQL*Plus: Release 11.2.0.1.0 Production on Fri Oct 17 15:14:46 2014

Copyright (c) 1982, 2009, Oracle. All rights reserved.


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

 

成功結束。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2129836/,如需轉載,請註明出處,否則將追究法律責任。

相關文章