oracle undo数据文件坏,oracle中undo表空间丢失处理方法

oracle中undo表空间丢失处理方法

2020-09-03 11:33:48

当undo表空间数据文件丢失或损坏时,我们数据库在有事务提交等操作时,就会报错误

SQL> conn scott/scott;

ERROR:

ORA-02002: error while writing to audit trail

ORA-00604:

当undo表空间数据文件丢失或损坏时,我们数据库在有事务提交等操作时,就会报错误

SQL> conn scott/scott;

ERROR:

ORA-02002: error while writing to audit trail

ORA-00604: error occurred at recursive SQL level 1

ORA-01116: error in opening database file 3

ORA-01110: data file 3: '/u01/oracle/oradata/orcl11g/undotbs01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Warning: You are no longer connected to ORACLE.

SQL>

这里,我们需要把数据库的undo管理改成手工管理,并关闭数据库

alter system set undo_management=manual scope=spfile;

关闭数据库

shutdown immediate    如果关不了,则强制进行关闭shutdown abort

SQL> shutdown immediate;

ORA-01116: error in opening database file 3

ORA-01110: data file 3: '/u01/oracle/oradata/orcl11g/undotbs01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

SQL> shutdown abort;

ORACLE instance shut down.

SQL>

打开数据库,并把数据文件脱机并删除;

SQL> startup;

ORACLE instance started.

Total System Global Area  952020992 bytes

Fixed Size                  2258960 bytes

Variable Size             310380528 bytes

Database Buffers          633339904 bytes

Redo Buffers                6041600 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 3 - see DBWR trace file

ORA-01110: data file 3: '/u01/oracle/oradata/orcl11g/undotbs01.dbf'

SQL> alter database datafile 3 offline drop;

Database altered.

SQL>

打开数据库

SQL> alter database open;

Database altered.

SQL>

然后删除表空间,并重新创建

SQL> drop tablespace undotbs1;

Tablespace dropped.

SQL> create undo tablespace undotbs1 datafile '/u01/oracle/oradata/orcl11g/undotbs01.dbf' size 100m autoextend on;

Tablespace created.

SQL>

修改表空间为自动管理,并重启数据库

SQL> alter system set undo_management=auto scope=spfile;

System altered.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup;

ORACLE instance started.

Total System Global Area  952020992 bytes

Fixed Size                  2258960 bytes

Variable Size             310380528 bytes

Database Buffers          633339904 bytes

Redo Buffers                6041600 bytes

Database mounted.

Database opened.

SQL>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值