1. Instance已經不正常結束
sqlplus / as sysdba
startup mount;
2. Instance尚在Open的狀況下
2.1 還可以進入資料庫的情況下
2.1.1 登入資料庫不會出現錯誤訊息
sqlplus / as sysdba
shutdown abort;
2.1.2 登入資料庫但卻連到idle instance
直接KILL process,例如:kill SMON
3. 已無法進入資料庫
直接KILL process,例如:kill SMON
P.S.:此篇復原前提為參數檔(init),控制檔(controlfile),archivelog,redo log皆正常的情形下。
復原流程:
1. 使用shutdown abort或是KILL process關閉資料庫
2. 執行startup mount;將資料庫啟動到Mount
3. 使用RMAN執行restore或是switch命令還原有問題的SYSTEM file或UNDO file
4. 使用RMAN執行recover database,透過archivelog及redolog復原資料庫
5. 執行alter database open開啟資料庫
復原詳細過程
1. 關閉資料庫
SQL> shutdown abort;
ORACLE instance shut down.
2. 啟動資料庫,發現有datafile毀損
SQL> startup;
ORACLE instance started.
Total System Global Area 3340451840 bytes
Fixed Size 2257840 bytes
Variable Size 1879051344 bytes
Database Buffers 1442840576 bytes
Redo Buffers 16302080 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/orclnofra/system01.dbf'
3. 檢查TRACE LOG
log路徑:/u01/app/oracle/diag/rdbms/orclnofra/orclnofra/trace/alert_orclnofra.log
log擷取部分錯誤如下
4. 透過restore database還原data file 1
RMAN> restore datafile 1;
Starting restore at 25-APR-2016 17:28:00
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/orclnofra/system01.dbf
channel ORA_DISK_1: reading from backup piece /backup/ORCLNOFR_20160425_6_1.bak
channel ORA_DISK_1: piece handle=/backup/ORCLNOFR_20160425_6_1.bak tag=TAG20160425T171813
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 25-APR-2016 17:28:15
5. 執行recover database
Starting recover at 25-APR-2016 17:28:55
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 25-APR-2016 17:28:56
6. 將資料庫OPEN
RMAN> alter database open;
database opened
7. 查看datafile是否OK
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orclnofra/system01.dbf
/u01/app/oracle/oradata/orclnofra/sysaux01.dbf
/u01/app/oracle/oradata/orclnofra/undotbs01.dbf
/u01/app/oracle/oradata/orclnofra/users01.dbf
/backup/test01.dbf
/backup/test02.dbf
6 rows selected.
沒有留言:
張貼留言