Categories
Database

How to Fix Oracle Shutdown Immediate Command Failing to Close the Database?

Home » Database » How to Fix Oracle Shutdown Immediate Command Failing to Close the Database?

Background

When attempting to close the database on a test server using the shutdown immediate command, the process can sometimes take an excessively long time without completing. The situation appears as follows:

   1: [oracle@DB-Server admin]$ sqlplus / as sysdba
   2:  
   3: SQL*Plus: Release 10.2.0.4.0 - Production on Thu Nov 21 13:55:13 2013
   4:  
   5: Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
   6:  
   7:  
   8: Connected to:
   9: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
  10: With the Partitioning, OLAP, Data Mining and Real Application Testing options
  11:  
  12: SQL> shutdown immediate;

In another session, checking the alert log output reveals the following results: After displaying the message “Active processes prevent shutdown operation,” there are no further updates in the log.

   1: [oracle@DB-Server bdump]$ tail -f 20 alert_epps.log
   2:  
   3: Thu Nov 21 13:55:23 2013
   4: Starting background process EMN0
   5: Shutting down instance: further logons disabled
   6: EMN0 started with pid=59, OS id=19244
   7: Thu Nov 21 13:55:24 2013
   8: Errors in file /u01/app/oracle/admin/epps/udump/epps_ora_19242.trc:
   9: ORA-04098: trigger 'ADMIN.PIND_ON_SHUT' is invalid and failed re-validation
  10: Thu Nov 21 13:55:24 2013
  11: Shutting down instance (immediate)
  12: License high water mark = 10
  13: All dispatchers and shared servers shutdown
  14: Thu Nov 21 14:00:29 2013
  15: SHUTDOWN: Active processes prevent shutdown operation

The immediate shutdown method allows you to close the database in the shortest possible time. If you encounter a situation where the shutdown immediate command fails to close the database in a timely manner, you can resolve it using one of the following three methods.

Solution 1: Use commands to kill Oracle processes in the system

[oracle@DB-Server ~]$ ps -ef|grep ora|grep -v grep|grep -v ora_|grep LOCAL=NO|awk '{print $2}'
[oracle@DB-Server ~]$ ps -ef|grep ora|grep -v grep|grep -v ora_|grep LOCAL=NO|awk '{print $2}'|xargs kill

Solution 2: Use CTRL+C to Cancel the Operation

Simply use CTRL+C to cancel the operation, and then you can use the shutdown abort command to close the database. However, in a production environment, the shutdown abort command should be used with caution and only as a last resort. This is because:

1. After executing shutdown abort, all currently running SQL statements will be immediately terminated.

2. Any uncommitted transactions will not be rolled back.

3. Oracle will not wait for users currently connected to the database to exit the system.

4. The next time the database is started, instance recovery will be required, which might take longer than usual.

Solution 3: Use a Script to Check and Kill Processes

1. First, stop the application services.

2. Next, stop the listener service.

3. After a short interval, run a custom script to check for any remaining user processes, and if found, kill them.

4. Execute shutdown immediate command.

Of course, sometimes the actual situation may differ. For example, in step 1, the DBA may not have permission to stop the application server. This does not hinder the execution of the subsequent steps.

By Jaxon Tisdale

I am Jaxon Tisdale. I will share you with my experience in Network, AWS, and databases.

Leave a Reply

Your email address will not be published. Required fields are marked *