Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

How to backup Individual Database files like Tablespace, Datafiles, Archivelogs, Spfile, Controlfile by using RMAN

Posted by Mir Sayeed Hassan on July 20th, 2020

How to backup Individual Database files like Tablespace, Datafiles, Archivelogs, Spfile, Controlfile by using RMAN

BACKUP OF ALL ARCHIVELOG

RMAN> backup archivelog all;

Starting backup at 20-JUL-20
current log archived
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=661 RECID=152 STAMP=1045769053
input archived log thread=1 sequence=662 RECID=153 STAMP=1045769372
input archived log thread=1 sequence=663 RECID=154 STAMP=1045774162
input archived log thread=1 sequence=664 RECID=155 STAMP=1045775182
input archived log thread=1 sequence=665 RECID=156 STAMP=1045775225
input archived log thread=1 sequence=666 RECID=157 STAMP=1045776347
input archived log thread=1 sequence=667 RECID=158 STAMP=1045780583
input archived log thread=1 sequence=668 RECID=159 STAMP=1045813217
input archived log thread=1 sequence=669 RECID=160 STAMP=1045864812
input archived log thread=1 sequence=670 RECID=161 STAMP=1045888610
input archived log thread=1 sequence=671 RECID=162 STAMP=1045928326
input archived log thread=1 sequence=672 RECID=163 STAMP=1045956955
input archived log thread=1 sequence=673 RECID=164 STAMP=1045978906
input archived log thread=1 sequence=674 RECID=165 STAMP=1046037616
input archived log thread=1 sequence=675 RECID=166 STAMP=1046061454
input archived log thread=1 sequence=676 RECID=167 STAMP=1046082608
input archived log thread=1 sequence=677 RECID=168 STAMP=1046129744
input archived log thread=1 sequence=678 RECID=169 STAMP=1046152802
input archived log thread=1 sequence=679 RECID=170 STAMP=1046182247
input archived log thread=1 sequence=680 RECID=171 STAMP=1046223039
input archived log thread=1 sequence=681 RECID=172 STAMP=1046244945
input archived log thread=1 sequence=682 RECID=173 STAMP=1046276312
input archived log thread=1 sequence=683 RECID=174 STAMP=1046277969
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_annnn_TAG20200720T164609_hkc2r99b_.bkp tag=TAG20200720T164609 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 20-JUL-20

BACKUP OF ARCHIVELOG WITH SPECIFIC TIME

RMAN> backup archivelog from time 'sysdate-2';

Starting backup at 20-JUL-20
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK
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=677 RECID=168 STAMP=1046129744
input archived log thread=1 sequence=678 RECID=169 STAMP=1046152802
input archived log thread=1 sequence=679 RECID=170 STAMP=1046182247
input archived log thread=1 sequence=680 RECID=171 STAMP=1046223039
input archived log thread=1 sequence=681 RECID=172 STAMP=1046244945
input archived log thread=1 sequence=682 RECID=173 STAMP=1046276312
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_annnn_TAG20200720T161833_hkc14l29_.bkp tag=TAG20200720T161833 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP OF SINGLE TABLESPACE

RMAN> backup tablespace system;

Starting backup at 20-JUL-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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T164822_hkc2wh1n_.bkp tag=TAG20200720T164822 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T164822_hkc2wz7j_.bkp tag=TAG20200720T164822 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP OF MULTIPLE TABLESPACE

RMAN> backup tablespace system, users;

Starting backup at 20-JUL-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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_users_gy9w2ssf_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T165023_hkc307t2_.bkp tag=TAG20200720T165023 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T165023_hkc30qyg_.bkp tag=TAG20200720T165023 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP OF SINGLE DATAFILE

RMAN> backup datafile 1;

Starting backup at 20-JUL-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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T165209_hkc33k8z_.bkp tag=TAG20200720T165209 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T165209_hkc33oft_.bkp tag=TAG20200720T165209 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP OF MULTIPLE DATAFILE

RMAN> backup datafile 1,4;

Starting backup at 20-JUL-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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_users_gy9w2ssf_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T165220_hkc33wp5_.bkp tag=TAG20200720T165220 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T165220_hkc340v2_.bkp tag=TAG20200720T165220 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP OF BACKUPSET DATAFILE

Note: To perform the backup as backup set, first need to get the location of the database as shown below

SQL> select name from V$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_sysaux_gy9w2sr1_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_undotbs1_gy9w2sr8_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_users_gy9w2ssf_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_example_gy9w53b0_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_shrink_t_gy9x9y75_.dbf
/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_test_hjvd5hw1_.dbf

Now issue the RMAN command for backup as backupset datafile

RMAN> backup as backupset datafile '/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf';

Starting backup at 20-JUL-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=315 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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T165401_hkc3720o_.bkp tag=TAG20200720T165401 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T165401_hkc3765v_.bkp tag=TAG20200720T165401 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20
RMAN> backup as backupset datafile '/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf','/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_undotbs1_gy9w2sr8_.dbf';

Starting backup at 20-JUL-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/TESTDB123/datafile/o1_mf_system_gy9w2sps_.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/TESTDB123/datafile/o1_mf_undotbs1_gy9w2sr8_.dbf
channel ORA_DISK_1: starting piece 1 at 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnndf_TAG20200720T165434_hkc38353_.bkp tag=TAG20200720T165434 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncsnf_TAG20200720T165434_hkc387b1_.bkp tag=TAG20200720T165434 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP SPFILE

RMAN> backup spfile;

Starting backup at 20-JUL-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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_nnsnf_TAG20200720T165646_hkc3d6kp_.bkp tag=TAG20200720T165646 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

BACKUP CURRENT CONTROLFILE

RMAN> backup current controlfile;

Starting backup at 20-JUL-20
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=6 device type=DISK
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 20-JUL-20
channel ORA_DISK_1: finished piece 1 at 20-JUL-20
piece handle=/u01/app/oracle/fast_recovery_area/TESTDB123/backupset/2020_07_20/o1_mf_ncnnf_TAG20200720T181729_hkc83l66_.bkp tag=TAG20200720T181729 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-JUL-20

 

====Hence tested & verified in our test env=====