Here’s the syntax to to delete all archive logs but only keep a day or two of archive logs.
delete noprompt archivelog until time 'sysdate - 2' backed up 2 times to device type disk;
Posted by Charles Kim, Oracle ACE
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||
Here’s the syntax to to delete all archive logs but only keep a day or two of archive logs.
delete noprompt archivelog until time 'sysdate - 2' backed up 2 times to device type disk;
Posted by Charles Kim, Oracle ACE
run
{
allocate channel d1 type disk;
delete backupset completed before 'sysdate -5';
release channel d1;
}
Posted by Charles Kim, Oracle ACE
RMAN archivelog management
List archivelog all;
Delete a specific archivelog:
RMAN> delete archivelog logseq=22;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
21 1 22 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809 RECID=21 STAMP=649776849
Deleted 1 objects
To delete a range of archivelogs:
RMAN> delete archivelog from logseq=20 until logseq=21;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
20 1 21 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759 RECID=20 STAMP=649776805
Deleted 1 objects
To delete a range of archivelogs without being prompted:
RMAN> delete noprompt archivelog from logseq=22 until logseq=35;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
22 1 23 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_23.292.649776857
23 1 24 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_24.291.649776903
24 1 25 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_25.290.649776949
…
…
…
To delete all the archivelogs;
Delete archivelog all;
RMAN archivelog management
List archivelog all;
Delete a specific archivelog:
RMAN> delete archivelog logseq=22;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
21 1 22 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_22.264.649776809 RECID=21 STAMP=649776849
Deleted 1 objects
To delete a range of archivelogs:
RMAN> delete archivelog from logseq=20 until logseq=21;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
20 1 21 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759
Do you really want to delete the above objects (enter YES or NO)? YES
deleted archived log
archived log file name=+DATA/visk4/archivelog/2008_03_19/thread_1_seq_21.293.649776759 RECID=20 STAMP=649776805
Deleted 1 objects
To delete a range of archivelogs without being prompted:
RMAN> delete noprompt archivelog from logseq=22 until logseq=35;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
Key Thrd Seq S Low Time
——- —- ——- – ———
22 1 23 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_23.292.649776857
23 1 24 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_24.291.649776903
24 1 25 A 19-MAR-08
Name: +DATA/visk4/archivelog/2008_03_19/thread_1_seq_25.290.649776949
…
…
…
To delete all the archivelogs;
Delete archivelog all;
Delete all the archivelogs without being prompted:
RMAN> delete noprompt archivelog all;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=115 device type=DISK
List of Archived Log Copies for database with db_unique_name VISK4
=====================================================================
To copy a single archivelog out of ASM:
RMAN> backup as copy archivelog from logseq=78 until logseq=78 format ‘/tmp/%t%r%s%p’;
Starting backup at 21-MAR-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=124 device type=DISK
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=78 RECID=77 STAMP=649959634
output file name=/tmp/649960068%r211 RECID=78 STAMP=649960076
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:15
Finished backup at 21-MAR-08
Posted by Charles Kim, Oracle ACE
First, enable BCT (Block Change Tracking). For syntax, please refer to: http://dbaexpert.com/blog/?p=33
One time only to establish the baseline full database backup, you need to perform a level 0 backup of the database using the AS COPY syntax to the FRA:
backup incremental level 0 AS COPY tag DBATOOLS_backup_cp_full_102607 format ‘/u01/app/oracle/admin/DBATOOLS/bkups/%U’ (database);
backup AS COPY skip inaccessible format ‘/u01/app/oracle/admin/DBATOOLS/bkups/%U’ (archivelog all delete input) ;
Now, perform a level 1 incremental backup of the database and archivelogs. Please pay particular attention to the TAGs. It will serve as the essence to performing the merge:
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG ‘DBATOOLS_backup_cp1_full_102607′ format ‘/u01/app/oracle/admin/DBATOOLS/bkups/%U’ DATABASE;
backup AS COPY skip inaccessible format ‘/u01/app/oracle/admin/DBATOOLS/bkups/%U’ (archivelog all delete input) ;
The level 1 backup from the previous night will be merged with the level 0 backup using the TAG syntax prior to performing the new level 1 backup:
recover copy of database with tag ‘DBATOOLS_backup_cp1_full_102607′;
BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG ‘DBATOOLS_backup_cp1_full_102707′ DATABASE;
backup AS COPY skip inaccessible (archivelog all delete input) ;
Posted by Charles Kim @ DBAExpert.com
First, create the rman schema:
1 create user rman identified by rman123
2* default tablespace rman_d temporary tablespace temp
SQL> /
User created.
SQL> grant RECOVERY_CATALOG_OWNER to rman;
Grant succeeded.
SQL> grant connect, resource to rman;
Grant succeeded.
Next, connect to the recovery catalog database:
scadmin > rman target rman/rman123 catalog rman/rman123
Recovery Manager: Release 10.2.0.3.0 – Production on Wed Oct 1 13:14:20 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: RMANPROD (DBID=999586748)
connected to recovery catalog database
Finally create the catalog:
RMAN> create catalog
recovery catalog created
Register each database (from each client server):
rman catalog rman/rman123@DBATOOLS target /
Recovery Manager: Release 10.2.0.3.0 – Production on Wed Oct 1 13:24:55 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DBATOOLS (DBID=2955690999)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
run
{
allocate channel d1 type disk;
set limit channel d1 kbytes = 2000000;
backup diskratio=0 filesperset 5 format ‘/apps/oracle/admin/DBATOOLS/bkups/%d.%s.%p.%t.A’
skip inaccessible (archivelog all delete input);
release channel d1;
}
delete noprompt archivelog until time ’sysdate -2′ backed up 2 times to device type disk;
SQL> select * from v$block_change_tracking;
STATUS FILENAME BYTES STATUS
———- ———– ——- ———-
DISABLED
SQL> alter database enable block change tracking using file ‘+data’;
Database altered.