In this Blog you can learn database, networking and cloud skills that will help you to understand Oracle Database and Non Oracle Database with extra key skill

RMAN backup of oracle database in difference location

No comments :
Taking RMAN backup of Oracle database in difference location

1- start database in mount stage : startup mount 
2- connect to rman : rman target / 
3- Run the following command in RMAN> Prompt: 
run {
allocate channel d1 type disk;
backup
format '/u03/backup/%d_DATA_%T_SET_%s'
database plus archivelog;
release channel d1;
}


[oracle@dgprim2 backup]$ pwd
/u03/backup
[oracle@dgprim2 backup]$ ls -lrt
total 1240404
-rw-r----- 1 oracle dba 1270169600 Dec 31 10:42 01tm55na_1_1


log :

RMAN> run {
allocate channel d1 type disk;
backup
format '/u03/backup/%U'
database plus archivelog;
release channel d1;
}2> 3> 4> 5> 6> 7>

using target database control file instead of recovery catalog
allocated channel: d1
channel d1: SID=21 device type=DISK


Starting backup at 31-DEC-18
specification does not match any archived log in the repository
backup cancelled because there are no files to backup
Finished backup at 31-DEC-18

Starting backup at 31-DEC-18
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u03/oracle/oradata/dg731211/example01.dbf
input datafile file number=00001 name=/u03/oracle/oradata/dg731211/system01.dbf
input datafile file number=00003 name=/u03/oracle/oradata/dg731211/sysaux01.dbf
input datafile file number=00004 name=/u03/oracle/oradata/dg731211/undotbs01.dbf
input datafile file number=00006 name=/u03/oracle/oradata/dg731211/users01.dbf
channel d1: starting piece 1 at 31-DEC-18
channel d1: finished piece 1 at 31-DEC-18
piece handle=/u03/backup/01tm55na_1_1 tag=TAG20181231T104146 comment=NONE
channel d1: backup set complete, elapsed time: 00:01:06
Finished backup at 31-DEC-18

Starting backup at 31-DEC-18
specification does not match any archived log in the repository
backup cancelled because there are no files to backup
Finished backup at 31-DEC-18

Starting Control File and SPFILE Autobackup at 31-DEC-18
piece handle=/u04/oracle/fast_recovery_area/DG731211/autobackup/2018_12_31/o1_mf_s_996315937_g2m9bnmd_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 31-DEC-18

released channel: d1

RMAN> exit

To check the backup : list backup

RMAN> list backup
2> ;

using target database control file instead of recovery catalog

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.18G      DISK        00:00:57     31-DEC-18
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20181231T104146
        Piece Name: /u03/backup/01tm55na_1_1
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1736908    31-DEC-18 /u03/oracle/oradata/dg731211/system01.dbf
  3       Full 1736908    31-DEC-18 /u03/oracle/oradata/dg731211/sysaux01.dbf
  4       Full 1736908    31-DEC-18 /u03/oracle/oradata/dg731211/undotbs01.dbf
  5       Full 1736908    31-DEC-18 /u03/oracle/oradata/dg731211/example01.dbf
  6       Full 1736908    31-DEC-18 /u03/oracle/oradata/dg731211/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.64M      DISK        00:00:00     31-DEC-18
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20181231T104252
        Piece Name: /u04/oracle/fast_recovery_area/DG731211/autobackup/2018_12_31/o1_mf_s_996315937_g2m9bnmd_.bkp
  SPFILE Included: Modification time: 31-DEC-18
  SPFILE db_unique_name: DG731211
  Control File Included: Ckp SCN: 1736908      Ckp time: 31-DEC-18


Taking Control file Backup Only in desired location

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/backup/%F';

run {
allocate channel d1 type disk;
backup current controlfile 
format '/u03/backup/ControlFile_%T';
release channel d1;
}


Clear information of deleted physical backup from list backup entires in RMAN

RMAN> list backup;

