Today, we saw an RMAN backup script in the company's database: run {allocatechannelc1typediskmaxpiecesize2G; allocatechannel
Today, we saw an RMAN backup script in the company's database: run {allocate channel c1 type disk maxpiecesize = 2G; allocate channel
Today, we see this RMAN backup script in the company's database:
Run {
Allocate channel c1 type disk maxpiecesize = 2G;
Allocate channel c2 type disk maxpiecesize = 2G;
Backup incremental level 1 database format'/backup/osedb_osedb01/data/% d_DF _ % T _ % s _ % p. bak'
Plus archivelog format '/backup/osedb_osedb01/arch/% d_AF _ % T _ % s _ % p. Log'All delete all input;
Release channel c1;
Release channel c2;
}
Pay attention to the red part above. I saw a problem, so I did a test on the test machine and found that there was a mistake. The following is a detailed description.
1. First, the above script is incorrect. You should remove the first "all" in the red font above.
2. Differences between delete input and delete all input
(1) If there is only one archiving log directory, that is, there is no difference between the two methods;
(2) If there are multiple archived log directories, that is, multiple archived logs are saved during archiving, then:
Delete input after archiving logs are backed up, all archived logs under the first archive directory (for example, log_archive_dest_1) are deleted;
Delete all input: After archiving logs are backed up, all archivelog backups in log_archive_dest_n will be deleted.
3. When can I useAll delete input or all delete all inputWhat about it?
The method mentioned in "1" and "2" is to back up the archived logs while backing up the database, for example:
Backup database plus archivelog delete all input;
The use of all delete all input is used to back up database archive logs directly, for example:
Backup archivelog all delete all input;
Additional:
When archiving logs are backed up, if some archiving logs are deleted or lost, an error RMAN-06059 will be reported during the backup process:
Assume that the current database has the following archived logs:
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
-----------------------------------------
59 1 35 A 16-MAY-11/u01/backup/arch1/12735_750725106.dbf
60 1 35 A 16-MAY-11/u01/backup/arch2/12735_750725106.dbf
61 1 36 A 16-MAY-11/u01/backup/arch1/10936_750725106.dbf
62 1 36 A 16-MAY-11/u01/backup/arch2/41536_750725106.dbf
Now, manually run the rm command in the operating system to delete the archive log document on the 36th. If the archive log on the 36th is lost, the following error occurs when you back up the archive log:
RMAN> backup tablespace app plus archivelog delete all input;
Starting backup at 16-MAY-11
Current log archived
Using channel ORA_DISK_1
Archived log/u01/backup/arch1/1_36_750725106.dbf not found or out of sync with catalog
Trying alternate file for archivelog thread 1, sequence 36
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of backup plus archivelog command at 05/16/2011 03:22:29
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file/u01/backup/arch2/logs 36_750725106.dbf
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
This is because the 36th archiving log is missing. How can this problem be solved now?
Solution:
RMAN> crosscheck archivelog all;
Or: RMAN> change archivelog all crosscheck;
Perform the backup operation again.
Then you need to clear the data in RMAN:
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
--------------------------------
621 36X16-MAY-11/u01/backup/arch2/41536_750725106.dbf
611 36X16-MAY-11/u01/backup/arch1/1_36_750725106.dbf
RMAN>Delete archivelog 61,62;
Released channel: ORA_DISK_1
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: sid = 141 devtype = DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
--------------------------------
61 1 36X16-MAY-11/u01/backup/arch1/10936_750725106.dbf
62 1 36X16-MAY-11/u01/backup/arch2/41536_750725106.dbf
Do you really want to delete the above objects (enter YES or NO )? Y
Deleted archive log
Archive log filename =/u01/backup/arch1/logs 36_750725106.dbf recid = 61 stamp = 751258131
Deleted archive log
Archive log filename =/u01/backup/arch2/logs 36_750725106.dbf recid = 62 stamp = 751258131
Deleted 2 objects