Databases Reference
In-Depth Information
The output is as follows:
executing global script: delete_arc_logs
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ------------------- ----
116 1 40 A 08/07/12 11:23:15 C:\FLASH\MOBDB10\ARCHIVELOG\2012_08_07\O1_
MF_1_40_2V9VWM6T_.ARC
... and so on ...
The global script has now executed.
How It Works
When you call a script as follows:
RMAN> run { execute script delete_arc_logs; }
the local script is executed, if there is a local script. RMAN looks for a local script first and executes that if it is found.
Only if no local script exists will RMAN go on to execute the global script. That is the default behavior. You can,
however, add the clause global before the word script to make RMAN execute a global script no matter what.
Converting Stored Scripts to Files
Problem
You want to convert a stored script in the catalog database to an operating system file.
Solution
The print script command shown in Recipe 9-11 has a clause to redirect the output to a file. If you want to store the
code in the script delete_arc_logs in the file c:\tools\delete_arc_logs.rman, issue the following command:
RMAN> print script delete_arc_logs to file 'c:\tools\delete_arc_logs.rman';
script delete_arc_logs written to file c:\tools\delete_arc_logs.rman
RMAN>
This generates a file named delete_arc_logs.rman in the C:\TOOLS directory.
How It Works
Generating files from stored scripts is a good way to protect scripts. You can store the scripts on local file systems as
backups against the catalog database. The generated files also are handy while transferring scripts from one database
to another. You will learn how to do the reverse—create a script from a file—in Recipe 9-16.
The generated file looks exactly like the code in the script. Here is what the contents of the file look like:
{ delete noprompt archivelog all; }
 
Search WWH ::




Custom Search