您好,登錄后才能下訂單哦!
環境:RHEL 6.5 Oracle 11.2.0.3
如果有RMAN備份的話,如果恢復數據文件就可以完成,本次我們測試在沒有備份的情況下如何拉起數據庫
重命名UNDO表空間的數據文件
[oracle@test-db orcl]$ mv undotbs02.dbf undotbs02.dbf_bak
啟動數據庫
SYS@orcl> startup ORACLE instance started. Total System Global Area 784998400 bytes Fixed Size 2232472 bytes Variable Size 591400808 bytes Database Buffers 188743680 bytes Redo Buffers 2621440 bytes Database mounted. ORA-01157: cannot identify/lock data file 7 - see DBWR trace file ORA-01110: data file 7: '/u01/app/oracle/oradata/orcl_data/orcl/undotbs02.dbf'
根據提示信息數據 7 有問題,查看alert.log文件
ALTER DATABASE OPEN Errors in file /u01/app/oracle/diag/rdbms/primary_orcl/orcl/trace/orcl_dbw0_2532.trc: ORA-01157: cannot identify/lock data file 7 - see DBWR trace file ORA-01110: data file 7: '/u01/app/oracle/oradata/orcl_data/orcl/undotbs02.dbf' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 Block change tracking file is current. Errors in file /u01/app/oracle/diag/rdbms/primary_orcl/orcl/trace/orcl_ora_2621.trc: ORA-01157: cannot identify/lock data file 7 - see DBWR trace file ORA-01110: data file 7: '/u01/app/oracle/oradata/orcl_data/orcl/undotbs02.dbf' ORA-1157 signalled during: ALTER DATABASE OPEN... Sun Jan 13 15:32:08 2019 Checker run found 1 new persistent data failures
日志文件中也顯示 7號數據文件找不到了
###########################################################################
開始強制拉起數據庫
啟動數據庫至MOUNT狀態
SYS@orcl> shutdown immediate ORA-01109: database not open Database dismounted. ORACLE instance shut down. SYS@orcl> startup mount; ORACLE instance started. Total System Global Area 784998400 bytes Fixed Size 2232472 bytes Variable Size 591400808 bytes Database Buffers 188743680 bytes Redo Buffers 2621440 bytes Database mounted.
將 文件號為 7 的數據庫文件offline 并 打開數據庫
SYS@orcl> alter database datafile 7 offline drop; Database altered. SYS@orcl> alter database open; Database altered.
創建新的UNDO表空間,并設置為數據庫默認表空間
SYS@orcl> create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/orcl_data/orcl/undotbs1.dbf' size 500m ; Tablespace created. SYS@orcl> show parameter undo NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ undo_management string AUTO undo_retention integer 900 undo_tablespace string UNDOTBS2 SYS@orcl> alter system set undo_tablespace='UNDOTBS1' scope=spfile; System altered.
重啟數據庫
SYS@orcl> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SYS@orcl> startup ORACLE instance started. Total System Global Area 784998400 bytes Fixed Size 2232472 bytes Variable Size 591400808 bytes Database Buffers 188743680 bytes Redo Buffers 2621440 bytes Database mounted. Database opened. SYS@orcl> show parameter undo NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ undo_management string AUTO undo_retention integer 900 undo_tablespace string UNDOTBS1 SYS@orcl>
總結:
這是最簡單的一種情況下恢復undo表空間丟失的情況,也是很容易的。
直接 offile 相關數據文件,打開數據庫重新創建UNDO表空間并默認為數據庫默認表空間
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。