undo表空间丢失、损坏

China☆狼群 提交于 2019-11-28 04:16:29

1、模拟误删undo表空间

rm -rf undotbs01.dbf

2、

SQL> shutdown immediate
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 499125612 bytes
Database Buffers 343932928 bytes
Redo Buffers 5124096 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'


SQL> alter database datafile 3 offline drop;

Database altered.

SQL> alter system set undo_management='MANUAL' scope=spfile;

System altered.

SQL> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 499125612 bytes
Database Buffers 343932928 bytes
Redo Buffers 5124096 bytes
Database mounted.
Database opened.

SQL> create pfile='/tmp/initPROD1.ora' from spfile;

File created.

SQL> shutdown immediate
ORA-00376: file 3 cannot be read at this time
ORA-01110: data file 3: '/u01/app/oracle/oradata/PROD1/undotbs01.dbf'


SQL> shutdown abort
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

[oracle@edgzrip1-PROD1 PROD1]$ vi /tmp/initPROD1.ora   --添加如下一行

 *._CORRUPTED_ROLLBACK_SEGMENTS=(_SYSSMU10_2490256178$,_SYSSMU9_3593450615$,  _SYSSMU8_1909280886$,_SYSSMU7_1924883037$,_SYSSMU6_2460248069$,_SYSSMU5_3787622316$,  _SYSSMU4_1455318006$,_SYSSMU3_2210742642$,_SYSSMU2_4228238222$,_SYSSMU1_3138885392$)

 

[oracle@edgzrip1-PROD1 PROD1]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Aug 21 23:06:00 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup pfile='/tmp/initPROD1.ora';
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 499125612 bytes
Database Buffers 343932928 bytes
Redo Buffers 5124096 bytes
Database mounted.
Database opened.
SQL> drop tablespace undotbs1 including contents and datafiles;

Tablespace dropped.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/PROD1/users01.dbf
/u01/app/oracle/oradata/PROD1/sysaux01.dbf
/u01/app/oracle/oradata/PROD1/system01.dbf
/u01/app/oracle/oradata/PROD1/example01.dbf


SQL> create undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/PROD1/undotbs01.dbf' size 100m;

Tablespace created.

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string UNDOTBS1
SQL> alter system set undo_tablespace='UNDOTBS1' scope=spfile;
alter system set undo_tablespace='UNDOTBS1' scope=spfile
*
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE is in use

 

[oracle@edgzrip1-PROD1 dbs]$ cp /tmp/initPROD1.ora .

 

SQL> create spfile from pfile;

File created.

SQL> startup force
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 499125612 bytes
Database Buffers 343932928 bytes
Redo Buffers 5124096 bytes
Database mounted.
Database opened.

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

System altered.

SQL> startup force
ORACLE instance started.

Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 499125612 bytes
Database Buffers 343932928 bytes
Redo Buffers 5124096 bytes
Database mounted.
Database opened.
SQL>

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!