Problem solve Get help with specific problems with your technologies, process and projects.

Shut down a session without shutting down database

There are times when the shutdown of the database is not an option. Here are two alternate ways to disconnect a session.

When trying to drop a schema that has connected users, Oracle will not allow that schema to be dropped. This creates problems when trying to reset a schema to a prior exported version.

There are two separate ways to disconnect the user. The first is to shut down and restart Oracle and the other is to explicitly disconnect the session that is keeping the schema from being dropped. There are times when the shutdown of the database is not an option. So here is alternate way to disconnect a session. This has been tested on Oracle 8.0.6.2, 8.1.7.0, 8.1.7.3, 8.1.6.2, and 8.1.7.4. I have only tested this script as the sys user.

FIND THE CONNECTED SESSION:

select username, process, sid, serial#, machine, status, program from v$session
order by username;
DISCONNECT INVALID SESSION:
alter system kill session '<sid of invalid session>,<serial# of invalid session>';
Make sure that you only do this to database sessions that are not being currently used.

For More Information

  • Feedback: E-mail the editor with your thoughts about this tip.
  • More tips: Hundreds of free Oracle tips and scripts.
  • Tip contest: Have an Oracle tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
  • Ask the Experts: Our applications, SQL, database administration, and data warehousing gurus are waiting to answer your toughest questions.
  • Forums: Ask your technical Oracle questions--or help out your peers by answering them--in our active forums.
  • Best Web Links: Oracle tips, tutorials, and scripts from around the Web.

Dig Deeper on Oracle database backup and recovery

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close