linux误删表空间文件,UNDO表空间下的数据文件被误删除后的处理方法
UNDO表空間下的數(shù)據(jù)文件被誤刪除后的處理方法:
操作前備份數(shù)據(jù)庫,以避免更大的損失。
思路:
1、把誤刪除的數(shù)據(jù)文件offline
2、正常打開數(shù)據(jù)庫后創(chuàng)建新的UNDO表空間及數(shù)據(jù)文件
3、修改相應(yīng)參數(shù)指向新的UNDO表空間
4、重新啟動數(shù)據(jù)庫驗證
5、刪除舊的UNDO表空間。
以下為我在虛擬機上模擬的場景:在數(shù)據(jù)庫打開的狀態(tài)下,用操作系統(tǒng)命令將undo表空間對應(yīng)的唯一數(shù)據(jù)文件改名,以模擬數(shù)據(jù)文件被刪除的情況。
關(guān)閉數(shù)據(jù)庫
SQL> shutdown immediate;
Database closed.
Database dismounted.
Oracle instance shut down.
啟動數(shù)據(jù)庫,報錯,提示找不到undo表空間下的數(shù)據(jù)文件/oradata/orcl/undotbs01.dbf
SQL> startup
ORACLE instance started.
Total System Global Area? 536870912 bytes
Fixed Size? ? ? ? ? ? ? ? ? ? 2097624 bytes
Variable Size? ? ? ? ? ? ? ? ? 150998568 bytes
Database Buffers? ? ? ? ? 377487360 bytes
Redo Buffers? ? ? ? ? ? ? ? ? ? 6287360 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/oradata/orcl/undotbs01.dbf'
將該數(shù)據(jù)文件offline
SQL> alter database datafile 2 offline
2? ;
Database altered.
正常打開數(shù)據(jù)庫
SQL> alter database open;
Database altered.
顯示UNDO相關(guān)的參數(shù)
SQL> show parameter undo
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE? ? ? ? VALUE
------------------------------------ ----------- ------------------------------
undo_management? ? ? ? ? ? ? ? ? ? ? string? ? ? ? AUTO
undo_retention? ? ? ? ? ? ? ? ? ? ? ? ? ? integer? ? ? ? 900
undo_tablespace? ? ? ? ? ? ? ? ? ? ? string? ? ? ? UNDOTBS1
創(chuàng)建新的UNDO表空間
SQL> create undo tablespace undotbs2 datafile '/oradata/orcl/undotbs02.dbf' size 320M;
Tablespace created.
修改UNDO_TABLESPACE參數(shù),指向新創(chuàng)建的UNDO表空間
SQL> alter system set undo_tablespace='undotbs2' scope=spfile;
System altered.
重新啟動數(shù)據(jù)庫
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area? 536870912 bytes
Fixed Size? ? ? ? ? ? ? ? ? ? 2097624 bytes
Variable Size? ? ? ? ? ? ? ? ? 150998568 bytes
Database Buffers? ? ? ? ? 377487360 bytes
Redo Buffers? ? ? ? ? ? ? ? ? ? 6287360 bytes
Database mounted.
Database opened.
SQL> select * from v$tablespace;
TS# NAME? ? ? ? ? ? ? ? ? ? ? ? ? INC BIG FLA ENC
---------- ------------------------------ --- --- --- ---
0 SYSTEM? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
1 UNDOTBS1? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
2 SYSAUX? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
3 TEMP? ? ? ? ? ? ? ? ? ? ? ? ? NO? NO? YES
4 USERS? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
5 HRTBS? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
6 DEMO? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
8 UNDOTBS2? ? ? ? ? ? ? ? ? ? ? ? ? YES NO? YES
8 rows selected.
確認UNDO_TABLESPACE參數(shù)已修改
SQL> show parameter undo
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE? ? ? ? VALUE
------------------------------------ ----------- ------------------------------
undo_management? ? ? ? ? ? ? ? ? ? ? string? ? ? ? AUTO
undo_retention? ? ? ? ? ? ? ? ? ? ? ? ? ? integer? ? ? ? 900
undo_tablespace? ? ? ? ? ? ? ? ? ? ? string? ? ? ? undotbs2
刪除舊的UNDO表空間
SQL> drop tablespace undotbs1;
Tablespace dropped.
總結(jié)
以上是生活随笔為你收集整理的linux误删表空间文件,UNDO表空间下的数据文件被误删除后的处理方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 群晖发布五盘位高端NAS DS1522+
- 下一篇: 无人驾驶出租车自动聚集堵路!目击者:太魔