中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle 11G&12C備份腳本

發布時間:2020-07-03 14:24:55 來源:網絡 閱讀:271 作者:我不是九爺 欄目:云計算

#對某服務器上的多個用戶備份,自動刪除N天前的備份數據
#::::::::::::::::::::::::::::::::::::::::::::::::::::: 參數配置(需要管理員初始化)
# param_oracleServerBin?? ??? ??? ?可選?? ?Oracle Server Bin所在目錄
# param_LocalNetServicesName?? ?必選?? ?本地Net服務器名?? ?(tnsnames.ora中的名稱,而不是sid)

# param_homeBak_Local?? ??? ??? ?可選?? ?備份文件到本地?? ??? ?(dmp文件相關)?? ?
# param_homeBak_Remote ?? ??? ??? ?可選?? ?備份文件復制到遠程?? ?(dmp文件相關)?? ?

# param_delFileDay_Local?? ??? ?可選?? ?刪除N天前本地備份?? ?(dmp文件相關)
# param_delFileDay_Remote?? ??? ?可選?? ?刪除N天前遠程備份?? ?(dmp文件相關)
echo "===================================================" ?
export param_homeBak_Local=/opt/backup
export param_homeBak_Remote=

export param_delFileDay_Local=
export param_delFileDay_Remote=

export param_oracleHome=/data/oracle/product/11.2.0/dbhome_1
export param_LocalNetServicesName=ORCL

export User01=NC20181113
export User02=
export User03=
export User04=
export User05=
export User06=
export User07=
export User08=
export User09=
export User10=
export User11=
export User12=
export User13=
export User14=
export User15=

export Pass01=NC20181113
export Pass02=
export Pass03=
export Pass04=
export Pass05=
export Pass06=
export Pass07=
export Pass08=
export Pass09=
export Pass10=
export Pass11=
export Pass12=
export Pass13=
export Pass14=
export Pass15=
#::::::::::::::::::::::::::::::::::::::::::::::::::::: 以下內容不要調整
#=================? 生成日期 用于備份
export CurrentDateTime=`date +%Y%m%d%H%M%S` ?
#================= 重新設置變量
# Home_Backup 當前sh位置
export Home_Backup=$(pwd)
export HomeBak_Local=$Home_Backup
export HomeBak_Remote=$Home_Backup

if [[ $param_homeBak_Local != "" ]] ; then export HomeBak_Local=$param_homeBak_Local ;fi
if [[ $param_homeBak_Remote != "" ]] ; then export HomeBak_Remote=$param_homeBak_Remote ;fi

if [[ $param_delFileDay_Local = "" ]] ; then export param_delFileDay_Local=7 ;fi
if [[ $param_delFileDay_Remote = "" ]] ; then export param_delFileDay_Remote=1 ;fi

export HomeBak_KeyName=OracleDb

export HomeBak_Local=$HomeBak_Local/$HomeBak_KeyName"_bakLocal"
export HomeBak_Remote=$HomeBak_Remote/$HomeBak_KeyName"_bakRemote"

export homeBak_TimeFolder=$CurrentDateTime"_"$HomeBak_KeyName

export homeBak_TimeFolder_Local=$HomeBak_Local
export homeBak_TimeFolder_Remote=$HomeBak_Remote

#================= 創建文件夾,刪除N天前的備份文件夾
#創建文件夾
mkdir -p $homeBak_TimeFolder_Local
mkdir -p $HomeBak_Remote
#刪除N天前文件
find $homeBak_TimeFolder_Local -mtime +$param_delFileDay_Local -name "*.*" -exec rm -rf {} \;
find $homeBak_TimeFolder_Remote -mtime +$param_delFileDay_Remote -name "*.*" -exec rm -rf {} \;

#================= 備份Oracle
# 創建新的路徑+文件名
export FileName_01=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User01
export FileName_02=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User02
export FileName_03=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User03
export FileName_04=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User04
export FileName_05=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User05
export FileName_06=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User06
export FileName_07=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User07
export FileName_08=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User08
export FileName_09=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User09
export FileName_10=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User10
export FileName_11=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User11
export FileName_12=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User12
export FileName_13=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User13
export FileName_14=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User14
export FileName_15=$homeBak_TimeFolder_Local/$CurrentDateTime"_"$User15

export ORACLE_HOME=$param_oracleHome
export PATH=$ORACLE_HOME/bin:$PATH

