UNDO表空間資料檔案丟失處理(二)正常關閉資料庫

csbin發表於2014-02-27

1.1  模擬指令碼

host rm -rf /opt/oracle/oradata/orcl/*

host cp /opt/oracle/oradata/orcl_bk/* /opt/oracle/oradata/orcl/

host cp /opt/oracle/oradata/orcl/control01.ctl /opt/oracle/fast_recovery_area/orcl/control02.ctl

host cp /opt/oracle/oradata/spfileorcl.ora /opt/oracle/product/11.2.0.3/dbs/

startup

shutdown immediate

startup

delete from scott.emp;

commit;

shutdown immediate

host mv /opt/oracle/oradata/orcl/undotbs01.dbf /opt/oracle/oradata/orcl/undotbs01.dbf.bak

 

1.2  解決辦法

1、在mount狀態下,將undotbs1的資料檔案offline

2alter database open

3、建立新的回滾表空間undotbs2,並設定undo_tablespaceundotbs2

4、重啟資料庫,刪掉undotbs1表空間

SQL> startup mount

ORACLE instance started.

Total System Global Area 4275781632 bytes

Fixed Size                  2235208 bytes

Variable Size             822084792 bytes

Database Buffers         3439329280 bytes

Redo Buffers               12132352 bytes

Database mounted.


SQL> alter database datafile '/opt/oracle/oradata/orcl/undotbs01.dbf' offline drop;

Database altered.


SQL> alter database open;

Database altered.


SQL> create undo tablespace undotbs2 datafile '/opt/oracle/oradata/orcl/undotbs02.dbf' size 100m autoextend on next 100m maxsize 30720m;

Tablespace created.


SQL> alter system set undo_tablespace = 'UNDOTBS2' scope=spfile;

System altered.


SQL> drop tablespace UNDOTBS1 including contents and datafiles;

drop tablespace UNDOTBS1 including contents and datafiles

*

ERROR at line 1:

ORA-30013: undo tablespace 'UNDOTBS1' is currently in use


SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.


SQL> startup

ORACLE instance started.

Total System Global Area 4275781632 bytes

Fixed Size                  2235208 bytes

Variable Size             822084792 bytes

Database Buffers         3439329280 bytes

Redo Buffers               12132352 bytes

Database mounted.

Database opened.


SQL> drop tablespace UNDOTBS1 including contents and datafiles;

Tablespace dropped.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/720091/viewspace-1096678/,如需轉載,請註明出處,否則將追究法律責任。

相關文章