Rman Useful commands
crosscheck archivelog all;
delete noprompt obsolete;
crosscheck copy;
crosscheck controlfilecopy ' location of controlfile backup';
--crosscheck controlfilecopy '/erp_bkp/oradata/HRD/rman/ctl/snapcf_HRD.ctl';
delete noprompt obsolete;
or
#crosscheck archivelog all;
# delete archivelog until time 'SYSDATE-1/8';
#delete expired archivelog all;
To delete expired repository records:
1.If you have not performed a crosscheck recently, then issue a CROSSCHECK command. For example, issue:
CROSSCHECK BACKUP; # checks backup sets and copies on configured channels
2.Delete the expired backups. For example, issue:
DELETE NOPROMPT EXPIRED BACKUP;
Symptoms
------------
When attempting to delete obsolete backups from RMAN using the following command:
RMAN> delete obsolete;
the following error occurs:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 05/07/2008 22:04:21
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
Solution
---------
To implement the solution, please execute the following steps:
Please run the following commands to delete obsolete backup sets on both disk and tape:
RMAN> allocate channel for maintenance type disk;
RMAN> allocate channel for maintenance device type 'sbt_tape' PARMS '...';
==>Please contact your MML(Media Management Layer) vendor to get the actual tape parameters and repalce the '...' .
RMAN> delete obsolete;
If you want to delete obsolete backup sets on disk, you can use the following commands:
RMAN> allocate channel for maintenance type disk;
RMAN> delete noprompt obsolete device type disk;
or try below
DELETE OBSOLETE REDUNDANCY = 4;
DELETE OBSOLETE RECOVERY WINDOW OF 4 DAYS;
#delete noprompt obsolete;
#crosscheck backup;
crosscheck archivelog all;
#crosscheck copy;
#delete noprompt obsolete;
#delete noprompt expired copy;
backup validate check logical database;
#Added below to trace rman backup
#rman target=bkpmgr/thebkpmgr nocatalog debug trace=/tmp/backup_db.trc log=/tmp/backup_db.log <<ERMAN
BACKUP INCREMENTAL LEVEL 0 blocks all check logical DATABASE filesperset 1 plus archivelog filesperset 1;
#backup database plus archivelog filesperset 1;
#list backup of database;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 1 TIMES TO 'DISK' COMPLETED BEFORE 'SYSDATE -3';
#allocate channel for maintenance type disk;
#delete noprompt obsolete device type disk;
Configure the RMAN channel in RAC node1 and RAC node 2
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/export/home/erp_bkp/oradata/rman/bkp_sets/bkp_c1_ERPDBA_%U.%T' CONNECT 'SYS/manager@ERPDBA1';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/export/home/erp_bkp/oradata/rman/bkp_sets/bkp_c2_ERPDBA_%U.%T' CONNECT 'SYS/manager@ERPDBA2';
----------------------------------------------------------------------------------------------------------------
01.RMAN> list failure;
02.using target database control file instead of recovery catalog
03.Database Role: PRIMARY
04.List of Database Failures
05.=========================
06.Failure ID Priority Status Time Detected Summary
07.---------- -------- --------- ------------- -------
08.88 HIGH OPEN 04-JUL-16 One or more non-system datafiles need media recovery
01.RMAN> advise failure;
02.Database Role: PRIMARY
03.List of Database Failures
04.=========================
05.Failure ID Priority Status Time Detected Summary
06.---------- -------- --------- ------------- -------
07.88 HIGH OPEN 04-JUL-16 One or more non-system datafiles need media recovery
08.analyzing automatic repair options; this may take some time
09.allocated channel: ORA_DISK_1
10.channel ORA_DISK_1: SID=24 device type=DISK
11.analyzing automatic repair options complete
12.Mandatory Manual Actions
13.========================
14.no manual actions available
15.Optional Manual Actions
16.=======================
17.1. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_data1_cqmjw4hl_.dbf, then replace it with the correct one
18.2. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_undotbs1_cgvp4zmw_.dbf, then replace it with the correct one
19.3. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_example_cgvp7rsq_.dbf, then replace it with the correct one
20.4. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_users_cqmj64lc_.dbf, then replace it with the correct one
21.5. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_catalog__cqnqm0nx_.dbf, then replace it with the correct one
22.Automated Repair Options
23.========================
24.Option Repair Description
25.------ ------------------
26.1 Recover datafile 2; Recover datafile 4; Recover datafile 5; ...
27. Strategy: The repair includes complete media recovery with no data loss
28. Repair script: /u01/app/oracle/diag/rdbms/sandprd/SANDPRD/hm/reco_2248476417.hm
01.RMAN> repair failure;
02.Strategy: The repair includes complete media recovery with no data loss
03.Repair script: /u01/app/oracle/diag/rdbms/sandprd/SANDPRD/hm/reco_2248476417.hm
04.contents of repair script:
05. # recover datafile
06. recover datafile 2, 4, 5, 6, 7;
07. sql 'alter database datafile 2, 4, 5, 6, 7 online';
08.Do you really want to execute the above repair (enter YES or NO)? yes
09.executing repair script
10.Starting recover at 04-JUL-16
11.using channel ORA_DISK_1
12.RMAN-00571: ===========================================================
13.RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
14.RMAN-00571: ===========================================================
15.RMAN-03002: failure of repair command at 07/04/2016 14:10:06
16.RMAN-03015: error occurred in stored script Repair Script
17.RMAN-06067: RECOVER DATABASE required with a backup or created control file
18.RMAN> recover database;
19.Starting recover at 04-JUL-16
20.using channel ORA_DISK_1
21.starting media recovery
22.media recovery complete, elapsed time: 00:00:03
23.Finished recover at 04-JUL-16
24.RMAN> alter database open;
25.Statement processed
26.RMAN>
----------------------------------------------------------------------------------------------------------------
crosscheck archivelog all;
delete noprompt obsolete;
crosscheck copy;
crosscheck controlfilecopy ' location of controlfile backup';
--crosscheck controlfilecopy '/erp_bkp/oradata/HRD/rman/ctl/snapcf_HRD.ctl';
delete noprompt obsolete;
or
#crosscheck archivelog all;
# delete archivelog until time 'SYSDATE-1/8';
#delete expired archivelog all;
To delete expired repository records:
1.If you have not performed a crosscheck recently, then issue a CROSSCHECK command. For example, issue:
CROSSCHECK BACKUP; # checks backup sets and copies on configured channels
2.Delete the expired backups. For example, issue:
DELETE NOPROMPT EXPIRED BACKUP;
Symptoms
------------
When attempting to delete obsolete backups from RMAN using the following command:
RMAN> delete obsolete;
the following error occurs:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 05/07/2008 22:04:21
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
Solution
---------
To implement the solution, please execute the following steps:
Please run the following commands to delete obsolete backup sets on both disk and tape:
RMAN> allocate channel for maintenance type disk;
RMAN> allocate channel for maintenance device type 'sbt_tape' PARMS '...';
==>Please contact your MML(Media Management Layer) vendor to get the actual tape parameters and repalce the '...' .
RMAN> delete obsolete;
If you want to delete obsolete backup sets on disk, you can use the following commands:
RMAN> allocate channel for maintenance type disk;
RMAN> delete noprompt obsolete device type disk;
or try below
DELETE OBSOLETE REDUNDANCY = 4;
DELETE OBSOLETE RECOVERY WINDOW OF 4 DAYS;
#delete noprompt obsolete;
#crosscheck backup;
crosscheck archivelog all;
#crosscheck copy;
#delete noprompt obsolete;
#delete noprompt expired copy;
backup validate check logical database;
#Added below to trace rman backup
#rman target=bkpmgr/thebkpmgr nocatalog debug trace=/tmp/backup_db.trc log=/tmp/backup_db.log <<ERMAN
BACKUP INCREMENTAL LEVEL 0 blocks all check logical DATABASE filesperset 1 plus archivelog filesperset 1;
#backup database plus archivelog filesperset 1;
#list backup of database;
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 1 TIMES TO 'DISK' COMPLETED BEFORE 'SYSDATE -3';
#allocate channel for maintenance type disk;
#delete noprompt obsolete device type disk;
Configure the RMAN channel in RAC node1 and RAC node 2
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/export/home/erp_bkp/oradata/rman/bkp_sets/bkp_c1_ERPDBA_%U.%T' CONNECT 'SYS/manager@ERPDBA1';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/export/home/erp_bkp/oradata/rman/bkp_sets/bkp_c2_ERPDBA_%U.%T' CONNECT 'SYS/manager@ERPDBA2';
----------------------------------------------------------------------------------------------------------------
01.RMAN> list failure;
02.using target database control file instead of recovery catalog
03.Database Role: PRIMARY
04.List of Database Failures
05.=========================
06.Failure ID Priority Status Time Detected Summary
07.---------- -------- --------- ------------- -------
08.88 HIGH OPEN 04-JUL-16 One or more non-system datafiles need media recovery
01.RMAN> advise failure;
02.Database Role: PRIMARY
03.List of Database Failures
04.=========================
05.Failure ID Priority Status Time Detected Summary
06.---------- -------- --------- ------------- -------
07.88 HIGH OPEN 04-JUL-16 One or more non-system datafiles need media recovery
08.analyzing automatic repair options; this may take some time
09.allocated channel: ORA_DISK_1
10.channel ORA_DISK_1: SID=24 device type=DISK
11.analyzing automatic repair options complete
12.Mandatory Manual Actions
13.========================
14.no manual actions available
15.Optional Manual Actions
16.=======================
17.1. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_data1_cqmjw4hl_.dbf, then replace it with the correct one
18.2. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_undotbs1_cgvp4zmw_.dbf, then replace it with the correct one
19.3. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_example_cgvp7rsq_.dbf, then replace it with the correct one
20.4. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_users_cqmj64lc_.dbf, then replace it with the correct one
21.5. If you restored the wrong version of data file /u01/app/oracle/oradata/SANDPRD/datafile/o1_mf_catalog__cqnqm0nx_.dbf, then replace it with the correct one
22.Automated Repair Options
23.========================
24.Option Repair Description
25.------ ------------------
26.1 Recover datafile 2; Recover datafile 4; Recover datafile 5; ...
27. Strategy: The repair includes complete media recovery with no data loss
28. Repair script: /u01/app/oracle/diag/rdbms/sandprd/SANDPRD/hm/reco_2248476417.hm
01.RMAN> repair failure;
02.Strategy: The repair includes complete media recovery with no data loss
03.Repair script: /u01/app/oracle/diag/rdbms/sandprd/SANDPRD/hm/reco_2248476417.hm
04.contents of repair script:
05. # recover datafile
06. recover datafile 2, 4, 5, 6, 7;
07. sql 'alter database datafile 2, 4, 5, 6, 7 online';
08.Do you really want to execute the above repair (enter YES or NO)? yes
09.executing repair script
10.Starting recover at 04-JUL-16
11.using channel ORA_DISK_1
12.RMAN-00571: ===========================================================
13.RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
14.RMAN-00571: ===========================================================
15.RMAN-03002: failure of repair command at 07/04/2016 14:10:06
16.RMAN-03015: error occurred in stored script Repair Script
17.RMAN-06067: RECOVER DATABASE required with a backup or created control file
18.RMAN> recover database;
19.Starting recover at 04-JUL-16
20.using channel ORA_DISK_1
21.starting media recovery
22.media recovery complete, elapsed time: 00:00:03
23.Finished recover at 04-JUL-16
24.RMAN> alter database open;
25.Statement processed
26.RMAN>
----------------------------------------------------------------------------------------------------------------