Win platform Oracle Rman Backup and delete DG Standby archive log Script _oracle

Source: Internet
Author: User
Always feel that using Windows to run Oracle is not reliable thing, can this world there are always a lot of people like to do things like this, for the database more common two things: Rman and delete the DG Standby archive log, on the Linux/unix platform using shell implementation is very simple, But ran to win inside, became vexed, not because of the trouble, but because the use of less people, do not know how to deal with the matter, I wrote a simple implementation of the basic function of win below Rman Backup and delete Repository archive log script, for everyone to reference, but also more welcome friends to put forward a better way to deal with ( Win is really not understand)
Rman Backup Script
Copy Code code as follows:

--backup_oracle.bat file
Rman Target/cmdfile=d:/backup/rman/backup_db.rman
Log=d:/backup/rman/logfile/rmanlog%date:~0,4%%date:~5,2%%date:~8,2%.log

--backup_db.rman file
CONFIGURE RETENTION POLICY to redundancy = 2;
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DEFAULT DEVICE TYPE to DISK;
Backup Filesperset = 5 as Compressed backupset database format ' D:/backup/rman/full_%u.rman ';
SQL ' alter system archive log current ';
Backup Filesperset = as compressed backupset archivelog all format ' d:/backup/rman/arch_%u.rman ' delete input;
DELETE noprompt OBSOLETE;
Crosscheck backup;
Delete noprompt expired backup;
Backup format ' D:/backup/rman/ctl_%u.rman ' current controlfile;
Backup spfile format ' D:/backup/rman/spfile_%u.rman ';
Exit
Backup_oracle.bat

File is added to the scheduled task
Delete the DG Repository archive log (already applied)
Copy Code code as follows:

--delete_dg_archivelog.bat
REM Note Modify the deployment directory
CD D:/win_xifenfei
D:
REM Note whether the Delete_archive.sql query has records

echo Delete Archivelog staring > Delete_archivelog.bak
Sqlplus/as sysdba @delete_archive. sql
Echo Rman Target/cmdfile=rman_checkcross.rman>>delete_archivelog.bat
Delete_archivelog.bat >>delete_dg_archivelog_%date:~0,4%%date:~5,2%%date:~8,2% ". Log
Exit

--delete_archive.sql
Set Lines 150
Col name for a150
Set pagesize 0 Feedback off verify out heading off echo off
Spool Delete_archivelog.bat
Select ' Del ' | | The name from V$archived_log where applied= ' YES ' and ' are ' not NULL and dest_id=1;
Spool off
Exit

--rman_checkcross.rman
Crosscheck Archivelog All;
Delete noprompt expired archivelog all;
Exit
Delete_dg_archivelog.bat

Add to the scheduled task
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.