data pump (数据抽取)测试_oracle

背景介绍>利用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

 

成功结束。