查询表报错表空间问题
SQL> select count(*) from test.tab;
select count(*) from test.tab
ERROR at line 1:
ORA-00376: file 415 cannot be read at this time
ORA-01110: data file 415: '/var/test/xxx_0154.dbf'
检查表空间状态recover
select file#,name,status from v$datafile where status!='ONLINE' and status!='SYSTEM';
FILE# NAME STATUS
---------- -------------------------------------------------- -------
55 /var/test/tablesapce0.dbf RECOVER
56 /var/test/tablesapce1.dbf RECOVER
57 /var/test/tablesapce3.dbf RECOVER
58 /var/test/tablesapce4.dbf RECOVER
查询数据库日志,发现drop表空间操作
DROP TABLESPACE "xxx"
ORA-1549 signalled during: DROP TABLESPACE "xxx"...
ALTER TABLESPACE "xxx" OFFLINE IMMEDIATE
检查数据库归档情况
archive log list;
若恢复文件较多,拼接sql,进行恢复
select file#||',' from v$datafile where status='RECOVER' ;
recover datafile 1,2 ;
恢复后的数据文件会是offline状态,需要手动online,拼接sql将恢复后的数据文件online;
select 'alter database datafile '||file#||' online ;' from v$datafile where status='OFFLINE' ;
查询报错数据文件状态,发现enabled 状态为disabled,正常状态应为READ WRITE
select file#,name,status from v$datafile where ENABLED='DISABLED';
手动将表空间online后恢复
alter tablespace xxx online;
标签:误删除,status,datafile,dbf,test,大哥,file,整理,select From: https://blog.51cto.com/u_16082244/7862059