Moving Archivelogs Sans The Current Archive Log

Information on Oracle-preferred method for efficiently backing up and recovering an Oracle Database which is RMAN
Post Reply
User avatar
jimb
Site Admin
Posts: 6146
Joined: Thu Jan 19, 2012 1:10 pm
Location: New Delhi, India
Contact:

Moving Archivelogs Sans The Current Archive Log

Post by jimb »

- Check the archive log destination. In this case, the default archive log location is the Flash Recovery Area (FLA)
SQL> show parameter log_archive_dest
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/oradata/flash_recovery_ar
ea
db_recovery_file_dest_size big integer 2G
- Change directory to Archive log location
> [oracle@oracle10g ~]$ cd /u01/oradata/flash_recovery_area/
> [oracle@oracle10g flash_recovery_area]$ ls -ltrh
total 4.0K
drwxr-x--- 4 oracle oinstall 4.0K Jan 23 18:30 ORCL10G
> [oracle@oracle10g flash_recovery_area]$ cd ORCL10G/
[oracle@oracle10g ORCL10G]$ ls -ltrh
total 8.0K
drwxr-x--- 2 oracle oinstall 4.0K Jan 23 17:02 onlinelog
drwxr-x--- 3 oracle oinstall 4.0K Jan 23 18:30 archivelog
> [oracle@oracle10g ORCL10G]$ cd archivelog/
[oracle@oracle10g archivelog]$ ls -ltrh
total 4.0K
drwxr-x--- 2 oracle oinstall 4.0K Jan 23 18:53 2012_01_23
> [oracle@oracle10g archivelog]$ cd 2012_01_23/
> [oracle@oracle10g 2012_01_23]$ ls -ltrh
total 51M
-rw-r----- 1 oracle oinstall 50M Jan 23 18:30 o1_mf_1_1_7ktfp7d7_.arc
-rw-r----- 1 oracle oinstall 855K Jan 23 18:53 o1_mf_1_2_7kth0dxm_.arc
- Create the destination directory.
> [oracle@oracle10g 2012_01_23]$ mkdir /u01/temp/

- Start moving all archivelogs except the last file on the list (which is the one being archived).
> Syntax: ls -rt *.dbf *.arc | grep -v `ls -rt *.dbf *.arc | tail -1` | awk '{print "mv "$1" <TO_DIR>"}' &
> ls -rt *.dbf *.arc | grep -v `ls -rt *.dbf *.arc | tail -1` | awk '{print "mv "$1" /u01/temp/"}' | sh

- Connect to RMAN Catalog (if you're using Catalog)
> Syntax: rman target /catalog <user>/<pass>/@<cat_db>
> rman target / catalog rman/rman@catdb

- Catalog the recently moved archivelogs in the Recovery Catalog.
To Catalog the Archivelogs in Oracle 10g and 11g:

[oracle@oracle10g ~]$ rman target /
[oracle@oracle10g ~]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Feb 14 09:20:13 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: ORCL10G (DBID=957726458)

RMAN>
RMAN> CATALOG START WITH '/u02/oradata/ORCL10G/logfiles/' ;

Note: The directory location of the archivelogs should end in a forward slash (/).

RMAN lists the files to be added to the RMAN repository and prompts for confirmation before adding the backups.

Perform Crosscheck of Archivelogs to check that files are in place and ready for a restore.
RMAN> crosscheck archivelog all;

For Oracle Database 9i:
Unlike Oracle 10g and 11g, separately catalog each archivelog one by one. But you can put them all in a run {} block for bulk cataloging.

RMAN> run {
catalog archivelog '/u02/oradata/testdb/logfiles/ORCL9i_1_31345.log';
catalog archivelog '/u02/oradata/testdb/logfiles/ORCL9i_1_31346.log';
catalog archivelog '/u02/oradata/testdb/logfiles/ORCL9i_1_31347.log';
}



- Perform crosscheck. It cross checks if archived log files are available on disk location or not, irrespective of backups.
> RMAN> crosscheck archivelog all;
RMAN> crosscheck archivelog all;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=133 devtype=DISK
validation succeeded for archived log
archive log filename=/u01/temp/o1_mf_1_1_7ktfp7d7_.arc recid=5 stamp=773349152
validation failed for archived log
archive log filename=/u01/oradata/flash_recovery_area/ORCL10G/archivelog/2012_01_23/o1_mf_1_1_7ktfp7d7_.arc recid=1 stamp=773346635
validation succeeded for archived log
archive log filename=/u01/temp/o1_mf_1_2_7kth0dxm_.arc recid=4 stamp=773349152
validation failed for archived log
archive log filename=/u01/oradata/flash_recovery_area/ORCL10G/archivelog/2012_01_23/o1_mf_1_2_7kth0dxm_.arc recid=2 stamp=773347981
validation succeeded for archived log
archive log filename=/u01/oradata/flash_recovery_area/ORCL10G/archivelog/2012_01_23/o1_mf_1_3_7kthywv6_.arc recid=3 stamp=773348956
Crosschecked 5 objects
RMAN>
- Exit Recovery Manager (RMAN)
> RMAN> exit

-- End of Moving Archivelogs --
Oracle Database Administration Forums
http://www.oracle-forums.com/
xaeresis
Posts: 196117
Joined: Wed Oct 04, 2023 2:39 pm

Re: Moving Archivelogs Sans The Current Archive Log

Post by xaeresis »

Post Reply