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
The code is as follows |
Copy Code |
--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 = 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)
The code is as follows |
Copy Code |
--delete_dg_ Archivelog.bat REM Note Modify deployment directory CD D:/win_xifenfei D: REM Note Delete_archive.sql query has records E Cho Delete Archivelog staring > Delete_archivelog.bak sqlplus/as sysdba @delete_archive. SQL Echo Rman targe t/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 Col name for a150 Set pagesize 0 feedback off verify off heading off echo off spool Delete_archivelog.bat S Elect ' 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 Scheduled Tasks