Normally, you use the SHUTDOWN IMMEDIATE statement to stop a Oracle database 12C. The IMMEDIATE parameter instructs Oracle to halt database activity and roll back any open transactions, for example:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
Table 1 provides a detailed definition of the parameters available with the SHUTDOWN statement. In most cases, SHUTDOWN IMMEDIATE is an acceptable method of shutting down your Oracle database 12C. If you issue the SHUTDOWN command with no parameters, it’s equivalent to issuing SHUTDOWN NORMAL.
Table 1. Parameters Available with the SHUTDOWN Command
Parameter | Meaning |
---|---|
NORMAL | Wait for users to log out of active sessions before shutting down. |
TRANSACTIONAL | Wait for transactions to finish, and then terminate the session. |
TRANSACTIONAL LOCAL | Perform a transactional shutdown for local instance only. |
IMMEDIATE | Terminate active sessions immediately. Open transactions are rolled back. |
ABORT | Terminate the instance immediately. Transactions are terminated and aren’t rolled back. |
You should rarely need to use the SHUTDOWN ABORT statement. Usually, SHUTDOWN IMMEDIATE is sufficient. Having said that, there is nothing wrong with using SHUTDOWN ABORT. If SHUTDOWN IMMEDIATE isn’t working for any reason, then use SHUTDOWN ABORT.
Note Stopping and restarting your database in quick succession is known colloquially as “bouncing the database.”
Starting and stopping your database is a fairly simple process. If the environment is set up correctly, you should be able to connect to your database as a privileged user, and issue the appropriate startup and shutdown statements.
STARTUP FORCE
Sometimes in development environments, I’ll quickly want to stop and start my Oracle database 12C. For example, I might want to do this because I’ve modified an initialization parameter that requires a database restart. You can stop/start your database with one command:
SQL> startup force;
If your instance is currently running, the STARTUP FORCE command will shut down the instance (abort mode) and restart it. This behavior may not be what you want in a production environment, but for test/development databases, this is usually fine.