Link to home
Start Free TrialLog in
Avatar of joppi1
joppi1

asked on

How do I know if there are uncommited transactions?

Hi experts,

I'm quiet new to administering Oracle databases. I have some guys on my db running big updates on some tables. From time to time I need to shutdown the system for maintenance, but before I can do that I need to know if there are some uncommitted transactions on the db. Otherwise I would rollback all the possibly uncommited updates, which is not, what my colleagues want. And no, they don't want to use autocommit...

So how can I find out, if there are uncommited transactions?

Oracle version is 8.1.7.0.0 Enterprise Ed. on Solaris 8.

Thanks for your help.
Andreas


Avatar of hayrabedian
hayrabedian

Hi Andreas,

I think you can use one of the SHUTDOWN command's options. Shortly, they are: NORMAL, ABORT, IMMEDIATE, TRANSACTIONAL

Oracle documentation says:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Shutting Down with the NORMAL Option
Normal database shutdown proceeds with the following conditions:

No new connections are allowed after the statement is issued.

Before the database is shut down, Oracle waits for all currently connected users to disconnect from the database.

The next startup of the database will not require any instance recovery procedures.

To shut down a database in normal situations, use the SHUTDOWN command with the NORMAL option:

 SHUTDOWN NORMAL;

Shutting Down with the IMMEDIATE Option
Use immediate database shutdown only in the following situations:

A power shutdown is going to occur soon.

The database or one of its applications is functioning irregularly.

Immediate database shutdown proceeds with the following conditions:

Any uncommitted transactions are rolled back. (If long uncommitted transactions exist, this method of shutdown might not complete quickly, despite its name.)

Oracle does not wait for users currently connected to the database to disconnect; Oracle implicitly rolls back active transactions and disconnects all connected users.

The next startup of the database will not require any instance recovery procedures.

To shut down a database immediately, use the SHUTDOWN command with the IMMEDIATE option

SHUTDOWN IMMEDIATE;



--------------------------------------------------------------------------------
Note:
The SHUTDOWN IMMEDIATE statement disconnects all existing idle connections and shuts down the database. If, however, you have submitted processes (for example, inserts, selects or updates) that are awaiting results, the SHUTDOWN TRANSACTIONAL statement allows the process to complete before disconnecting.  

--------------------------------------------------------------------------------
 
 


Shutting Down with the TRANSACTIONAL Option
When you wish to perform a planned shutdown of an instance while allowing active transactions to complete first, use the SHUTDOWN command with the TRANSACTIONAL option:

SHUTDOWN TRANSACTIONAL;


After submitting this statement, no client can start a new transaction on this instance. If clients attempt to start a new transaction, they are disconnected. After all transactions have completed, any client still connected to the instance is disconnected. At this point, the instance shuts down just as it would when a SHUTDOWN IMMEDIATE statement is submitted. The next startup of the database will not require any instance recovery procedures.

A transactional shutdown prevents clients from losing work, and at the same time, does not require all users to log off.

Shutting Down with the ABORT Option
You can shut down a database instantaneously by aborting the database's instance. If possible, perform this type of shutdown only in the following situations:

The database or one of its applications is functioning irregularly and neither of the other types of shutdown works.

You need to shut down the database instantaneously (for example, if you know a power shutdown is going to occur in one minute).

You experience problems when starting a database instance.

Aborting an instance shuts down a database and yields the following results:

Current client SQL statements being processed by Oracle are immediately terminated.

Uncommitted transactions are not rolled back.

Oracle does not wait for users currently connected to the database to disconnect; Oracle implicitly disconnects all connected users.

The next startup of the database will require instance recovery procedures.

If both the normal and immediate shutdown options do not work, abort the current database instance immediately by issuing the SHUTDOWN command with the ABORT option:

SHUTDOWN ABORT;



ASKER CERTIFIED SOLUTION
Avatar of asimkovsky
asimkovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joppi1

ASKER

That's exactly the answer I need.

Since my fellows sometimes forget to commit and leave sessions alone for a few days (sic!), this gives me the chance to phone up the guy with pending transactions and let him commit his work before I shut down.

Thank you, Andrew!

Bye,
Andreas