CASE1:
测试场insert 操作时报错。
ORA-01110: data file 4: '/home/XXX/data/XXX_01.dbf'
。先查看了下DB状态,是OPEN。DF,看空间大小,也没满。从dba_data_files中找出这个DBF对应的TABLESPACE,去dba_tablespaces中看了下它的状态。为READ ONLY!
有点慌。。快速查看了所有的表空间哪些是READ ONLY的。有140个!
跑个脚本改过来。
set head off pages 0 lines 200 feedback off
SPOOL alter_tablespaces.sql
select 'ALTER TABLESPACE ' || tablespace_name || ' READ WRITE;'
from dba_tablespaces
where status='READ ONLY';
SPOOL off
@alter_tablespaces
------------------------------
SQL> shutdown immediate;
ORA-01116: error in opening database file 8
ORA-01110: data file 8: '/home/oracle/ad_test/t1.dbf'
ORA-27041: unable to open file
SQL> SELECT name, error FROM v$datafile JOIN v$recover_file USING (file#);
NAME
--------------------------------------------------------------------------------
ERROR
-----------------------------------------------------------------
/home/oracle/ad_test/t1.dbf
FILE NOT FOUND
alter database datafile 8 offline drop;
SQL> alter database datafile 8 offline drop;
Database altered.
SQL> startup force
ORACLE instance started.
Total System Global Area 2672361472 bytes
Fixed Size 2256232 bytes
Variable Size 1392509592 bytes
Database Buffers 1258291200 bytes
Redo Buffers 19304448 bytes
Database mounted.
Database opened.
CASE2:
删除了一个DBFILE。
然后出错, 使用RMAN
Total System Global Area 2672361472 bytes
Fixed Size 2256232 bytes
Variable Size 1392509592 bytes
Database Buffers 1258291200 bytes
Redo Buffers 19304448 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/home/oracle/adam/audit_tbs01.dbf'
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 8 20:55:40 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: AD_TEST (DBID=846030938, not open)
RMAN> list failure;
using target database control file instead of recovery catalog
List of Database Failures
=========================
Failure ID Priority Status Time Detected Summary
---------- -------- --------- -------------------- -------
26422 HIGH OPEN Mar-14-2014:14:59:24 One or more non-system datafiles are missing
26502 HIGH OPEN Mar-20-2014:20:39:09 One or more non-system datafiles are offline
Database altered.