Databases Reference
In-Depth Information
Enter value for 1: a
created script del_arc_log_pattern
Note how the pattern has been specified as %&1.% . The second % character is separated from the &1 by a period.
Now, to delete the archived redo logs with the string 2007_05_11 in them, you can call the script as follows:
RMAN> run {execute script del_arc_log_pattern using '2012_08_05'; }
executing script: del_arc_log_pattern
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
List of Archived Log Copies for database with db_unique_name MOBDB11
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
75 1 38 A 05-AUG-12
Name: C:\ORACLE\FLASH\MOBDB11\ARCHIVELOG\2012_08_05\O1_MF_1_38_348WK5OZ_.ARC
76 1 39 A 05-AUG-12
Name: C:\ORACLE\FLASH\MOBDB11\ARCHIVELOG\2012_08_05\O1_MF_1_39_348WKBQX_.ARC
77 1 40 A 05-AUG-12
Name: C:\ORACLE\FLASH\MOBDB11\ARCHIVELOG\2012_08_05\O1_MF_1_40_348WKCB8_.ARC
78 1 41 A 05-AUG-12
Name: C:\ORACLE\FLASH\MOBDB11\ARCHIVELOG\2012_08_05\O1_MF_1_41_348WKJ6C_.ARC
Do you really want to delete the above objects (enter YES or NO)? no
Parameterized scripts help significantly in managing the infrastructure with RMAN. You can create just one script
and then call it several times with different values of the parameter, which reduces the overall scripting time and
potential for errors.
Creating a Parameterized Command File Script
Problem
You want to create an RMAN command file script that can accept a parameter.
Solution
Starting with Oracle Database 11g Release 1, to create a RMAN command file in Unix (or Windows) that can accept
a parameter, you simply create a file with content like this:
run { delete noprompt archivelog sequence &1 ; }
Note the &1 at the end, which is the positional parameter whose value you will pass later. Name this file delete_
arc_logs.rman, and place it in the directory /u01/rmanscripts . Now call the script to delete the archived redo log 36,
as shown here:
$ rman target=/ @u01/rmanscripts/delete_arc_logs.rman using 36
 
Search WWH ::




Custom Search