if [[ $User01 != "" ]] && [[ $Pass01 != "" ]] ; then exp $User01/$Pass01@$param_LocalNetServicesName owner=$User01 file=$FileName_01.dmp log=$FileName_01.log ;fi
if [[ $User02 != "" ]] && [[ $Pass02 != "" ]] ; then exp $User02/$Pass02@$param_LocalNetServicesName owner=$User02 file=$FileName_02.dmp log=$FileName_02.log ;fi
if [[ $User03 != "" ]] && [[ $Pass03 != "" ]] ; then exp $User03/$Pass03@$param_LocalNetServicesName owner=$User03 file=$FileName_03.dmp log=$FileName_03.log ;fi
if [[ $User04 != "" ]] && [[ $Pass04 != "" ]] ; then exp $User04/$Pass04@$param_LocalNetServicesName owner=$User04 file=$FileName_04.dmp log=$FileName_04.log ;fi
if [[ $User05 != "" ]] && [[ $Pass05 != "" ]] ; then exp $User05/$Pass05@$param_LocalNetServicesName owner=$User05 file=$FileName_05.dmp log=$FileName_05.log ;fi
if [[ $User06 != "" ]] && [[ $Pass06 != "" ]] ; then exp $User06/$Pass06@$param_LocalNetServicesName owner=$User06 file=$FileName_06.dmp log=$FileName_06.log ;fi
if [[ $User07 != "" ]] && [[ $Pass07 != "" ]] ; then exp $User07/$Pass07@$param_LocalNetServicesName owner=$User07 file=$FileName_07.dmp log=$FileName_07.log ;fi
if [[ $User08 != "" ]] && [[ $Pass08 != "" ]] ; then exp $User08/$Pass08@$param_LocalNetServicesName owner=$User08 file=$FileName_08.dmp log=$FileName_08.log ;fi
if [[ $User09 != "" ]] && [[ $Pass09 != "" ]] ; then exp $User09/$Pass09@$param_LocalNetServicesName owner=$User09 file=$FileName_09.dmp log=$FileName_09.log ;fi
if [[ $User10 != "" ]] && [[ $Pass10 != "" ]] ; then exp $User10/$Pass10@$param_LocalNetServicesName owner=$User10 file=$FileName_10.dmp log=$FileName_10.log ;fi
if [[ $User11 != "" ]] && [[ $Pass11 != "" ]] ; then exp $User11/$Pass11@$param_LocalNetServicesName owner=$User11 file=$FileName_11.dmp log=$FileName_11.log ;fi
if [[ $User12 != "" ]] && [[ $Pass12 != "" ]] ; then exp $User12/$Pass12@$param_LocalNetServicesName owner=$User12 file=$FileName_12.dmp log=$FileName_12.log ;fi
if [[ $User13 != "" ]] && [[ $Pass13 != "" ]] ; then exp $User13/$Pass13@$param_LocalNetServicesName owner=$User13 file=$FileName_13.dmp log=$FileName_13.log ;fi
if [[ $User14 != "" ]] && [[ $Pass14 != "" ]] ; then exp $User14/$Pass14@$param_LocalNetServicesName owner=$User14 file=$FileName_14.dmp log=$FileName_14.log ;fi
if [[ $User15 != "" ]] && [[ $Pass15 != "" ]] ; then exp $User15/$Pass15@$param_LocalNetServicesName owner=$User15 file=$FileName_15.dmp log=$FileName_15.log ;fi

#================= 復制到遠程
cp $homeBak_TimeFolder_Local/$CurrentDateTime*.* $homeBak_TimeFolder_Remote
#:::::::::::::::::::::::::::::::::::::::::::::::::::::
echo "Bakup completed." ?

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

广东省| 大连市| 新河县| 邯郸县| 奉化市| 南宁市| 乌鲁木齐市| 崇阳县| 明星| 绥中县| 会理县| 上栗县| 望城县| 吉安县| 儋州市| 福泉市| 清流县| 临城县| 天柱县| 广饶县| 昂仁县| 锡林郭勒盟| 宜良县| 泰州市| 雷州市| 台北市| 通辽市| 苍南县| 定陶县| 昭通市| 綦江县| 巴青县| 礼泉县| 兴业县| 成安县| 紫云| 白城市| 青海省| 大方县| 云阳县| 原平市|