您好,登錄后才能下訂單哦!
最近遇到一個很有意思的問題,在RMAN中手動配置一條信息,但是由于筆誤,錯誤的增加一行“FOR DEVICE TYPE 'DISK' TO 'AA_auto_control_expire_backup_%F.ctl';”
但是希望刪除的過程,遇到了問題,通過各種clear的方式,都不能成功刪除,懷疑是oracle的一個小bug
1. 筆誤之后的結(jié)果
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RMAN> show all; 使用目標(biāo)數(shù)據(jù)庫控制文件替代恢復(fù)目錄 db_unique_name 為 ORCL 的數(shù)據(jù)庫的 RMAN 配置參數(shù)為: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'DISK' TO 'AA_auto_control_expire_backup_%F.ctl'; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'clear'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\APP\XIAOLXU\PRODUCT\11.2.0\DBHOME_2\DATABASE\SNCFORCL.ORA'; # default
2. 在無法刪除之后,想到RMAN的信息是記錄在control file中,dump一個trace看看。
SQL>alter database backup control file to trace
在alert log中可以看到trace的文件名
Wed Jun 29 16:48:14 2016 CJQ0 started with pid=28, OS id=16764 alter database backup controlfile to trace Backup controlfile written to trace file C:\APP\XIAOLXU\diag\rdbms\orcl\orcl\trace\orcl_ora_6304.trc Completed: alter database backup controlfile to trace
3. trace內(nèi)容如下, 可以看到對應(yīng)的記錄信息
“FOR DEVICE TYPE 'DISK' TO 'AA_auto_control_expire_backup_%F.ctl';”
STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512, GROUP 2 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO02.LOG' SIZE 50M BLOCKSIZE 512, GROUP 3 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO03.LOG' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE 'C:\APP\XIAOLXU\ORADATA\ORCL\SYSTEM01.DBF', 'C:\APP\XIAOLXU\ORADATA\ORCL\SYSAUX01.DBF', 'C:\APP\XIAOLXU\ORADATA\ORCL\UNDOTBS01.DBF', 'C:\APP\XIAOLXU\ORADATA\USERTEST.DBF' CHARACTER SET AL32UTF8 ; -- Configure RMAN configuration record 1 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE','''DISK'' TO ''AA_auto_control_expire_backup_%F.ctl'''); <<<<<<<< -- Configure RMAN configuration record 2 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','DEVICE TYPE DISK FORMAT ''clear'''); -- Configure RMAN configuration record 3 VARIABLE RECNO NUMBER; EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','OFF'); -- Commands to re-create incarnation table -- Below log names MUST be changed to existing filenames on -- disk. Any one log file from each branch can be used to -- re-create incarnation records. -- ALTER DATABASE REGISTER LOGFILE 'C:\APP\XIAOLXU\PRODUCT\11.2.0\DBHOME_2\RDBMS\ARC0000000001_0898420407.0001'; -- Recovery is required if any of the datafiles are restored backups, -- or if the last shutdown was not normal or immediate. RECOVER DATABASE USING BACKUP CONTROLFILE -- Database can now be opened zeroing the online logs. ALTER DATABASE OPEN RESETLOGS; -- Commands to add tempfiles to temporary tablespaces. -- Online tempfiles have complete space information. -- Other tempfiles may require adjustment. ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\APP\XIAOLXU\ORADATA\ORCL\TEMP01.DBF' SIZE 60817408 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M; -- End of tempfile additions. --
4. 使用下面命令重建控制文件
STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292 LOGFILE GROUP 1 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO01.LOG' SIZE 50M BLOCKSIZE 512, GROUP 2 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO02.LOG' SIZE 50M BLOCKSIZE 512, GROUP 3 'C:\APP\XIAOLXU\ORADATA\ORCL\REDO03.LOG' SIZE 50M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE 'C:\APP\XIAOLXU\ORADATA\ORCL\SYSTEM01.DBF', 'C:\APP\XIAOLXU\ORADATA\ORCL\SYSAUX01.DBF', 'C:\APP\XIAOLXU\ORADATA\ORCL\UNDOTBS01.DBF', 'C:\APP\XIAOLXU\ORADATA\USERTEST.DBF' CHARACTER SET AL32UTF8
5. 重建完成之后,這條信息就被刪除掉了。
RMAN> show all; 使用目標(biāo)數(shù)據(jù)庫控制文件替代恢復(fù)目錄 db_unique_name 為 ORCL 的數(shù)據(jù)庫的 RMAN 配置參數(shù)為: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\APP\XIAOLXU\PRODUCT\11.2.0\DBHOME_2\DATABASE\SNCFORCL.ORA'; # default
6. 同理,如果有之前的control file備份,restore一個,問題也是可以解決的。
注意,以上是測試步驟,重建控制文件之后,還有些后續(xù)工作,register archive log,recover database還是需要做的。生產(chǎn)環(huán)境要慎重。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。