2014-12-24 Created by Baoxinjian
I. Summary
In short, the Backup Recovery command for Rman is written as a script and saved in the recovery directory, and the availability and versatility of the script within the recovery directory is higher than the file system-based script.
As long as the client can log in to the Rman recovery directory, these scripts are available, especially for global scripts, which can be dispatched by any registered database.
Ii. Classification of scripts
1. Local
Scripts created under the target database of the Rman connection, such scripts only apply to the current target database. That is, an Rman script created for a specific database.
2. Global
Can be executed in any target database that recovers directory registrations.
Iii. Creating scripts
1. Create a global backup script
RMAN>Create'A scriptfor full backup to being used with any database'
{backupdatabaseplus archivelogtag='whole_db _BK'; Delete obsolete;}
Created Global script Global_full_backup
2. Create a local backup script
rman> create script full_backupcomment a script for full backup to being used with the current target database '
Created Script Full_backup
3. Create a script from a text file
[[email protected] BK]$ cat Backup_ctl_spfile--Note that the text file must start with "{" and End With "}"{Allocate channel CH1 device typeDisk;Backup CurrentControlfiletag='Ctl_spfile'format'/u01/oracle/bk/rmbk/ctl_spfile_%d_%u'; release channel CH1;}
rman> Create script ctl_spfile_bk from file '/u01/oracle/bk/rmbk/backup_ctl_spfile ';
Script commands'll be loaded from file/u01/oracle/bk/rmbk/backup_ctl_spfile
Created Script CTL_SPFILE_BK
Iv. viewing the contents of a script
1. Syntax
print [Global] script Script_name
print [Global] script script_name to file ' <dir> '--convert Rman storage script to filesystem readable file
2. Example
rman> print script ctl_spfile_bk;printing stored script:ctl_spfile_bk{allocate channel CH1 device Type disk backup current Controlfiletag = ctl_spfile format /u01/oracle/bk/rmbk/ctl_spfile_%d_%u ;release channel Ch1;}
rman> Print script ctl_spfile_bk to file '/u01/oracle/bk/rmbk/backup_ctl_spfile2 ';
3. View the scripts in the current recovery directory
list [Global | all] script names
rman> list script names;
V. Update scripts
1. Syntax
Replace [global] script Scrip_name {...}
Replace [global] script script_name from file ' <dir> '--updating scripts from files
2. Rman Example
RMAN>replace Global script global_full_backup{backup as Database plus archivelogtag='whole_db_bk'; Delete obsolete;}
Replaced global script Global_full_backup
Vi. Executing scripts
1. Syntax:
RUN {EXECUTE [global] SCRIPT script_name;}
2. Execute scripts from the Rman client directly within the recovery directory
Rman Target SYS/oracle@odellprod Catalog Rman/rman@catadb'script_ Name'; RMAN>execute global script global_full_backup;} Executing global script:global_full_backup
Vii. Deleting scripts
1. Method:
Delete [Global] script Script_name
2. How to delete
RMAN>Delete script ctl_spfile_bk;
Viii. Other
Note: When using commands such as execute script,delete script,print scripts, if a local script is not found, look for the global script instead.
Therefore, you should pay attention to the naming specification, as far as possible do not use the name of the same name, when delete script cannot find the local script, and find the same names of global script, the global script is deleted
Thanks and regards
Rman_ Learning Note 5_rman Catalog script to recover directory scripts