In real life, there is an abnormal shutdown of Oracle due to sudden power failure. This situation is likely to cause the production database to fail to start normally. This is the need to restart the database instance. Now record the situation encountered this time As follows, please forgive me for any deficiencies!
Remember the restart process of the database instance:
When using the database tool to connect to the database, it prompts ora-12514, ora-12560. The recovery process is as follows:
1. View monitoring:
Open the command window and enter LSNRCTL. The result shows that lsnrctl is not an internal or external command (if it can run normally, please skip to 1.2);
at this time, you need to set environment variables.
1.1, add the database bin directory to the environment variable
1.1.1. Open "Computer" -> "Properties" -> "Advanced System Settings"
1.1.2. Open environment variables, find Path, click Edit to add the Oracle bin directory to Path [ The path must be placed in the customer If you are not sure about the path of the client, you can put this path in the first place .]
1.2, continue to execute LSNRCTL
Enter lsnrctl in the command window, enter the lsnrctl window, continue to enter status, the results are shown as follows:
as shown in the figure, which is not used for the instance name that was used before, so instance recovery is required.
2. Instance recovery
2.1. Open the command window and enter the following command
sqlplus / as sysdba --以dba管理员登陆数据库
If you do not set the Path according to 1.1.2, an ora-12560 error message will appear here;
2.2. View instance status
select status from v$instance;
2.3, need to restart the database instance
startup
If "ORACLE routine has been started" appears, it means that the database instance has been started and the database can be used normally;
if it still reports an error, you need to use the pfile file for instance recovery, and you need to continue the following operations
2.4. Shutdown routine [transactions that did not end normally when the database is closed abnormally]
shutdown abort
The results are as follows:
2.5, use the pfile file to start the instance
The pfile file is generally in the folder where the instance is located, mine is in the following path
startup pfile=D:\app\Administrator\admin\ORCL\pfile\init.ora.092019111349 force
The result is as follows:
The database instance has been restored at this time.
3. Recheck the monitoring status
Re-enter LSNRCTL and execute status. The result is as follows:
This means that the database instance and the corresponding monitor have been loaded and can be used normally.