数据库启动时丢失数据文件模拟实验
1.查询数据库状态,MOUNTED SYS@ bys001>select status,startup_time from v$instance; STATUS STARTUP_TIME ------------ ------------------- MOUNTED 2013/07/16 16:54:36 2.重命令一个数据文件,模拟文件丢失。 SYS@ bys001>host [oracle@oel-01 oradata]$ cd bys001/ [oracle@oel-01 bys001]$ ls bys_flashback.dbf redo01.log test1.dbf catalog1.dbf redo02.log test1_undo.dbf control01.ctl redo03.log undotbs01.dbf example01.dbf sysaux01.dbf users01.dbf redo01a.log system01.dbf users01.dbf2 redo01a.logbak temp01.dbf [oracle@oel-01 bys001]$ mv users01.dbf users01.dbf.bak [oracle@oel-01 bys001]$ ls bys_flashback.dbf redo01.log temp01.dbf catalog1.dbf redo02.log test1.dbf control01.ctl redo03.log test1_undo.dbf example01.dbf sysaux01.dbf undotbs01.dbf redo01a.log system01.dbf users01.dbf.bak 查看日志: [oracle@oel-01 ~]$ cat alert_bys001.log alter database mount Tue Jul 16 21:58:24 2013 Successful mount of redo thread 1, with mount id 2045113404 Allocated 3981204 bytes in shared pool for flashback generation buffer Starting background process RVWR Tue Jul 16 21:58:24 2013 RVWR started with pid=20, OS id=4553 Database mounted in Exclusive Mode Lost write protection disabled Completed: alter database mount Tue Jul 16 22:08:53 2013 Checker run found 1 new persistent data failures ---系统发现了,运行检查发现1个新的持久性数据失败 with mount id 2045113404 mount id 在正常MOUNT数据库过程中,数据库计算MOUNT ID并记录在 控制文件中,然后开始启动心跳heartbeat,每3秒更新一次控制文件。 heartbeat表示实例已经被特定例程MOUNT,此属性主要用于RAC环境。在单实例环境中同样存在。 使用ASM时,还会增加一个ASM实例的心跳事件。 SYS@ bys001>select event#,name from v$event_name where name like '%heart%'; EVENT# NAME ---------- ---------------------------------------- 75 heartbeat monitor sleep 380 ASM mount : wait for heartbeat 563 control file heartbeat SYS@ bys001>select name from v$datafile; NAME ---------------------------------------- /u01/app/oracle/oradata/bys001/system01.dbf /u01/app/oracle/oradata/bys001/sysaux01.dbf /u01/app/oracle/oradata/bys001/undotbs01.dbf /u01/app/oracle/oradata/bys001/users01.dbf /u01/app/oracle/oradata/bys001/example01.dbf /u01/app/oracle/oradata/bys001/catalog1.dbf /u01/app/oracle/oradata/bys001/test1.dbf /u01/app/oracle/oradata/bys001/bys_flashback.dbf 8 rows selected. 3.打开数据库,提示找不到数据文件。 SYS@ bys001>alter database open; alter database open * ERROR at line 1: ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/bys001/users01.dbf' 日志中的信息: Tue Jul 16 22:11:18 2013 alter database open Tue Jul 16 22:11:18 2013 Errors in file /u01/app/oracle/diag/rdbms/bys001/bys001/trace/bys001_dbw0_3837.trc: ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/bys001/users01.dbf' ORA-27037: unable to obtain file status Linux Error: 2: No such file or directory Additional information: 3 Errors in file /u01/app/oracle/diag/rdbms/bys001/bys001/trace/bys001_ora_4540.trc: ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/bys001/users01.dbf' ORA-1157 signalled during: alter database open... [oracle@oel-01 ~]$ SYS@ bys001>select status from v$instance; S