Archive log files plays major role when it comes to recovery in database.
Let us see how to take backup of Archive log files.
Step 1: Connect to RMAN
[code] [oracle@orcl19c admin]$ rman target sys/oracle@ORCL1 catalog RCATOWN/oracle@RCAT Recovery Manager: Release 19.0.0.0.0 - Production on Sun Apr 19 18:48:44 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL1 (DBID=1414679838) connected to recovery catalog database RMAN> [/code]
[code] [oracle@orcl19c admin]$ rman target sys/oracle@ORCL1 catalog RCATOWN/oracle@RCAT Recovery Manager: Release 19.0.0.0.0 - Production on Sun Apr 19 18:48:44 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL1 (DBID=1414679838) connected to recovery catalog database RMAN> [/code]
Step 2: Take a backup using the following script
[code] RMAN> run { allocate channel a1 device type disk format '/u01/bkp/arc/%U'; backup archivelog all delete all input; }2> 3> 4> allocated channel: a1 channel a1: SID=183 device type=DISK Starting backup at 19-APR-20 current log archived channel a1: starting archived log backup set channel a1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=7 STAMP=1038163880 channel a1: starting piece 1 at 19-APR-20 channel a1: finished piece 1 at 19-APR-20 piece handle=/u01/bkp/arc/0iuu27tc_1_1 tag=TAG20200419T185123 comment=NONE channel a1: backup set complete, elapsed time: 00:00:01 channel a1: deleting archived log(s) archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_1_1038092356.dbf RECID=7 STAMP=1038163880 channel a1: starting archived log backup set channel a1: specifying archived log(s) in backup set input archived log thread=1 sequence=9 RECID=6 STAMP=1038092357 input archived log thread=1 sequence=10 RECID=4 STAMP=1038092357 input archived log thread=1 sequence=11 RECID=5 STAMP=1038092357 channel a1: starting piece 1 at 19-APR-20 channel a1: finished piece 1 at 19-APR-20 piece handle=/u01/bkp/arc/0juu27td_1_1 tag=TAG20200419T185123 comment=NONE channel a1: backup set complete, elapsed time: 00:00:01 channel a1: deleting archived log(s) archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_9_1030230368.dbf RECID=6 STAMP=1038092357 archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_10_1030230368.dbf RECID=4 STAMP=1038092357 archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_11_1030230368.dbf RECID=5 STAMP=1038092357 Finished backup at 19-APR-20 Starting Control File and SPFILE Autobackup at 19-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/c-1414679838-20200419-04 comment=NONE Finished Control File and SPFILE Autobackup at 19-APR-20 released channel: a1 RMAN> [/code]
[code] RMAN> run { allocate channel a1 device type disk format '/u01/bkp/arc/%U'; backup archivelog all delete all input; }2> 3> 4> allocated channel: a1 channel a1: SID=183 device type=DISK Starting backup at 19-APR-20 current log archived channel a1: starting archived log backup set channel a1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=7 STAMP=1038163880 channel a1: starting piece 1 at 19-APR-20 channel a1: finished piece 1 at 19-APR-20 piece handle=/u01/bkp/arc/0iuu27tc_1_1 tag=TAG20200419T185123 comment=NONE channel a1: backup set complete, elapsed time: 00:00:01 channel a1: deleting archived log(s) archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_1_1038092356.dbf RECID=7 STAMP=1038163880 channel a1: starting archived log backup set channel a1: specifying archived log(s) in backup set input archived log thread=1 sequence=9 RECID=6 STAMP=1038092357 input archived log thread=1 sequence=10 RECID=4 STAMP=1038092357 input archived log thread=1 sequence=11 RECID=5 STAMP=1038092357 channel a1: starting piece 1 at 19-APR-20 channel a1: finished piece 1 at 19-APR-20 piece handle=/u01/bkp/arc/0juu27td_1_1 tag=TAG20200419T185123 comment=NONE channel a1: backup set complete, elapsed time: 00:00:01 channel a1: deleting archived log(s) archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_9_1030230368.dbf RECID=6 STAMP=1038092357 archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_10_1030230368.dbf RECID=4 STAMP=1038092357 archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_11_1030230368.dbf RECID=5 STAMP=1038092357 Finished backup at 19-APR-20 Starting Control File and SPFILE Autobackup at 19-APR-20 piece handle=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/c-1414679838-20200419-04 comment=NONE Finished Control File and SPFILE Autobackup at 19-APR-20 released channel: a1 RMAN> [/code]
You can specify the DELETE INPUT or DELETE ALL INPUT clauses for the BACKUP ARCHIVELOG command to delete archived logs after they are backed up, eliminating the separate step of manually deleting the archived redo logs. With DELETE INPUT, RMAN only deletes the specific copy of the archived redo log chosen for the backup set. With DELETE ALL INPUT, RMAN will delete each backed-up archived redo log file from all log archiving destinations.
Step 3: List backup of archive log
[code] RMAN> list backup of archivelog all; List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 410 120.72M DISK 00:00:00 19-APR-20 BP Key: 414 Status: AVAILABLE Compressed: NO Tag: TAG20200419T185123 Piece Name: /u01/bkp/arc/0iuu27tc_1_1 List of Archived Logs in backup set 410 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1 2520909 18-APR-20 2567598 19-APR-20 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 411 87.83M DISK 00:00:00 19-APR-20 BP Key: 415 Status: AVAILABLE Compressed: NO Tag: TAG20200419T185123 Piece Name: /u01/bkp/arc/0juu27td_1_1 List of Archived Logs in backup set 411 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 9 2376808 31-JAN-20 2498967 18-APR-20 1 10 2498967 18-APR-20 2503560 18-APR-20 1 11 2503560 18-APR-20 2520909 18-APR-20 [/code]
[code] RMAN> list backup of archivelog all; List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 410 120.72M DISK 00:00:00 19-APR-20 BP Key: 414 Status: AVAILABLE Compressed: NO Tag: TAG20200419T185123 Piece Name: /u01/bkp/arc/0iuu27tc_1_1 List of Archived Logs in backup set 410 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1 2520909 18-APR-20 2567598 19-APR-20 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 411 87.83M DISK 00:00:00 19-APR-20 BP Key: 415 Status: AVAILABLE Compressed: NO Tag: TAG20200419T185123 Piece Name: /u01/bkp/arc/0juu27td_1_1 List of Archived Logs in backup set 411 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 9 2376808 31-JAN-20 2498967 18-APR-20 1 10 2498967 18-APR-20 2503560 18-APR-20 1 11 2503560 18-APR-20 2520909 18-APR-20 [/code]




No comments:
Post a Comment