ALLSTARS_ORACLE 发表于 2017-4-14 16:09:01

在一次重建控制文件后,发现无故丢失了数据文件


在一次重建控制文件后,发现无故丢失了数据文件

环境: redhat 5.5 64  ,10.2.0.4 单机 ,归档模式

我在一次实验中,发现重建控制文件后,丢失了一下数据文件,这是什么原因呢?

过程:

SQL> col name for a40
SQL> select * from v$dbfile order by 1;
  
     FILE# NAME
---------- ----------------------------------------
         1 /u01/oracle/oradata/orcl/system01.dbf
         2 /u01/oracle/oradata/orcl/undotbs01.dbf
         3 /u01/oracle/oradata/orcl/sysaux01.dbf
         4 /u01/oracle/oradata/orcl/users01.dbf
         5 /u01/oracle/product/10.2.0/db_1/dbs/MISS
           ING00005
         6 /u01/oracle/oradata/orcl/rman/rman_ts.db
           f
         7 /u01/oracle/oradata/orcl/tbs16k.dbf
7 rows selected.


--需要重建控制文件,删除不存在的数据文件

SQL> alter database backup controlfile to trace;
Database altered.
  
SQL> shutdown immediate

SQL> startup nomount

选择 noresetlog 的那段:

CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/oracle/oradata/orcl/redo01.log'  SIZE 50M,
  GROUP 2 '/u01/oracle/oradata/orcl/redo02.log'  SIZE 50M,
  GROUP 3 '/u01/oracle/oradata/orcl/redo03.log'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  '/u01/oracle/oradata/orcl/system01.dbf',
  '/u01/oracle/oradata/orcl/undotbs01.dbf',
  '/u01/oracle/oradata/orcl/sysaux01.dbf',
  '/u01/oracle/oradata/orcl/users01.dbf',
  '/u01/oracle/product/10.2.0/db_1/dbs/MISSING00005', ---- 这一行要去掉
  '/u01/oracle/oradata/orcl/rman/rman_ts.dbf',
  '/u01/oracle/oradata/orcl/tbs16k.dbf'
CHARACTER SET ZHS16GBK
;

SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 16
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 100
  5      MAXINSTANCES 8
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 '/u01/oracle/oradata/orcl/redo01.log'  SIZE 50M,
  9    GROUP 2 '/u01/oracle/oradata/orcl/redo02.log'  SIZE 50M,
10    GROUP 3 '/u01/oracle/oradata/orcl/redo03.log'  SIZE 50M
11  -- STANDBY LOGFILE
12  DATAFILE
13    '/u01/oracle/oradata/orcl/system01.dbf',
14    '/u01/oracle/oradata/orcl/undotbs01.dbf',
15    '/u01/oracle/oradata/orcl/sysaux01.dbf',
16    '/u01/oracle/oradata/orcl/users01.dbf',
17    '/u01/oracle/oradata/orcl/rman/rman_ts.dbf',
18    '/u01/oracle/oradata/orcl/tbs16k.dbf'
19  CHARACTER SET ZHS16GBK
20  ;
Control file created.


  
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/u01/oracle/oradata/orcl/rman/rman_ts.dbf'

SQL> recover datafile 6;
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 7 needs media recovery
ORA-01110: data file 7: '/u01/oracle/oradata/orcl/tbs16k.dbf'

SQL> recover datafile 7;
Media recovery complete.

SQL> alter database open;
Database altered.

SQL> col name for a40
SQL> select * from v$dbfile order by 1;
     FILE# NAME
---------- ----------------------------------------
         1 /u01/oracle/oradata/orcl/system01.dbf
         2 /u01/oracle/oradata/orcl/undotbs01.dbf
         3 /u01/oracle/oradata/orcl/sysaux01.dbf
         4 /u01/oracle/oradata/orcl/users01.dbf


SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/orcl/users01.dbf
/u01/oracle/oradata/orcl/sysaux01.dbf
/u01/oracle/oradata/orcl/undotbs01.dbf
/u01/oracle/oradata/orcl/system01.dbf

SQL>  select file#,STATUS$,TS#,RELFILE# from file$ order by 1;
     FILE#    STATUS$        TS#   RELFILE#
---------- ---------- ---------- ----------
         1          2          0          1
         2          2          1          2
         3          2          2          3
         4          2          4          4
         6          2          7          6
         7          2          8          7
6 rows selected.

我的初衷只是想删除  '/u01/oracle/product/10.2.0/db_1/dbs/MISSING00005', 这个数据文件,
结果发现
  '/u01/oracle/oradata/orcl/rman/rman_ts.dbf',
  '/u01/oracle/oradata/orcl/tbs16k.dbf'
这两个数据文件也不见了。


SQL> select file_name,status from dba_data_files;

FILE_NAME                                STATUS
---------------------------------------- ---------
/u01/oracle/oradata/orcl/tbs_test.dbf    AVAILABLE
/u01/oracle/oradata/orcl/users01.dbf     AVAILABLE
/u01/oracle/oradata/orcl/sysaux01.dbf    AVAILABLE
/u01/oracle/oradata/orcl/undotbs01.dbf   AVAILABLE
/u01/oracle/oradata/orcl/system01.dbf    AVAILABLE
看不到 整两个文件


页: [1]
查看完整版本: 在一次重建控制文件后,发现无故丢失了数据文件