List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1       1.84M      DISK        00:00:00     07-JAN-19
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T152839
        Piece Name: /tmp/testbackup/03tmo557_1_1

  List of Archived Logs in backup set 1
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    4       1008158    20-DEC-18 1030945    20-DEC-18

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    933.70M    DISK        00:00:21     07-JAN-19
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T152840
        Piece Name: /tmp/testbackup/04tmo558_1_1

  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/system01.dbf
  2       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/sysaux01.dbf
  3       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/undotbs01.dbf
  4       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    9.36M      DISK        00:00:02     07-JAN-19
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T152840
        Piece Name: /tmp/testbackup/05tmo561_1_1
  SPFILE Included: Modification time: 07-JAN-19
  SPFILE db_unique_name: DG731122
  Control File Included: Ckp SCN: 1035455      Ckp time: 21-DEC-18

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
4       1.84M      DISK        00:00:01     07-JAN-19
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T155732
        Piece Name: /tmp/testbackup/06tmo6rc_1_1

  List of Archived Logs in backup set 4
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    4       1008158    20-DEC-18 1030945    20-DEC-18

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    933.70M    DISK        00:00:08     07-JAN-19
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T155734
        Piece Name: /tmp/testbackup/07tmo6re_1_1
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----

  1       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/system01.dbf
  2       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/sysaux01.dbf
  3       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/undotbs01.dbf
  4       Full 1035022    21-DEC-18 /u03/oracle/oradata/dg731122/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    9.36M      DISK        00:00:01     07-JAN-19
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20190107T155734
        Piece Name: /tmp/testbackup/08tmo6rt_1_1
  SPFILE Included: Modification time: 07-JAN-19
  SPFILE db_unique_name: DG731122
  Control File Included: Ckp SCN: 1035455      Ckp time: 21-DEC-18

RMAN> crosscheck backup;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/03tmo557_1_1 RECID=1 STAMP=996938919
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/04tmo558_1_1 RECID=2 STAMP=996938920
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/05tmo561_1_1 RECID=3 STAMP=996938946
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/06tmo6rc_1_1 RECID=4 STAMP=996940653
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/07tmo6re_1_1 RECID=5 STAMP=996940654
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/tmp/testbackup/08tmo6rt_1_1 RECID=6 STAMP=996940670
Crosschecked 6 objects

RMAN> delete expired backup;

using channel ORA_DISK_1
List of Backup Pieces

BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   EXPIRED     DISK        /tmp/testbackup/03tmo557_1_1
2       2       1   1   EXPIRED     DISK        /tmp/testbackup/04tmo558_1_1
3       3       1   1   EXPIRED     DISK        /tmp/testbackup/05tmo561_1_1
4       4       1   1   EXPIRED     DISK        /tmp/testbackup/06tmo6rc_1_1
5       5       1   1   EXPIRED     DISK        /tmp/testbackup/07tmo6re_1_1
6       6       1   1   EXPIRED     DISK        /tmp/testbackup/08tmo6rt_1_1

Do you really want to delete the above objects (enter YES or NO)? YES

deleted backup piece
backup piece handle=/tmp/testbackup/03tmo557_1_1 RECID=1 STAMP=996938919
deleted backup piece
backup piece handle=/tmp/testbackup/04tmo558_1_1 RECID=2 STAMP=996938920
deleted backup piece
backup piece handle=/tmp/testbackup/05tmo561_1_1 RECID=3 STAMP=996938946
deleted backup piece
backup piece handle=/tmp/testbackup/06tmo6rc_1_1 RECID=4 STAMP=996940653
deleted backup piece
backup piece handle=/tmp/testbackup/07tmo6re_1_1 RECID=5 STAMP=996940654
deleted backup piece
backup piece handle=/tmp/testbackup/08tmo6rt_1_1 RECID=6 STAMP=996940670
Deleted 6 EXPIRED objects

RMAN> list backup;

specification does not match any backup in the repository

No comments :

Post a Comment