When does an instance recovery occur? When your database server is powered down abnormally, an instance recovery occurs when you restart the database. Instance recovery is done automatically by the database without the intervention of the DBA. Of course, there is a prerequisite: Data files, online log files, control files must not be corrupted.
We use the experiment to analyze the whole process of instance recovery!
1. Before shutting down the database, let's take a look at the SCN of several checkpoints.
Sql> select checkpoint_change# from V$database;
checkpoint_change#
------------------
1455180
--The database checkpoint maintained in the control file the SCN number is actually the smallest checkpoint in all data file heads SCN
Sql> select file#,checkpoint_change# from V$datafile;
file# checkpoint_change#
---------- ------------------
1 1455180
2 1455180
3 1455180
4 1455180
5 1455180
6 1455180
--Control the data file saved in the checkpoint SCN: When a checkpoint action is complete, Oracle stores the SCN of each data file separately in the control file
Sql> select file#,checkpoint_change# from V$datafile_header;
file# checkpoint_change#
---------- ------------------
1 1455180
2 1455180
3 1455180
4 1455180
5 1455180
6 1455180
--Checkpoint SCN in file header of each data file
The SCN of these three checkpoints is consistent, followed by an abnormal power outage, restarting the machine.
2, this command can simulate abnormal power
sql> shutdown abort;
ORACLE instance shut down.
3. Monitor Alarm Log
[Oracle@guoyj trace]$ tail-f Alert_bxocp.log
Starting background Process VKRM
Tue Dec 11 22:54:41 2012
VKRM started with pid=24, OS id=12500
Tue Dec 11 22:58:11 2012
Shutting down instance (abort)
License High Water mark = 3
USER (ospid:12479): terminating the instance
Instance terminated by USER, PID = 12479
Tue Dec 11 22:58:12 2012
Instance shutdown complete