[原]重建控制文件后某些文件被命名为MISSINGnnnnn
在复习OCP的过程中看到一题:
The loss of the control file forced you to re-create the control file . After re-creating it nad opening the database , you find that some of the data files are named as MISSINGnnnnn , where nnnnn is a five-digit number starting with 0 . What could be the possible reason ? A. These are the data files that are corrupted . B. There is no SYSAUX tablespace in your database . C. There is read-only tablespace in your database . D. These are the data files that cannot be recovered . Answer : C
不太明白为什么 read-only tablespace 会有这种表现,后来一顿搜索终于找到原因了。
Read-only files should not be listed in the CREATE CONTROLFILE statement so that recovery can skip these files. No recovery is required for read-only datafiles unless you restored backups of these files from a time when the datafiles were read/write. After you create a new control file and attempt to mount and open the database, the database performs a data dictionary check against the files listed in the control file. For each file that is not listed in the CREATE CONTROLFILE statement but is present in the data dictionary, an entry is created for them in the control file. These files are named as MISSINGnnnnn, where nnnnn is a five digit number starting with 0. After the database is open, rename the read-only files to their correct filenames by executing the ALTER DATABASE RENAME FILE statement for all the files whose name is prefixed with MISSING. All the restrictions related to read-only files in CREATE CONTROLFILE statements also apply to offline normal tablespaces, except that you need to bring the tablespace online after the database is open. You should leave out tempfiles from the CREATE CONTROLFILE statement and add them after database open.
只读文件是不记录在Create ControlFile 这个“救命”语句里面的,原因是没有必要对这些文件进行恢复操作,但是,数据字典里面是有这些read-only表空间的记录的,当用一个新的control file打开数据库的时候,Oracle 会检查新 control file 中的文件列表和数据字典里面的文件列表对比,结果在新 control file 中找不到,于是就会将这些文件命名为 MISSINGnnnnn (n是数字,以0为开头)。
我做了一下对比,用 alter database backup controlfile to trace ,来查看
第一张图:左边的 dcb_data 这个表空间是 read write 模式,右边是设为 read only 模式:
第二张图:左边的 dcb_data 这个表空间是 offline ,右边是设为 read only 模式: