溫馨提示×

溫馨提示×

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

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

Oracle數(shù)據(jù)庫備份腳本

發(fā)布時間:2020-08-09 05:19:20 來源:ITPUB博客 閱讀:151 作者:Mr_劉貴賓 欄目:關(guān)系型數(shù)據(jù)庫

物理備份腳本

#!/bin/sh


export TMPDIR=$TMP;

export ORACLE_SID=orcl;

export ORACLE_BASE=/u01/app/oracle;

export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1;

export PATH=/u01/app/oracle/product/12.2.0.1/db_1/bin:$PATH;

export LD_LIBRARY_PATH=/u01/app/oracle/product/12.2.0.1/db_1/lib:/lib:/usr/lib;

export CLASSPATH=/u01/app/oracle/product/12.2.0.1/db_1/JRE:/u01/app/oracle/product/12.2.0.1/db_1/jlib:/u01/app/oracle/product/12.2.0.1/db_1/rdbms/jlib;

export LANG=zh_CN


rman target/ << EOF

run{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

delete noprompt expired archivelog all;

backup incremental level 0 tag 'db0' format

'/home/oracle/rmanbackup/db0_%d_%T_%s' database include current controlfile;

sql 'alter system archive log current';

backup filesperset 5 format '/home/oracle/rmanbackup/cf0_%d_%T_%s' archivelog all delete input;

delete noprompt expired backup;

delete noprompt obsolete;

release channel c1;

release channel c2;

release channel c3;

}


EOF


邏輯備份腳本:

#!/bin/sh

DAY=`date +%Y%m%d`

FILE_TARGET=orcl`date +%Y%m%d`.dmp

FILE_LOG=orcl`date +%Y%m%d`.log

export FILE_TARGET FILE_LOG;

export ORACLE_BASE=/u01/app/oracle;

export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1;

export ORACLE_SID=orcl;

export PATH=$ORACLE_HOME/bin:$PATH;

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

export CLASSPATH=/u01/app/oracle/product/12.2.0.1/db_1/JRE:/u01/app/oracle/product/12.2.0.1/db_1/jlib:/u01/app/oracle/product/12.2.0.1/db_1/rdbms/jlib;

expdp system/******  directory=expdir dumpfile=$FILE_TARGET full=y  logfile=$FILE_LOG

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI