Oracle Data Guard (RAC + DG) archive deletion policy

Source: Internet
Author: User

Oracle Data Guard (RAC + DG) archive deletion policy 1. Data Guard master database archive deletion policy: When we set: RMAN> configure archivelog deletion policy to applied on standby; in Maximum Availability and Maximum Performance, when RMAN backs up the archive file and adds delete input, the archive will be deleted. RMAN> configure archivelog deletion policy to none; in this case, the archive deletion policy is canceled. 2. Data Guard backup database archive deletion policy the backup database archive deletion policy is upgraded on the basis of the standalone version, and the log function is added, the archive file of the master database of two node RAC can be deleted from the slave database. It can be executed as a scheduled task or separately in interactive form. Because the standby database generally does not execute the rman backup plan, you need scripts to delete these archive log files. [Oracle @ hainan backup_scripts] $ vim delstarch. shexport ORACLE_THREAD = $1 export ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID = bdspoc export SHELL_DIR =/u01/app/oracle/backup_scripts export DATE = $ (date + % Y-% m-% d \ % H: % M: % S) if [! $ ORACLE_THREAD]; then read-p "Enter deleted thread [1 | 2]:" DB_THREAD = $ REPLY else DB_THREAD = $ ORACLE_THREAD fi if [$ DB_THREAD = 1]; then del_seq = 'ls/arch | grep ^ 1 | cut-f2-d _ | sort-n | head-1 'echo $ del_seq "is the minimum archlog sequence" $ ORACLE_HOME/ bin/sqlplus-s "sys/***** as sysdba" <eof> $ SHELL_DIR/max_sn.log set head off; set feedback; select max (sequence #) from v \ $ log_history where THR EAD # = 1; exit; eof max_sn = 'cat/u01/app/oracle/backup_scripts/max_sn.log | awk '{print $1}' | grep ^ [0-9] '# retain the last 20 Archives, delete max_sn = 'expr $ max_sn-20 'echo $ max_sn "is the maximum archlog sequence" while [$ del_seq-lt $ max_sn] do DATE = $ (date + % Y % m % d _ % H % M % S) rm/arch/1 _ "$ del_seq" _ 816281825.arc DATE =$ (date + % Y-% m-% d \ % H: % M: % S) # Because log_archive_format is % t _ % s _ % r. arc Type, % r is resetlog id echo "$ DATE"/arch/1 _" $ Del_seq "_ 816281825.arc> $ SHELL_DIR/delarch. log del_seq = 'expr $ del_seq + 1 'echo "$ DATE" 1 _ "$ del_seq" _ 816281825.arc done elif [$ DB_THREAD = 2]; then del_seq = 'ls/arch | grep ^ 2 | cut-f2-d _ | sort-n | head-1 'echo $ del_seq "is the minimum archlog sequence" $ ORACLE_HOME/ bin/sqlplus-s "sys/***** as sysdba" <eof> $ SHELL_DIR/max_sn.log set head off; set feedback; select max (sequence #) from v \ $ log_hi Story where upper (THREAD #) = 2; exit; eof max_sn = 'cat/u01/app/oracle/backup_scripts/max_sn.log | awk '{print $1}' | grep ^ [0-9] 'max_sn = 'expr $ max_sn- 20 'echo $ max_sn "is the maximum archlog sequence" while [$ del_seq-lt $ max_sn] do rm/arch/2 _ "$ del_seq" _ 816281825.arc DATE = $ (date + % Y-% m-% d \ % H: % M: % S) echo "$ DATE"/arch/2 _ "$ del_seq" _ 816281825.arc> $ SHELL_DIR/delarch. log echo "$ DATE" 2 _ "$ del_seq" _ 8 16281825. arc has been deleted del_seq = 'expr $ del_seq + 1 'done else echo "$ DATE" There has a fault db_thread value! >>$ SHELL_DIR/delarch. log fi can be executed interactively, for example, [oracle @ hainan backup_scripts] $ sh delstarch. sh Enter deleted thread [1 | 2]: 1 -- select the node from which to delete the archived log files. You can also create a scheduled task to execute this script [root @ hainan ~] # Crontab-l 0 1 *** su-oracle-c/u01/app/oracle/backup_scripts/delstarch. sh 1 0 2 *** su-oracle-c/u01/app/oracle/backup_scripts/delstarch. sh 2 executes the log files archived by node 1 every day, and the log files archived by node 2 at Node 2.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.