7.You have issued a SHUTDOWN ABORT command to bring down your database instance. Consider
the steps that will be performed later when you open the database:
1: SGA is allocated.
2: Control file is read.
3: Redo log files are read.
4: Instance recovery is started.
5: Background processes are started.
6: Data files are checked for consistency.
7: Server parameter file or the initialization parameter file is read.
Which option has the correct order in which these steps occur?
A.7, 1, 5, 2, 3, 6, 4
B.1, 2, 3,7, 5, 6, 4
C.7, 1, 4, 5, 2, 3, 6
D.1, 7, 5, 4, 2, 3, 6
答案:A
解析:
一、启动过程
1.实例启动也就是nomount状态
首先要读取spfile或者pfile,然后分配内存结构也就是SGA,然后启动后台进程并且打开报警文件和trace文件
2.数据库启动也就是mount状态
读取参数文件中控制文件的位置,锁定并且读取控制文件,找到对应的数据文件,redo文件,但是不检查他们是否存在
3.实例与数据库关联(open)
打开联机数据文件和redo
二、验证过程如下
1.验证是否读取过spfile
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:00 spfilewahaha3.ora
SQL> ! date
Tue Jul 12 22:07:41 CST 2016
SQL> startup nomount;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:07 spfilewahaha3.ora
SQL> !date
Tue Jul 12 22:09:00 CST 2016
SQL> alter database mount;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:09 spfilewahaha3.ora
SQL> alter database open;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:09 spfilewahaha3.ora
--nomount和mount都读取过
2.查看后台进程在什么时候启动的
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2232920 bytes
Variable Size 562040232 bytes
Database Buffers 264241152 bytes
Redo Buffers 2416640 bytes
SQL> ! ps -ef | grep ora_
oracle 6077 1 0 22:35 ? 00:00:00 ora_pmon_wahaha3
oracle 6079 1 0 22:35 ? 00:00:00 ora_psp0_wahaha3
oracle 6081 1 2 22:35 ? 00:00:00 ora_vktm_wahaha3
oracle 6085 1 0 22:35 ? 00:00:00 ora_gen0_wahaha3
oracle 6087 1 0 22:35 ? 00:00:00 ora_diag_wahaha3
oracle 6089 1 0 22:35 ? 00:00:00 ora_dbrm_wahaha3
oracle 6091 1 0 22:35 ? 00:00:00 ora_dia0_wahaha3
oracle 6093 1 1 22:35 ? 00:00:00 ora_mman_wahaha3
oracle 6095 1 0 22:35 ? 00:00:00 ora_dbw0_wahaha3
oracle 6097 1 0 22:35 ? 00:00:00 ora_lgwr_wahaha3
oracle 6099 1 0 22:35 ? 00:00:00 ora_ckpt_wahaha3
oracle 6101 1 0 22:35 ? 00:00:00 ora_smon_wahaha3
oracle 6103 1 0 22:35 ? 00:00:00 ora_reco_wahaha3
oracle 6105 1 0 22:35 ? 00:00:00 ora_mmon_wahaha3
oracle 6107 1 0 22:35 ? 00:00:00 ora_mmnl_wahaha3
oracle 6109 1 0 22:35 ? 00:00:00 ora_d000_wahaha3
oracle 6111 1 0 22:35 ? 00:00:00 ora_s000_wahaha3
--说明后台进程nomount就启动了
3.验证sga分配情况
SQL> select COMPONENT,current_size from v$sga_dynamic_components;
COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
shared pool 209715200
large pool 4194304
java pool 4194304
streams pool 8388608
DEFAULT buffer cache 264241152
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
DEFAULT 32K buffer cache 0
Shared IO Pool 0
ASM Buffer Cache 0
--说明nomount就分配了
4.查看控制文件读取
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:34 /home/oracle/control01.ctl1
SQL> startup nomount;
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:34 /home/oracle/control01.ctl1
SQL> alter database mount;
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:41 /home/oracle/control01.ctl1
--说明在mount阶段读取了控制文件
5.查看redo文件在哪个阶段
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> !date
Tue Jul 12 22:45:35 CST 2016
SQL> startup nomount;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> alter database mount;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> alter database open;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo06.log
--说明:在open阶段读取了redo
6.查看redo文件和数据文件在mount的时候会不会检查
[oracle@wahaha3 wahaha3]$ mkdir www --将数据文件和redo文件全部挪走
[oracle@wahaha3 wahaha3]$ mv *.* www
[oracle@wahaha3 wahaha3]$ sqlplus / as sysdba
SQL> startup nomount;
SQL> alter database mount;
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/oracle/oradata/wahaha3/system01.dbf'
--说明,monut阶段是不会进行校验文件的
7.由于使用了shutdown abort关闭数据库,所以很可能需要恢复数据
恢复使用的时smon进程
the steps that will be performed later when you open the database:
1: SGA is allocated.
2: Control file is read.
3: Redo log files are read.
4: Instance recovery is started.
5: Background processes are started.
6: Data files are checked for consistency.
7: Server parameter file or the initialization parameter file is read.
Which option has the correct order in which these steps occur?
A.7, 1, 5, 2, 3, 6, 4
B.1, 2, 3,7, 5, 6, 4
C.7, 1, 4, 5, 2, 3, 6
D.1, 7, 5, 4, 2, 3, 6
答案:A
解析:
一、启动过程
1.实例启动也就是nomount状态
首先要读取spfile或者pfile,然后分配内存结构也就是SGA,然后启动后台进程并且打开报警文件和trace文件
2.数据库启动也就是mount状态
读取参数文件中控制文件的位置,锁定并且读取控制文件,找到对应的数据文件,redo文件,但是不检查他们是否存在
3.实例与数据库关联(open)
打开联机数据文件和redo
二、验证过程如下
1.验证是否读取过spfile
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:00 spfilewahaha3.ora
SQL> ! date
Tue Jul 12 22:07:41 CST 2016
SQL> startup nomount;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:07 spfilewahaha3.ora
SQL> !date
Tue Jul 12 22:09:00 CST 2016
SQL> alter database mount;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:09 spfilewahaha3.ora
SQL> alter database open;
SQL> ! ls -l --time=atime spfilewahaha3.ora
-rw-r-----. 1 oracle oinstall 2560 Jul 12 22:09 spfilewahaha3.ora
--nomount和mount都读取过
2.查看后台进程在什么时候启动的
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2232920 bytes
Variable Size 562040232 bytes
Database Buffers 264241152 bytes
Redo Buffers 2416640 bytes
SQL> ! ps -ef | grep ora_
oracle 6077 1 0 22:35 ? 00:00:00 ora_pmon_wahaha3
oracle 6079 1 0 22:35 ? 00:00:00 ora_psp0_wahaha3
oracle 6081 1 2 22:35 ? 00:00:00 ora_vktm_wahaha3
oracle 6085 1 0 22:35 ? 00:00:00 ora_gen0_wahaha3
oracle 6087 1 0 22:35 ? 00:00:00 ora_diag_wahaha3
oracle 6089 1 0 22:35 ? 00:00:00 ora_dbrm_wahaha3
oracle 6091 1 0 22:35 ? 00:00:00 ora_dia0_wahaha3
oracle 6093 1 1 22:35 ? 00:00:00 ora_mman_wahaha3
oracle 6095 1 0 22:35 ? 00:00:00 ora_dbw0_wahaha3
oracle 6097 1 0 22:35 ? 00:00:00 ora_lgwr_wahaha3
oracle 6099 1 0 22:35 ? 00:00:00 ora_ckpt_wahaha3
oracle 6101 1 0 22:35 ? 00:00:00 ora_smon_wahaha3
oracle 6103 1 0 22:35 ? 00:00:00 ora_reco_wahaha3
oracle 6105 1 0 22:35 ? 00:00:00 ora_mmon_wahaha3
oracle 6107 1 0 22:35 ? 00:00:00 ora_mmnl_wahaha3
oracle 6109 1 0 22:35 ? 00:00:00 ora_d000_wahaha3
oracle 6111 1 0 22:35 ? 00:00:00 ora_s000_wahaha3
--说明后台进程nomount就启动了
3.验证sga分配情况
SQL> select COMPONENT,current_size from v$sga_dynamic_components;
COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
shared pool 209715200
large pool 4194304
java pool 4194304
streams pool 8388608
DEFAULT buffer cache 264241152
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
DEFAULT 32K buffer cache 0
Shared IO Pool 0
ASM Buffer Cache 0
--说明nomount就分配了
4.查看控制文件读取
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:34 /home/oracle/control01.ctl1
SQL> startup nomount;
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:34 /home/oracle/control01.ctl1
SQL> alter database mount;
SQL> ! ls -l --time=atime /home/oracle/control01.ctl1
-rw-r-----. 1 oracle oinstall 9912320 Jul 12 22:41 /home/oracle/control01.ctl1
--说明在mount阶段读取了控制文件
5.查看redo文件在哪个阶段
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> !date
Tue Jul 12 22:45:35 CST 2016
SQL> startup nomount;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> alter database mount;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:34 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:22 /u01/oracle/oradata/wahaha3/redo06.log
SQL> alter database open;
SQL> !ls -l --time=atime /u01/oracle/oradata/wahaha3/redo*log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo01.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo02.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo03.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo04.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo05a.log
-rw-r-----. 1 oracle oinstall 52429312 Jul 12 22:46 /u01/oracle/oradata/wahaha3/redo06.log
--说明:在open阶段读取了redo
6.查看redo文件和数据文件在mount的时候会不会检查
[oracle@wahaha3 wahaha3]$ mkdir www --将数据文件和redo文件全部挪走
[oracle@wahaha3 wahaha3]$ mv *.* www
[oracle@wahaha3 wahaha3]$ sqlplus / as sysdba
SQL> startup nomount;
SQL> alter database mount;
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/oracle/oradata/wahaha3/system01.dbf'
--说明,monut阶段是不会进行校验文件的
7.由于使用了shutdown abort关闭数据库,所以很可能需要恢复数据
恢复使用的时smon进程