首页 > Linux操作系统 > Linux操作系统 > impdp和expdp的使用
expdp的使用:
conn system/manager
create directory test_dir as 'd:\dump'
grant read,write on directory test_dir to kai
1.导出表
expdp kai/kai directory=test_dir dumpfile=tab.dmp tables=dept,emp
2.导出方案:
expdp system/manager directory=test_dir dumpfile=schema.dmp schemas=kai,scott (具有dba或exp_full_database角色)
3.导出表空间:
expdp system/manager directory=test_dir dumpfile=tablespace.dmp tablespaces=tablespace1,tablespace2 (具有dba或exp_full_database角色)
4.导出数据库:
expdp system/manager directory=test_dir dumpfile=full.dmp full=y (具有dba或exp_full_database角色)
(不会导出sys,ordsys,xdb等对象)
expdp kai/kai directory=test_dir dumpfile=obj.dmp logfile=obj.log tables=newtable status=10;
impdp的使用:
1.导入表:
impdp kai/kai directory=test_dir dumpfile=tab.dmp tables=dept,emp (导入到kai中)
impdp system/manager directory=test_dir dumpfile=tab.dmp tables=kai.dept,kai.emp remap_schema=scott:system (导入到system中)
2.导入方案:
impdp kai/kai directory=test_dir dumpfile=schema.dmp schemas=kai (导入到kai中)
impdp system/manager directory=test_dir dumpfile=schema.dmp schemas=kai remap_schema=kai:system (导入到system中)
3.导入表空间:
impdp system/manager directory=test_dir dumpfile=tablespace.dmp tablespace=tablespace1
4.导入数据库:
impdp system/manager directory=test_dir dumpfile=full.dmp full=y
使用expdp/impdp搬移表空间:
1.
conn system/manager
select platform_name from v$transportable_platform
2.自包含
conn system/manager
execute sys.dbms_tts.transport_set_check('tablespace2',true)
select * from sys.transport_set_violations //查询结果要么删除
3.只读
alter tablespace tablespace2 read only;
host expdp system/manager directory=test_dir dumpfile=transport.dmp transport_tablespaces=tablespace2
4.传送文件到目标数据库
host copy d:\demo\user2.dbf d:\oracle\oradata\orcl\user2.dbf
5.插入表空间到目标数据库
alter system set db_cache_Size=20M
alter system set db_4k_cache_size=4M; (如果源库块为4k,目标库为8k)
host impdp system/orcl directory=test_dir dumpfile=transport.dmp transport_datafiles=d:\oracle\oradata\orcl\user2.dbf remap_schema=
alter tabelspace tablespace2 read write;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/658698/viewspace-372001/ ,如需转载,请注明出处,否则将追究法律责任。