RAC 開啟歸檔日誌

huangdazhu發表於2016-07-05
1:先調整
sql>alter system set log_archive_dest_1='LOCATION=/arch' scope=spfile sid='lcamDB1';
sql>alter system set log_archive_dest_1='LOCATION=/arch' scope=spfile sid='lcamDB2';
sql>alter system set log_archive_format ='arch1_%s_%R_%T.arc' scope=spfile sid='lcamdb1';
sql>alter system set log_archive_format ='arch2_%s_%R_%T.arc' scope=spfile sid='lcamdb2';
 srvctl stop database -d lcamdb -o immediate


-- startup database in mount mode
 srvctl start database -d lcamdb -o mount


-- enable archvive logging
4:$ sqlplus / as sysdba
sql> alter database archivelog;


5:-- stop database
$ srvctl stop database -d lcamdb -o immediate


6:-- restart all database instances
$ srvctl start database -d lcamdb
7:調整歸檔空間
alter system set DB_RECOVERY_FILE_DEST_SIZE=500g


[oracle@lcamdb1 archive_lcamdb1]$ srvctl status database -d lcamdb
Instance lcamdb1 is running on node lcamdb1
Instance lcamdb2 is running on node lcamdb2


配置自動清理腳步
arch_space_usage=`df -m|grep /arch | grep -v /arch01 |awk '{if($4/1>80)print $NF" Filesystem space usage ."$4}'`
if test -z "$arch_space_usage"; then
 echo " `date`:Archive space not greater than 80 %" >> /tmp/arch_dir.log
else
 echo " `date`:Archive space greater than 80%" >> /tmp/arch_dir.log
rm -rf /arch/*.arc >> /tmp/arch_dir.log
fi


刪除5天前的資料Vi del_lcam_data.sh
#bin/sh
filename=`find /tmp01/archive_lcamdb1/*.arc -mtime +5`
rm -rf $filename 


一般需要把歸檔日誌放到儲存上,所以需要進一步的做調整! 還有接入磁帶庫!以及備份等工作!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28869493/viewspace-2121559/,如需轉載,請註明出處,否則將追究法律責任。

相關文章