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';


 

posted @ 2017-08-24 15:03  DaryllD  阅读(157)  评论(0编辑  收藏  举报