To start an Oracle backup using RMAN, an Oracle backup specification must be created.
See “Configuring an Oracle Backup” on page 36 for information on how to create an Oracle backup specification.
To start an Oracle backup using RMAN:
1. Connect to the Oracle target database specified in the backup specification:
If you use the recovery catalog, run:
Oracle 9i/10g:
• On Windows: <ORACLE_HOME>\bin\rman target
<Target_Database_Login> catalog
<Recovery_Catalog_Login>
• On UNIX: <ORACLE_HOME>/bin/rman target
<Target_Database_Login> catalog
<Recovery_Catalog_Login>
• On OpenVMS:
a. Run ORAUSER.COM using $@OMNI$ROOT:[LOG]LOGIN.COM.
b. Execute $rman target <target_connect_string> catalog
<catalog_connect_string>.
Oracle 8i:
Use rcvcat instead of catalog in the above syntax.
If you do not use the recovery catalog:
• On Windows: <ORACLE_HOME>\bin\rman target
<Target_Database_Login> nocatalog
• On UNIX: <ORACLE_HOME>/bin/rman target
<Target_Database_Login> nocatalog
• On OpenVMS:
a. Run ORAUSER.COM using $@OMNI$ROOT:[LOG]LOGIN.COM.
b. Execute $rman target <target_connect_string>
nocatalog.
Target Database Login
The format of the target database login is
<user_name>/<password>@<service>, where:
<user_name> is the name by which a user is known to Oracle Server and to other users. Every user name is associated with a password and both have to be entered to connect to an Oracle target database.
This user must have been granted Oracle SYSDBA or SYSOPER rights.
<password> must be the same as the password specified in the Oracle password file (orapwd), which is used for authentication of users performing database administration.
<service> is the name used to identify an SQL*Net server process for the target database.
Recovery Catalog Login
The format of the Recovery Catalog Database login is
<user_name>/<password>@<service>,
where the description of the user name and password is the same as for the login information to the target database. Note that the Oracle user specified here has to be the owner of the Oracle Recovery Catalog.
<service> is the name used to identify SQL*Net server process for the Recovery Catalog Database.
2. Allocate the Oracle channels.
Allocating a channel tells RMAN to initiate an Oracle Server process for backup, restore, or recovery on the Oracle target database. For example:
allocate channel 'dev_0' type 'disk';
or
allocate channel 'dev_1' type 'sbt_tape';
where you specify the backup directly to disk in the first case and directly to tape in the second case. Note that if Data Protector is linked with Oracle, Data Protector will perform the backup to the tape in the second case.
If you specify more than a single allocate channel command, RMAN will establish multiple logon sessions and conduct multiple backup sets in parallel. This “parallelization” of backup and restore commands is handled internally by RMAN.
IMPORTANT On Windows, a maximum of 32 or 64 (if device is local) channels can be allocated.
To use Data Protector backup media, specify the channel type SBT_TAPE.
3. Specify the parms operand:
parms'ENV(OB2BARTYPE=Oracle8,
OB2APPNAME=<DB_NAME>,OB2BARLIST=<backup_ specification_name>)';
Note that the RMAN script will not work without the above parameters being specified in this form.
4. Specify format:
format '<backup_specification><<DB_NAME>_%s:%t:%p>.dbf' Note that %s:%t:%p and the Oracle database name are required, whereas the backup specification is recommended.
For example, if you have created and saved a backup specification named bspec1 for backing up an Oracle database identified by the Oracle instance called inst1, you would enter the following string:
format 'bspec1<inst1_%s:%t:%p>.dbf'
See the Oracle Recovery Manager User’s Guide and References for information on substitution variables. The Oracle channel format specifies which Oracle backup specification to use for the backup.
5. Optionally, specify backup incremental level.
Note that a Data Protector full backup performs the same operation as an incremental level 0 backup type in the Oracle RMAN scripts.
They both back up all the blocks that have ever been used.
This option is required if you want to use the backup as a base for subsequent incremental backups.
To run a backup using RMAN, start RMAN by running the following command from the <ORACLE_HOME> directory (if you use the recovery catalog):
Oracle 9i/10g:
• On Windows: bin\rman target <Target_Database_Login>
catalog <Recovery_Catalog_Login>
• On UNIX: bin/rman target <Target_Database_Login> catalog
<Recovery_Catalog_Login>
• On OpenVMS:
1. Run ORAUSER.COM using $@OMNI$ROOT:[LOG]LOGIN.COM.
2. Execute $rman target <target_connect_string> catalog
<catalog_connect_string>.
Oracle 8i:
Use rcvcat instead of catalog in the above syntax.
Examples of the RMAN Scripts
Some examples of RMAN scripts that must be executed from the RMAN>
prompt are listed below:
Backing Up a Single Channel
To back up the Oracle instance ORACL, using a backup specification named ora1, enter the following command sequence:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
The RMAN backup script for backing up the database by using three parallel channels for the same backup specification would look like this:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_1' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
If you want to back up the Archived Redo Logs and the tablespace SYSTEM and RONA of the previous database using three parallel channels and a backup specification named ora1, the RMAN script should look like this:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
sql 'alter system archive log current' format 'ora1<ORACL_%s:%f:%p>.dbf'
To back up all Archived Redo Logs from sequence #5 to sequence #105 and delete the Archived Redo Logs after backup of the instance named ora1 is complete, run the following script:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_1' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
backup
(archivelog sequence between 5 and 105 delete input format 'ora1<ORACL_%s:%t:%p>.dbf');
}
If the backup fails, the logs are not deleted.
Backing Up the Flash Recovery Area
If you want to back up the Oracle 10g Flash Recovery Area using three parallel channels and a backup specification named ora1, the RMAN script should look like this:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_1' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
The current control file is automatically backed up when the first datafile of the system tablespace is backed up. The current control file can also be explicitly included in a backup, or backed up individually. To include the current control file after backing up a tablespace named COSTS, run the following script:
run {
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_1' type 'sbt_tape
'parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
The set maxcorrupt command determines the number of corrupted blocks per datafile that can be tolerated by RMAN before a particular backup will fail.
If a backup specification named ora1 backs up the database and allows for up to 10 corrupted blocks per datafile /oracle/data1.dbs (UNIX systems) or C:\oracle\data1.dbs (Windows systems), then the appropriate RMAN script would be:
On UNIX run {
set maxcorrupt for datafile '/oracle/data1.dbs' to 10;
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
backup
incremental level 0
format 'ora1<ORACL_%s:%t>.dbf' database;
} On Windows run {
set maxcorrupt for datafile 'C:\oracle\data1.dbs' to 10;
allocate channel 'dev_0' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_1' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
allocate channel 'dev_2' type 'sbt_tape'
parms'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ORACL,OB2BARLIST=ora1)';
backup
incremental level 0
format 'ora1<ORACL_%s:%t>.dbf' database;
}