expdp 邏輯備份指令碼
#!/bin/bash
##########defined variable############
current_date=`date +%Y%m%d`
old_date=`date -d "3 day ago" +%Y%m%d`
#########create directory##################
if [ ! -d "/zhjs_bakup/$current_date" ];then
mkdir -p /zhjs_bakup/$current_date
else
echo "$current_date directory exits"
fi
##############create Logical directory############
sqlplus sys/oracle@cntjs as sysdba <<EOF
drop directory expdp;
create directory expdp as '/zhjs_bakup/${current_date}';
grant read,write on directory expdp to public;
set lines 200
col OWNER for a10
col DIRECTORY_NAME for a20
col DIRECTORY_PATH for a60
select OWNER,DIRECTORY_NAME,DIRECTORY_PATH from dba_directories where DIRECTORY_NAME='EXPDP';
EOF
##############source envionment variables################
source .bash_profile
######################expdp for backup###################
expdp \'sys/oracle@cntjs as sysdba\' directory=expdp dumpfile=expdp_cntjs_${current_date}_%U.dmp full=y parallel=10 cluster=no COMPRESSION=all exclude=STATISTICS logfile=expdp_cntjs_${current_date}.log
#####################backup for status###################
if [ $? == 0 ];then
echo -e "\033[32m ******** executed ${current_date} successfully ***********\033[0m"
else
echo -e "\033[31m ******** executed ${current_date} failed ****************\033[0m"
fi
####################delete 3 day befire backup ########################
ls -l /zhjs_bakup/$old_date
rm -rf /zhjs_bakup/$old_date
if [ $? == 0 ];then
echo -e "\033[32m ########delete backup $old_date successfully #############\033[0m"
else
echo -e "\033[31m ########delete backup $old_date failed ###########\033[0m"
fi
##########defined variable############
current_date=`date +%Y%m%d`
old_date=`date -d "3 day ago" +%Y%m%d`
#########create directory##################
if [ ! -d "/zhjs_bakup/$current_date" ];then
mkdir -p /zhjs_bakup/$current_date
else
echo "$current_date directory exits"
fi
##############create Logical directory############
sqlplus sys/oracle@cntjs as sysdba <<EOF
drop directory expdp;
create directory expdp as '/zhjs_bakup/${current_date}';
grant read,write on directory expdp to public;
set lines 200
col OWNER for a10
col DIRECTORY_NAME for a20
col DIRECTORY_PATH for a60
select OWNER,DIRECTORY_NAME,DIRECTORY_PATH from dba_directories where DIRECTORY_NAME='EXPDP';
EOF
##############source envionment variables################
source .bash_profile
######################expdp for backup###################
expdp \'sys/oracle@cntjs as sysdba\' directory=expdp dumpfile=expdp_cntjs_${current_date}_%U.dmp full=y parallel=10 cluster=no COMPRESSION=all exclude=STATISTICS logfile=expdp_cntjs_${current_date}.log
#####################backup for status###################
if [ $? == 0 ];then
echo -e "\033[32m ******** executed ${current_date} successfully ***********\033[0m"
else
echo -e "\033[31m ******** executed ${current_date} failed ****************\033[0m"
fi
####################delete 3 day befire backup ########################
ls -l /zhjs_bakup/$old_date
rm -rf /zhjs_bakup/$old_date
if [ $? == 0 ];then
echo -e "\033[32m ########delete backup $old_date successfully #############\033[0m"
else
echo -e "\033[31m ########delete backup $old_date failed ###########\033[0m"
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30345407/viewspace-2154834/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows邏輯備份-EXPDP(保留5天內邏輯備份)批處理指令碼Windows指令碼
- Oracle邏輯備份指令碼Oracle指令碼
- Oracle 邏輯備份 expdp/impdpOracle
- 揭祕ORACLE備份之--邏輯備份(EXPDP)Oracle
- Oracle 邏輯備份之EXPDP精講Oracle
- 使用Windows指令碼進行邏輯備份Windows指令碼
- WINDOWS下部署ORACLE邏輯匯出備份指令碼WindowsOracle指令碼
- Oracle資料庫的邏輯備份工具-expdp資料泵Oracle資料庫
- 使用crontab和expdp實現資料庫定期邏輯備份資料庫
- 邏輯備份--mysqldumpMySql
- mysql 邏輯備份 (mysqldump)MySql
- mysql的邏輯備份MySql
- Mysql備份與恢復(2)---邏輯備份MySql
- 揭祕ORACLE備份之--邏輯備份(EXP)Oracle
- MongoDB 邏輯備份工具mongodumpMongoDB
- MySql邏輯備份恢復MySql
- 邏輯備份全庫或者邏輯備份多個使用者的資料
- Oracle 11g EXPDP、RMAN自動備份SHELL指令碼Oracle指令碼
- Oracle裡邏輯備份、物理備份、Rman備份的區別Oracle
- ORACLE備份和恢復 - 邏輯備份 exp/impOracle
- 資料庫邏輯備份(轉)資料庫
- Oracle expdp/impdp匯入匯出備份資料庫指令碼Oracle資料庫指令碼
- AIX/Linux生產環境下crontab自動排程expdp邏輯備份例子AILinux
- Linux 平臺下 Oracle 資料泵備份(expdp) SHELL 指令碼LinuxOracle指令碼
- oracle邏輯備份之--資料泵Oracle
- windows下exp邏輯備份並且定期維護備份Windows
- rman備份和增量備份指令碼指令碼
- ORACLE備份指令碼Oracle指令碼
- mysqldump 備份指令碼MySql指令碼
- rman 備份指令碼指令碼
- mysqldump備份指令碼MySql指令碼
- innobackupex備份指令碼指令碼
- SQLServer備份指令碼SQLServer指令碼
- SQL 備份指令碼SQL指令碼
- Mongodb 備份指令碼MongoDB指令碼
- rman備份指令碼指令碼
- oracle 備份指令碼Oracle指令碼
- mysql備份指令碼MySql指令碼