zbb20170824 oracle expdp/impdp 导入导出数据

databasebackup.sh

#! /bin/bash

#数据库备份

echo '###################################################'`date +%Y-%m-%d`'###################################################'

echo "begin time: "`date +%Y_%m_%d--%H:%M:%S-%W_%w`

datew=`date +%Y_%m_%d--%H_%M_%S--%W_%w`

source ~/.bash_profile

#生产
#exp备
#exp champion/century file=/app/oracle/backup/champion_$datew.dmp log=/app/oracle/backup/champion_$datew.log

#expdp备份:
#1. 在数据库中创建directory, create directory dump_dir as '/app/oracle/backup/';
#2. 命令行:expdp champion/century directory=dump_dir dumpfile=champion_dump_$datew.dmp logfile=champion_dump_$datew.log schemas=champion
#parallel: 并行进程数

#恢复:
# impdp champion/century directory=dump_dir dumpfile=$dumpfile.dmp schemas=champion logfile=impdp.log 
expdp champion/century directory=dump_dir dumpfile=champion_dump_$datew.dmp logfile=champion_dump_$datew.log schemas=champion parallel=64

echo "end time: "`date +%Y_%m_%d--%H:%M:%S-%W_%w`

exit

导入前先删除表和序列
select 'drop table '||table_name||';'
from cat
where table_type='TABLE';




select 'drop sequence '||table_name||';'
from cat
where table_type='SEQUENCE';


 

转载于:https://www.cnblogs.com/super-admin/p/7423146.html

你可能感兴趣的:(zbb20170824 oracle expdp/impdp 导入导出数据)