expdp/impdp 参数network_link使用测试
下面是network_link常用的三个环境测试
1,,服务器端的数据导出到指定的客户端
2,不同数据库间迁移数据。
3,同一个数据库中不同用户之间迁移数据。
一:服务器端的数据导出到指定的客户端
1,修改客户端的tnsnames文件
power1 =
(description =
(address_list =
(address = (protocol = tcp)(host = 192.168.111.13)(port = 1521))
)
(connect_data =
(server = dedicated)
(service_name = power1)
)
)
2,创建dblink
sql> create public database link power1
2 connect to scott
3 identified by oracle
4 using 'power1';
database link created.
sql> select * from dual@power1;
d
-
x
3,directory目录
sql> set lines 170
sql> col owner for a15
sql> col directory_name for a60
sql> col directory_name for a30
sql> col directory_path for a70
sql> select * from dba_directories;
owner directory_name directory_path
--------------- ------------------------------ ----------------------------------------------------------------------
sys dump /tmp
sys toad_bdump_dir /u01/app/oracle/diag/rdbms/orcl11g/orcl11g/trace
sys xmldir /u01/app/oracle/product/11.2/db_1/rdbms/xml
sys data_pump_dir /u01/app/oracle/admin/orcl11g/dpdump/
sys oracle_ocm_config_dir /u01/app/oracle/product/11.2/db_1/ccr/state
如果不存在使用create directory创建再用grant授予用户权限
4,导数据
[oracle11g@rhel4 admin]$ expdp system/oracle directory=dump dumpfile=scott_test.dmp logfile=scott_log.dmp network_link='power1' schemas=scott
export: release 11.2.0.3.0 - production on tue mar 26 18:22:28 2013
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
ora-31631: privileges are required
ora-39149: cannot link privileged user to non-privileged user
grant这个命令要在源端数据库上面执行
sql> grant exp_full_database to scott;
grant succeeded.
回到客户端上面
[oracle11g@rhel4 admin]$ expdp system/oracle directory=dump dumpfile=scott_test.dmp logfile=scott_log.dmp network_link='power1' schemas=scott
export: release 11.2.0.3.0 - production on tue mar 26 19:40:03 2013
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
ora-39001: invalid argument value
ora-39000: bad dump file specification
ora-31641: unable to create dump file /tmp/scott_test.dmp
ora-27038: created file already exists
additional information: 1
[oracle11g@rhel4 admin]$ expdp system/oracle directory=dump dumpfile=scott_test.dmp logfile=scott_log.dmp network_link='power1' schemas=scott reuse_dumpfiles=y
export: release 11.2.0.3.0 - production on tue mar 26 19:42:29 2013
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
starting system.sys_export_schema_01: system/******** directory=dump dumpfile=scott_test.dmp logfile=scott_log.dmp network_link=power1 schemas=scott reuse_dumpfiles=y
estimate in progress using blocks method...
processing object type schema_export/table/table_data
total estimation using blocks method: 2.129 gb
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
processing object type schema_export/procedure/procedure
processing object type schema_export/procedure/alter_procedure
processing object type schema_export/table/index/index
processing object type schema_export/table/constraint/constraint
processing object type schema_export/table/index/statistics/index_statistics
processing object type schema_export/table/constraint/ref_constraint
processing object type schema_export/table/statistics/table_statistics
. . exported scott.test 1.800 gb 19096576 rows
. . exported scott.dept 5.929 kb 4 rows
. . exported scott.emp 8.562 kb 14 rows
. . exported scott.salgrade 5.859 kb 5 rows
. . exported scott.bonus 0 kb 0 rows
master table system.sys_export_schema_01 successfully loaded/unloaded
******************************************************************************
dump file set for system.sys_export_schema_01 is:
/tmp/scott_test.dmp
job system.sys_export_schema_01 successfully completed at 19:46:1
已经成功导出到客户端指定的位置