RMAN
[oracle@ranesh
~]$ rman target /
Recovery
Manager: Release 12.1.0.2.0 - Production on Thu Sep 17 20:00:45 2020
Copyright
(c) 1982, 2014, Oracle and/or its affiliates.
All rights reserved.
connected
to target database: PRIME (DBID=2122042046)
RMAN> show all;
using
target database control file instead of recovery catalog
RMAN
configuration parameters for database with db_unique_name STAND are:
CONFIGURE
RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE
BACKUP OPTIMIZATION OFF; # default
CONFIGURE
DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE
CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE
DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE
DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE
ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE
MAXSETSIZE TO UNLIMITED; # default
CONFIGURE
ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE
ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE
COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ;
# default
CONFIGURE
RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE
ARCHIVELOG DELETION POLICY TO NONE; # default
To perforn a full database
backup use:
RMAN>
backup database;
Starting
backup at 17-SEP-20
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=37 device type=DISK
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=/u01/app/oracle/oradata/stand/system01.dbf
input
datafile file number=00003 name=/u01/app/oracle/oradata/stand/sysaux01.dbf
input
datafile file number=00004 name=/u01/app/oracle/oradata/stand/undotbs01.dbf
input
datafile file number=00006 name=/u01/app/oracle/oradata/stand/users01.dbf
channel
ORA_DISK_1: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_nnndf_TAG20200917T200915_hp6x8mmp_.bkp
tag=TAG20200917T200915 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:56
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: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncsnf_TAG20200917T200915_hp6xbddz_.bkp
tag=TAG20200917T200915 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
To backup all archive logs
use:
RMAN> BACKUP ARCHIVELOG ALL;
Starting backup at 17-SEP-20
using channel ORA_DISK_1
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=77 RECID=1 STAMP=1044910854
input archived log thread=1 sequence=78 RECID=2 STAMP=1044911049
input archived log thread=1 sequence=79 RECID=3 STAMP=1044911087
input archived log thread=1 sequence=80 RECID=4 STAMP=1044911458
input archived log thread=1 sequence=81 RECID=5 STAMP=1044911462
input archived log thread=1 sequence=82 RECID=6 STAMP=1044911473
input archived log thread=1 sequence=83 RECID=9 STAMP=1044911706
input archived log thread=1 sequence=84 RECID=11 STAMP=1044913561
channel ORA_DISK_1: starting piece 1 at 17-SEP-20
channel ORA_DISK_1: finished piece 1 at 17-SEP-20
piece handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_annnn_TAG20200917T201607_hp6xoho7_.bkp
tag=TAG20200917T201607 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
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=1 RECID=12 STAMP=1044913749
input archived log thread=1 sequence=2 RECID=13 STAMP=1044914249
input archived log thread=1 sequence=3 RECID=14 STAMP=1044914459
input archived log thread=1 sequence=4 RECID=15 STAMP=1044914492
input archived log thread=1 sequence=5 RECID=16 STAMP=1044914513
input archived log thread=1 sequence=6 RECID=17 STAMP=1044915866
input archived log thread=1 sequence=7 RECID=18 STAMP=1044915890
input archived log thread=1 sequence=8 RECID=19 STAMP=1044916659
channel ORA_DISK_1: starting piece 1 at 17-SEP-20
channel ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_annnn_TAG20200917T201607_hp6xok21_.bkp
tag=TAG20200917T201607 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
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=1 RECID=20 STAMP=1044917218
input archived log thread=1 sequence=2 RECID=23 STAMP=1044917219
input archived log thread=1 sequence=3 RECID=26 STAMP=1044917224
input archived log thread=1 sequence=4 RECID=28 STAMP=1044917226
input archived log thread=1 sequence=5 RECID=30 STAMP=1044917228
channel ORA_DISK_1: starting piece 1 at 17-SEP-20
channel ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_annnn_TAG20200917T201607_hp6xol7l_.bkp
tag=TAG20200917T201607 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-SEP-20
To backup the database and all archive log files use:
RMAN>
BACKUP DATABASE PLUS ARCHIVELOG;
To backup the current controlfile :
RMAN> BACKUP CURRENT CONTROLFILE;
Starting
backup at 17-SEP-20
using
channel ORA_DISK_1
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 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncnnf_TAG20200917T202643_hp6y9dkk_.bkp
tag=TAG20200917T202643 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
SPFILE BACKUP
RMAN> BACKUP SPFILE;
Starting
backup at 17-SEP-20
using
channel ORA_DISK_1
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 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_nnsnf_TAG20200917T202821_hp6ydf9r_.bkp
tag=TAG20200917T202821 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
Datafile backups
RMAN>
backup datafile '/u01/app/oracle/oradata/stand/system01.dbf';
Starting
backup at 17-SEP-20
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=/u01/app/oracle/oradata/stand/system01.dbf
channel
ORA_DISK_1: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_nnndf_TAG20200917T202950_hp6yh6pv_.bkp
tag=TAG20200917T202950 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:26
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: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncsnf_TAG20200917T202950_hp6yj19f_.bkp
tag=TAG20200917T202950 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
Alternatively specify datafile
no
RMAN>
backup datafile 1;
The data file number can be obtained from V$DATAFILE
RMAN>
SELECT file#, name FROM v$datafile;
FILE#
NAME
--------------------------------------------------------------------------------
1
/u01/app/oracle/oradata/stand/system01.dbf
3
/u01/app/oracle/oradata/stand/sysaux01.dbf
4 /u01/app/oracle/oradata/stand/undotbs01.dbf
6
/u01/app/oracle/oradata/stand/users01.dbf
......when the RMAN backup is running, if you
want to see the proress, you can query the V$RMAN_STATUS
output
RMAN>
SELECT OPERATION, STATUS, MBYTES_PROCESSED, START_TIME, END_TIME from
V$RMAN_STATUS;
OPERATION STATUS MBYTES_PROCESSED
---------------------------------
----------------------- ----------------
START_TIM
END_TIME
---------
---------
RMAN RUNNING 0
17-SEP-20
17-SEP-20
DUPLICATE
DB FROM ACTIVE USING B FAILED 0
03-JUL-20
03-JUL-20
RMAN COMPLETED WITH
ERRORS 0
03-JUL-20
03-JUL-20
RMAN COMPLETED 0
Incremental Backups
By default backups are
full (level 0). Backups can also be incremental (level 1).
Incremental backups can
be:
Differential - includes
all changes since the last full or incremental backup
Cumulative - includes
all changes since the last full backup
Differential backups
require less space. Cumulative backups are faster to restore
RMAN> BACKUP INCREMENTAL LEVEL 1
DATABASE;
Starting
backup at 17-SEP-20
using
target database control file instead of recovery catalog
allocated
channel: ORA_DISK_1
channel
ORA_DISK_1: SID=39 device type=DISK
channel
ORA_DISK_1: starting incremental level 0 datafile backup set
channel
ORA_DISK_1: specifying datafile(s) in backup set
input
datafile file number=00001 name=/u01/app/oracle/oradata/stand/system01.dbf
input
datafile file number=00003 name=/u01/app/oracle/oradata/stand/sysaux01.dbf
input
datafile file number=00004 name=/u01/app/oracle/oradata/stand/undotbs01.dbf
input
datafile file number=00006 name=/u01/app/oracle/oradata/stand/users01.dbf
channel
ORA_DISK_1: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_nnnd0_TAG20200917T204810_hp6zkm6v_.bkp
tag=TAG20200917T204810 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel
ORA_DISK_1: starting incremental level 1 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: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncsn1_TAG20200917T204810_hp6zmcvs_.bkp
tag=TAG20200917T204810 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
RMAN> BACKUP INCREMENTAL LEVEL 1
CUMULATIVE DATABASE;
Starting
backup at 17-SEP-20
using
channel ORA_DISK_1
channel
ORA_DISK_1: starting incremental level 1 datafile backup set
channel
ORA_DISK_1: specifying datafile(s) in backup set
input
datafile file number=00001 name=/u01/app/oracle/oradata/stand/system01.dbf
skipping
datafile 00001 because it has not changed
input
datafile file number=00003 name=/u01/app/oracle/oradata/stand/sysaux01.dbf
skipping
datafile 00003 because it has not changed
input
datafile file number=00004 name=/u01/app/oracle/oradata/stand/undotbs01.dbf
skipping
datafile 00004 because it has not changed
input
datafile file number=00006 name=/u01/app/oracle/oradata/stand/users01.dbf
skipping
datafile 00006 because it has not changed
channel
ORA_DISK_1: backup cancelled because all files were skipped
channel
ORA_DISK_1: starting incremental level 1 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: starting piece 1 at 17-SEP-20
channel
ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncsn1_TAG20200917T204949_hp6znpyt_.bkp
tag=TAG20200917T204949 comment=NONE
channel
ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished
backup at 17-SEP-20
Note that
in order to take a level 1 backup, a level 0 backup must already exist.
A full
backup using BACKUP DATABASE is not the same as a level 0 backup. - the LV
column of the LIST BACKUP output is NULL after a full backup.
level
0 backup
RMAN> BACKUP
INCREMENTAL LEVEL 0 DATABASE;
Starting backup at 17-SEP-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile
backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001
name=/u01/app/oracle/oradata/stand/system01.dbf
input datafile file number=00003
name=/u01/app/oracle/oradata/stand/sysaux01.dbf
input datafile file number=00004
name=/u01/app/oracle/oradata/stand/undotbs01.dbf
input datafile file number=00006
name=/u01/app/oracle/oradata/stand/users01.dbf
channel ORA_DISK_1: starting piece 1 at 17-SEP-20
channel ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_nnnd0_TAG20200917T205106_hp6zq2vb_.bkp
tag=TAG20200917T205106 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:55
channel ORA_DISK_1: starting incremental level 0 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: starting piece 1 at 17-SEP-20
channel ORA_DISK_1: finished piece 1 at 17-SEP-20
piece
handle=/u01/app/oracle/fast_recovery_area/STAND/backupset/2020_09_17/o1_mf_ncsn0_TAG20200917T205106_hp6zrv2p_.bkp
tag=TAG20200917T205106 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:00:01
Finished backup at 17-SEP-20