Here, some nondefault options using the backup command.
Backup command options
Multisection backups - is the ability to split out backups of large datafiles into multiple sections of fixed size:
backup section size 1g tablespace USERS;
Compression- The default is NULL compression. With this method, oracle does not backup unused data blocks.
Commpression setting inside the rman:
RMAN> show all;
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
Rman in 11g offers several different compression options to choose from:
BASIC, LOW, MEDIUM, HIGH
The BASIC type of compression ifs free for use (without the licence).
you can configure compression in RMAN using:
configure compression algorithm 'BASIC' optimize for load true;
configure compression algorithm 'HIGH';
configure compression algorithm 'LOW';
configure compression algorithm 'MEDIUM';
Example of the offline backup using compression:
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 234356736 bytes
Fixed Size 1344088 bytes
Variable Size 146804136 bytes
Database Buffers 83886080 bytes
Redo Buffers 2322432 bytes
RMAN> backup format='/backup/database/offline_%d_%U.bkp' as compressed backupset database;
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/offline_BTEST_0fn1l081_1_1.bkp tag=TAG20120125T100132 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-00 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
RMAN> alter database open;
database opened
RMAN> exit
[oracle@btest database]$ cd /backup/database/
[oracle@btest database]$ ls -altr
total 1281588
drwxr-xr-x 7 oracle dba 4096 Jan 23 12:59 ..
-rw-r----- 1 oracle oinstall 283254784 Jan 23 13:03 offline_3_BTEST_773326941.bkp
-rw-r----- 1 oracle oinstall 319635456 Jan 23 13:46 offline_5_BTEST_773329559.bkp
-rw-r----- 1 oracle oinstall 320266240 Jan 23 14:11 offline_BTEST_7_773331054.bkp
-rw-r----- 1 oracle oinstall 7766016 Jan 23 14:12 offline_BTEST_8_773331122.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:33 offline_BTEST_13_773332417_0dn1g7e1_1_1.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_2_1.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_3_1.bkp
-rw-r----- 1 oracle oinstall 5832704 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_4_1.bkp
drwxr-xr-x 2 oracle oinstall 4096 Jan 25 10:01 .
-rw-r----- 1 oracle oinstall 59678720 Jan 25 10:02 offline_BTEST_0fn1l081_1_1.bkp
Tags and restore points-
Each backup can be assignet a tag. A tag is a name of no more than 30 characters that is associated with the backup and can be referenced during the restore operation.
Offline backup using the tag:
shutdown immediate;
startup mount;
RMAN> backup format='/backup/database/offline_%d_%U.bkp' tag='offline backup 1' database;
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/offline_BTEST_0hn1l3bj_1_1.bkp tag=OFFLINE BACKUP 1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-01 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
469 Full 279.42M DISK 00:00:51 25-JAN-12
BP Key: 470 Status: AVAILABLE Compressed: NO Tag: OFFLINE BACKUP 1
Piece Name: /backup/database/offline_BTEST_0hn1l3bj_1_1.bkp
List of Datafiles in backup set 469
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 374835 25-JAN-12 /oracle/oradata/system01.dbf
2 Full 374835 25-JAN-12 /oracle/oradata/sysaux01.dbf
3 Full 374835 25-JAN-12 /oracle/oradata/undotbs1.dbf
Restore point-
While tag is associated with a specific backup, a restore point is associated with a specific point-in-time. rman does not provide a command to create a restore point. you can use:
SQL "Create restore point restore_1" in RMAN or create restore point restore_1 in sqlplus.
Limiting backup impacts-
You can set the limit for duration of the backup with the:
backup duration 00:30 database; command If tha backup will take more than 30 minutes, it will be automatically canceled.
when defining the duration, you can indicate RMAN should try to minimize either of the following:
- the time that the backup takes to run
- the I/O load that the backup consumes
If you try to minimize time, the backup will runn full speed.
here the commands:
backup duration 00:30 minimize time database;
backup duration 00:30 minimize load database;
You can also use aprtial parameter with the duration parameter. If you use it, RMAN will not treat it as failed after running out of the time. The remaining commands in the run block will continue to be executed.
Limiting the size of backupset:
You can use maxsetsize parameter to limit the size of the backup set.
backup database maxsetsize=50M tag='offline backup test' format='/backup/database/offline_%d_%U.bkp';
If you use this option, at it will be smaller as your datafile, it will lead to an error:
RMAN> backup database maxsetsize=50M tag='offline backup test' format='/backup/database/offline_%d_%U.bkp';
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 01/25/2012 11:18:57
RMAN-06183: datafile or datafile copy /oracle/oradata/system01.dbf (file number 1) larger than MAXSETSIZE
Backing up to a specific device type-
You can use device type parameter to change the device type:
backup database device type disk;
backup database device type sbt;
Mofifying the retention policy for a backup set.
You can make an "archival backup" using the kepp statement.
there are 2 options
- keep forever - you have to use the recovery catalog
- keep until time - you can use the controlfile
Archival backups cannot be hold in the FRA.
Here the example of the keep forever backup (archived logs will be backed up automatically):
RMAN> backup format='/backup/database/online_forever_%d_%U.bkp' tag='keep_forever' keep forever database;
Starting backup at 25-JAN-12
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0mn1leu4_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:07
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0nn1lf0a_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=8 STAMP=773504013
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0on1lf0j_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0pn1lf0p_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
575 Full 280.16M DISK 00:00:58 25-JAN-12
BP Key: 576 Status: AVAILABLE Compressed: NO Tag: KEEP_FOREVER
Piece Name: /backup/database/online_forever_BTEST_0mn1leu4_1_1.bkp
Keep: BACKUP_LOGS Until: FOREVER
List of Datafiles in backup set 575
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 375751 25-JAN-12 /oracle/oradata/system01.dbf
2 Full 375751 25-JAN-12 /oracle/oradata/sysaux01.dbf
3 Full 375751 25-JAN-12 /oracle/oradata/undotbs1.dbf
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
628 3.00K DISK 00:00:00 25-JAN-12
BP Key: 630 Status: AVAILABLE Compressed: NO Tag: KEEP_FOREVER
Piece Name: /backup/database/online_forever_BTEST_0on1lf0j_1_1.bkp
Keep: BACKUP_LOGS Until: FOREVER
List of Archived Logs in backup set 628
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 21 375727 25-JAN-12 375788 25-JAN-12
Overriding the configure exclude command:
yo can configure RMAN to exclude specific datafiles that have not changed since the last backup.
RMAN> configure exclude for tablespace USERS;
Tablespace USERS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN> report schema;
Report of database schema for database with db_unique_name BTEST
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 500 SYSTEM YES /oracle/oradata/system01.dbf
2 500 SYSAUX NO /oracle/oradata/sysaux01.dbf
3 200 UNDOTBS1 YES /oracle/oradata/undotbs1.dbf
4 100 USERS NO /oracle/oradata/users01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 100 TEMP 100 /oracle/oradata/temp01.dbf
RMAN> backup format='/backup/database/online_%d_%U.bkp' tag='forever1' keep forever database;
Starting backup at 25-JAN-12
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
file 4 is excluded from whole database backup
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0qn1lgna_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0rn1lgp6_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=23 RECID=10 STAMP=773505832
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0sn1lgpc_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0tn1lgpg_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-JAN-12
As you can see, the file 4 was excluded from the backup.
Now, I will use the noexclude clause:
RMAN> backup format='/backup/database/online_%d_%U.bkp' noexclude database;
Starting backup at 25-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_12n1lh75_1_1.bkp tag=TAG20120125T145115 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-04 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
Checking the database for errors:
you can check the database for logical and physical errors using the backup command:
RMAN> backup validate check logical database;
Starting backup at 25-JAN-12
using channel ORA_DISK_1
file 4 is excluded from whole database backup
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1 OK 0 41975 64000 377204
File Name: /oracle/oradata/system01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 14369
Index 0 4659
Other 0 2997
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2 OK 0 52912 64000 377424
File Name: /oracle/oradata/sysaux01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 3826
Index 0 3020
Other 0 4242
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3 OK 0 1 25600 377424
File Name: /oracle/oradata/undotbs1.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 0
Other 0 25599
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE OK 0 2
Control File OK 0 470
Finished backup at 25-JAN-12
RMAN> configure exclude for tablespace users clear;
Tablespace USERS will be included in future whole database backups
old RMAN configuration parameters are successfully deleted
starting full resync of recovery catalog
full resync complete
Skipping online,offline, read only and inaccessible datafiles:
backup database skip readonly;
backup database skip offline;
backup database skip inaccessible;
backup database skip readonly skip offline skip inaccessible;
Multisection backups - is the ability to split out backups of large datafiles into multiple sections of fixed size:
backup section size 1g tablespace USERS;
Compression- The default is NULL compression. With this method, oracle does not backup unused data blocks.
Commpression setting inside the rman:
RMAN> show all;
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
Rman in 11g offers several different compression options to choose from:
BASIC, LOW, MEDIUM, HIGH
The BASIC type of compression ifs free for use (without the licence).
you can configure compression in RMAN using:
configure compression algorithm 'BASIC' optimize for load true;
configure compression algorithm 'HIGH';
configure compression algorithm 'LOW';
configure compression algorithm 'MEDIUM';
Example of the offline backup using compression:
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 234356736 bytes
Fixed Size 1344088 bytes
Variable Size 146804136 bytes
Database Buffers 83886080 bytes
Redo Buffers 2322432 bytes
RMAN> backup format='/backup/database/offline_%d_%U.bkp' as compressed backupset database;
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/offline_BTEST_0fn1l081_1_1.bkp tag=TAG20120125T100132 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-00 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
RMAN> alter database open;
database opened
RMAN> exit
[oracle@btest database]$ cd /backup/database/
[oracle@btest database]$ ls -altr
total 1281588
drwxr-xr-x 7 oracle dba 4096 Jan 23 12:59 ..
-rw-r----- 1 oracle oinstall 283254784 Jan 23 13:03 offline_3_BTEST_773326941.bkp
-rw-r----- 1 oracle oinstall 319635456 Jan 23 13:46 offline_5_BTEST_773329559.bkp
-rw-r----- 1 oracle oinstall 320266240 Jan 23 14:11 offline_BTEST_7_773331054.bkp
-rw-r----- 1 oracle oinstall 7766016 Jan 23 14:12 offline_BTEST_8_773331122.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:33 offline_BTEST_13_773332417_0dn1g7e1_1_1.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_2_1.bkp
-rw-r----- 1 oracle oinstall 104857600 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_3_1.bkp
-rw-r----- 1 oracle oinstall 5832704 Jan 23 14:34 offline_BTEST_13_773332417_0dn1g7e1_4_1.bkp
drwxr-xr-x 2 oracle oinstall 4096 Jan 25 10:01 .
-rw-r----- 1 oracle oinstall 59678720 Jan 25 10:02 offline_BTEST_0fn1l081_1_1.bkp
Tags and restore points-
Each backup can be assignet a tag. A tag is a name of no more than 30 characters that is associated with the backup and can be referenced during the restore operation.
Offline backup using the tag:
shutdown immediate;
startup mount;
RMAN> backup format='/backup/database/offline_%d_%U.bkp' tag='offline backup 1' database;
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/offline_BTEST_0hn1l3bj_1_1.bkp tag=OFFLINE BACKUP 1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-01 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
469 Full 279.42M DISK 00:00:51 25-JAN-12
BP Key: 470 Status: AVAILABLE Compressed: NO Tag: OFFLINE BACKUP 1
Piece Name: /backup/database/offline_BTEST_0hn1l3bj_1_1.bkp
List of Datafiles in backup set 469
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 374835 25-JAN-12 /oracle/oradata/system01.dbf
2 Full 374835 25-JAN-12 /oracle/oradata/sysaux01.dbf
3 Full 374835 25-JAN-12 /oracle/oradata/undotbs1.dbf
Restore point-
While tag is associated with a specific backup, a restore point is associated with a specific point-in-time. rman does not provide a command to create a restore point. you can use:
SQL "Create restore point restore_1" in RMAN or create restore point restore_1 in sqlplus.
Limiting backup impacts-
You can set the limit for duration of the backup with the:
backup duration 00:30 database; command If tha backup will take more than 30 minutes, it will be automatically canceled.
when defining the duration, you can indicate RMAN should try to minimize either of the following:
- the time that the backup takes to run
- the I/O load that the backup consumes
If you try to minimize time, the backup will runn full speed.
here the commands:
backup duration 00:30 minimize time database;
backup duration 00:30 minimize load database;
You can also use aprtial parameter with the duration parameter. If you use it, RMAN will not treat it as failed after running out of the time. The remaining commands in the run block will continue to be executed.
Limiting the size of backupset:
You can use maxsetsize parameter to limit the size of the backup set.
backup database maxsetsize=50M tag='offline backup test' format='/backup/database/offline_%d_%U.bkp';
If you use this option, at it will be smaller as your datafile, it will lead to an error:
RMAN> backup database maxsetsize=50M tag='offline backup test' format='/backup/database/offline_%d_%U.bkp';
Starting backup at 25-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 01/25/2012 11:18:57
RMAN-06183: datafile or datafile copy /oracle/oradata/system01.dbf (file number 1) larger than MAXSETSIZE
Backing up to a specific device type-
You can use device type parameter to change the device type:
backup database device type disk;
backup database device type sbt;
Mofifying the retention policy for a backup set.
You can make an "archival backup" using the kepp statement.
there are 2 options
- keep forever - you have to use the recovery catalog
- keep until time - you can use the controlfile
Archival backups cannot be hold in the FRA.
Here the example of the keep forever backup (archived logs will be backed up automatically):
RMAN> backup format='/backup/database/online_forever_%d_%U.bkp' tag='keep_forever' keep forever database;
Starting backup at 25-JAN-12
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0mn1leu4_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:07
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0nn1lf0a_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=8 STAMP=773504013
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0on1lf0j_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_forever_BTEST_0pn1lf0p_1_1.bkp tag=KEEP_FOREVER comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-JAN-12
RMAN> list backup of database;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
575 Full 280.16M DISK 00:00:58 25-JAN-12
BP Key: 576 Status: AVAILABLE Compressed: NO Tag: KEEP_FOREVER
Piece Name: /backup/database/online_forever_BTEST_0mn1leu4_1_1.bkp
Keep: BACKUP_LOGS Until: FOREVER
List of Datafiles in backup set 575
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 375751 25-JAN-12 /oracle/oradata/system01.dbf
2 Full 375751 25-JAN-12 /oracle/oradata/sysaux01.dbf
3 Full 375751 25-JAN-12 /oracle/oradata/undotbs1.dbf
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
628 3.00K DISK 00:00:00 25-JAN-12
BP Key: 630 Status: AVAILABLE Compressed: NO Tag: KEEP_FOREVER
Piece Name: /backup/database/online_forever_BTEST_0on1lf0j_1_1.bkp
Keep: BACKUP_LOGS Until: FOREVER
List of Archived Logs in backup set 628
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 21 375727 25-JAN-12 375788 25-JAN-12
Overriding the configure exclude command:
yo can configure RMAN to exclude specific datafiles that have not changed since the last backup.
RMAN> configure exclude for tablespace USERS;
Tablespace USERS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete
RMAN> report schema;
Report of database schema for database with db_unique_name BTEST
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 500 SYSTEM YES /oracle/oradata/system01.dbf
2 500 SYSAUX NO /oracle/oradata/sysaux01.dbf
3 200 UNDOTBS1 YES /oracle/oradata/undotbs1.dbf
4 100 USERS NO /oracle/oradata/users01.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 100 TEMP 100 /oracle/oradata/temp01.dbf
RMAN> backup format='/backup/database/online_%d_%U.bkp' tag='forever1' keep forever database;
Starting backup at 25-JAN-12
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
file 4 is excluded from whole database backup
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0qn1lgna_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0rn1lgp6_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=23 RECID=10 STAMP=773505832
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0sn1lgpc_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_0tn1lgpg_1_1.bkp tag=FOREVER1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-JAN-12
As you can see, the file 4 was excluded from the backup.
Now, I will use the noexclude clause:
RMAN> backup format='/backup/database/online_%d_%U.bkp' noexclude database;
Starting backup at 25-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
input datafile file number=00004 name=/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-JAN-12
channel ORA_DISK_1: finished piece 1 at 25-JAN-12
piece handle=/backup/database/online_BTEST_12n1lh75_1_1.bkp tag=TAG20120125T145115 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
Finished backup at 25-JAN-12
Starting Control File and SPFILE Autobackup at 25-JAN-12
piece handle=/backup/controlfile/c-4236471253-20120125-04 comment=NONE
Finished Control File and SPFILE Autobackup at 25-JAN-12
Checking the database for errors:
you can check the database for logical and physical errors using the backup command:
RMAN> backup validate check logical database;
Starting backup at 25-JAN-12
using channel ORA_DISK_1
file 4 is excluded from whole database backup
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/oradata/system01.dbf
input datafile file number=00002 name=/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/oracle/oradata/undotbs1.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1 OK 0 41975 64000 377204
File Name: /oracle/oradata/system01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 14369
Index 0 4659
Other 0 2997
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
2 OK 0 52912 64000 377424
File Name: /oracle/oradata/sysaux01.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 3826
Index 0 3020
Other 0 4242
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3 OK 0 1 25600 377424
File Name: /oracle/oradata/undotbs1.dbf
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 0
Index 0 0
Other 0 25599
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE OK 0 2
Control File OK 0 470
Finished backup at 25-JAN-12
RMAN> configure exclude for tablespace users clear;
Tablespace USERS will be included in future whole database backups
old RMAN configuration parameters are successfully deleted
starting full resync of recovery catalog
full resync complete
Skipping online,offline, read only and inaccessible datafiles:
backup database skip readonly;
backup database skip offline;
backup database skip inaccessible;
backup database skip readonly skip offline skip inaccessible;