加入收藏 | 设为首页 | 会员中心 | 我要投稿 厦门网 (https://www.xiamenwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

undo表空间丢失、损坏

发布时间:2020-12-30 18:22:02 所属栏目:站长百科 来源:网络整理
导读: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

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

?

[[email?protected] 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$)

?

[[email?protected] 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

?

SQL> shutdown immedaite
SP2-0717: illegal SHUTDOWN option
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

?

[[email?protected] 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 bytesFixed Size 1348244 bytesVariable Size 499125612 bytesDatabase Buffers 343932928 bytesRedo Buffers 5124096 bytesDatabase mounted.Database opened.SQL>

(编辑:厦门网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读