Oracle DBA, How To, Error, Cause and Action

Showing posts with label Closed. Show all posts
Showing posts with label Closed. Show all posts

Oracle Database Shutdown Process (4/4)

Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4) [You are here]


SHUTDOWN ABORT

This is very nasty way of shutdown Oracle, you should not perform SHUTDOWN ABORT unless is necessary. What happen with SHUTDOWN ABORT is like you power off your computer without notice to anyone. Very fast way of shutdown, when you startup the system there will be database recovery needed, that is because when you startup database all the datafiles are still "open" state, you will only can close all datafiles properly with above 3 shutdowns (NORMAL, TRANSACTIONAL, IMMEDIATE).

1. Again we have active connected session




2. SHUTDOWN ABORT command is issued



As you notice SHUTDOWN ABORT command is not going through the 3 steps of shutdown sequence, it shutdown the system is fast because it skipped 2 sequences, what SHUTDOWN ABORT did was kill all process and release the SGA.

You must not perform SHUTDOWN ABORT unless is necessary.

Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4) [You are here]

Oracle Database Shutdown Process (3/4)

Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4) [You are here]
Oracle Database Shutdown Process (4/4)

SHUTDOWN IMMEDIATE

In my opinion this is
the most commonly use shutdown command. If this command is issued, Oracle will undo all active transactions, no new connection is allowed, all connected sessions will be disconnected and Oracle will start performing shutdown sequence.

1. We have connected session with active transaction.



2. When SHUTDOWN IMMEDIATE is issued, the connected session is disconnected, perform rollback (discarded) to all uncommitted changes and close database as write committed changes to datafiles and continue the rest of the sequence.



3. As result the connected session is lost connection.


The uncommitted record is discarded.


Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4) [You are here]
Oracle Database Shutdown Process (4/4)

Oracle Database Shutdown Process (2/4)

Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4) [You are here]
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4)

SHUTDOWN TRANSACTIONAL

If there are any other session is in progress of making changes (transactions), shutdown transactional will wait for sessions with active transactions to be completed before shutdown the database. After the transaction is complete the session will be disconnected. Once you issued SHUTDOWN TRANSACTIONAL there will be no new transaction is allowed.


1. There is a session that try to insert a record in to round_table

INSERT INTO round_table VALUES ('A');


The user is not performing commit (to confirm change) or rollback (to undo change)

2. Database Administrator executing SHUTDOWN TRANSACTIONAL



The SHUTDOWN TRANSACTIONAL appear to be hang, because it waited for other session to complete the active transaction.

3. The active transaction is completed the transaction by issue COMMIT command.


When the all active transaction have been finalize (can be commit or rollback) the SHUTDOWN TRANSACTIONAL will continue the shutdown sequence.

Oracle Database Shutdown Process (1/4)
Oracle Database Shutdown Process (2/4) [You are here]
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4)

Oracle Database Shutdown Process (1/4)

Oracle Database Shutdown Process (1/4) [You are here]
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4)

Oracle database shutdown process is reverse process of Oracle database startup, therefore there are three steps.

1. Close
2. Unmount
3. Shutdown instance



Close
Oracle database writes all confirm (commit, Oracle have command call commit, this mean to confirm the changes) changes that still in SGA (memory) into the datafiles so that the changes is permanent and available for next database open. The uncommited changes (transactions) will be discarded. Therefore this process can take quite long to complete if you have database configured with big SGA and you have alot of changes need to be discarded or written into datafiles.
You may ask what happen if there is power failure and I have huge amount of unsaved changes stored in my huge SGA, will my data lose?
The answer is no, don't worry about that, Oracle is having each of the changes (Oracle using SCN to uniquely identify all transaction, SCN stand for System Change Number) stored in redo log files in your disk (which will be archived if you set it correctly). With that we will able to recover everything.

Unmount
During the unmount, Oracle is disassociate all files with the processes and memory.

Shutdown instance
Oracle clear the SGA and terminate all Oracle process. After this process you will no longer have Oracle database instance process running. Well you may still have Oracle Listener process running which is that is not part of this.


There are four types of shutdown command.

SHUTDOWN NORMAL (this is default type, if you key in command SHUTDOWN without mention any other word then Oracle will perform SHUTDOWN NORMAL)

Shutdown normal, Oracle will wait for all connected user to manually logout from
Oracle session then it will start performing shutdown. So if you have other connected session this command may seems like hang but actually your SHUTDOWN command is waiting the other user to logout before performing the shutdown. Once you issue this command there will be no new login is allowed.

1. We have 1 connected session.



2. Try to perform SHUTDOWN NORMAL



Notice that Shutdown is hanging waiting for all connected sessions to logout.

3. Logout session the connected session and then shutdown sequence is continue.



Oracle Database Shutdown Process (1/4) [You are here]
Oracle Database Shutdown Process (2/4)
Oracle Database Shutdown Process (3/4)
Oracle Database Shutdown Process (4/4)