Oracle 数据泵导表记录
sqlplus / as sysdba create directory dir_dp as ‘/app/oracle/product/11.2.0/dbhome_1/dump’; --创建逻辑目录 select * from dba_directories;–查看逻辑目录名称及目录位置 导入时需将dmp文件放在directory目录下
导出全量表结构,不导数据 expdp system/linkage@192.168.1.11:1521/lcfa schemas=system directory=dir_dp dumpfile=expdpcas317.dmp logfile=expdp.log content=metadata_only
impdp system/linkage@192.168.1.11:1521/lcfa schemas=system directory=dir_dp dumpfile=expdpcas317.dmp logfile=impdp.log content=metadata_only
exp导入导出指定表: 将aaa用户下的某张表导出,并在ccc用户下导入 exp aaa/aaa32@lcfa tables=name_userinfo FILE=name_userinfo.dmp log=20220423.log;
imp ccc/ccc43@newsjpdb tables=name_userinfo FILE=/data/wgdata/name_userinfo.dmp log=0423.log;
按用户导出所有表并排除数据量较大的表: 导出test用户下所有表并排除几张不需要的表 EXCLUDE接IN 精确匹配—接LIKE 模糊匹配 EXCLUDE参数可同时接IN或LIKE expdp “/ as sysdba” schemas=test directory=DUMP_ABSADMIN dumpfile=testquanbiao.dmp logfile=expdp.log cluster=no PARALLEL=4 EXCLUDE=TABLE:“IN ‘B_DET09_28’”,EXCLUDE=TABLE:“LIKE’B_DET02_%'”,EXCLUDE=TABLE:“LIKE ‘B_SONLINE0%’”,EXCLUDE=TABLE:“LIKE ‘B_AUTHFAIL%’”,EXCLUDE=TABLE:“LIKE ‘B_FILTER%’”,EXCLUDE=TABLE:“IN ‘B_DET12_31’”
impdp “/ as sysdba” content=all table_exists_action=replace directory=DATA_PUMP_DIR dumpfile=testquanbiao.dmp logfile=impdp_test.log parallel=24 cluster=n schemas=test
导出指定表结构 INCLUDE参数不可同时接IN或LIKE,需分开操作 expdp “/ as sysdba” SCHEMAS=test INCLUDE=TABLE:“IN (‘B_DET09_28’,‘B_DET12_31’)” CONTENT=METADATA_ONLY DIRECTORY=DATA_PUMP_DIR DUMPFILE=danbiao.dmp LOGFILE=expdp_hntest.log
impdp “/ as sysdba” SCHEMAS=test INCLUDE=TABLE:“IN (‘B_DET09_28’,‘B_DET12_31’)” CONTENT=METADATA_ONLY DIRECTORY=DIR_DP DUMPFILE=danbiao.dmp
导出指定表结构(模糊查找) B_DET02_开头的所有表都导出 expdp “/ as sysdba” SCHEMAS=test INCLUDE=TABLE:“LIKE (‘B_DET02_%’)” CONTENT=METADATA_ONLY DIRECTORY=DATA_PUMP_DIR DUMPFILE=danbiao1.dmp LOGFILE=expdp_hntest1.log
impdp “/ as sysdba” SCHEMAS=test INCLUDE=TABLE:“LIKE (‘B_DET02_%’)” CONTENT=METADATA_ONLY DIRECTORY=DIR_DP DUMPFILE=danbiao1.dmp
数据泵具体接的参数可自行百度!!
|