在Linux下删掉了数据文件,恢复数据库

在Linux下删掉了数据文件,恢复数据库

物理删除了数据文件,导致数据库开启报错
ERROR at line 1:
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: ‘/home/oracletest/test41/soe41.dbf’

解决方案

如果表空间中还有其他数据文件能正常使用,这时我们就将损坏的数据文件脱机
SYS@ORCL>alter database datafile 5 offline drop; 5就是上面的data file 5
Database altered.
将损坏的数据文件脱机后,就不会在影响数据库的打开了,现在打开数据库
SYS@ORCL>alter database open;
Database altered.
SYS@ORCL>select ts#,file#,name from v$datafile;

TS# FILE# NAME
——————————————
0 1 /u01/app/oracle/oradata/ORCL/system01.dbf
1 2 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
2 3 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
4 4 /u01/app/oracle/oradata/ORCL/users01.dbf
6 5 /u01/app/oracle/oradata/ORCL/example01.dbf
8 6 /u01/app/oracle/oradata/ORCL/tyger01.dbf

6 rows selected.

SYS@ORCL>select tablespace_name,status from dba_tablespaces;

TABLESPACE_NAME STATUS


SYSTEM ONLINE
UNDOTBS1 ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
SOE411 ONLINE

7 rows selected.

SYS@ORCL>drop tablespace SOE411 including contents and datafiles
Tablespace dropped.

SYS@ORCL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@ORCL>startup
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 130025040 bytes
Database Buffers 150994944 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

京天不下雨

thanks

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值