DB Creation   «Prev  Next»

Lesson 7 Oracle the DISCONNECT Command
ObjectiveUse the DISCONNECT command to leave Oracle Shared Server

Oracle DISCONNECT Command


The Oracle `DISCONNECT` command plays a significant role within the context of Oracle Shared Server, a configuration that enables multiple user processes to share a pool of server processes. This architecture enhances the scalability of applications and the efficiency of resource utilization.
  1. Purpose of the Oracle `DISCONNECT` Command The primary purpose of the `DISCONNECT` command in an Oracle Shared Server environment is to explicitly release a user’s session and its associated resources back to the shared pool, without necessarily terminating the user’s network connection to the Oracle Database. This is particularly important in a shared server configuration where managing and optimizing the utilization of server resources is crucial for performance and scalability.
  2. Function of the Oracle `DISCONNECT` Command When a user issues the `DISCONNECT` command, Oracle performs the following actions:
    • Release of Resources: The server process releases any memory, locks, and resources that were allocated to the user’s session. This helps in freeing up resources that can then be used by other sessions in the shared server pool.
    • Preservation of Network Connection: Unlike a full logout, the `DISCONNECT` command does not terminate the user’s network connection to the database. The network connection is maintained, and the user can later resume their session without the overhead of re-establishing the network connection.
    • Enhanced Scalability: By allowing sessions to be disconnected and resources to be freed up while preserving network connections, Oracle Shared Server can handle a larger number of concurrent connections, improving the scalability of the application.
    • Session Management: The `DISCONNECT` command contributes to more efficient session management within the shared server environment. It provides administrators with a tool to proactively manage user sessions and optimize the utilization of server processes.
    • Facilitation of Connection Pooling: The `DISCONNECT` command plays a crucial role in facilitating connection pooling mechanisms, where a pool of database connections is maintained to minimize the overhead of opening and closing connections for each user request. By releasing server resources while keeping the network connection alive, the `DISCONNECT` command enhances the efficiency of connection pooling strategies.
In summary, the Oracle `DISCONNECT` command serves as a vital tool in the management and optimization of resources within an Oracle Shared Server configuration. It allows for the efficient release of server resources, enhances the scalability of applications, contributes to effective session management, and facilitates the implementation of connection pooling mechanisms. Mastery of this command is essential for database administrators seeking to optimize the performance and resource utilization of Oracle Shared Server environments.


You cannot use the EXIT command to leave Oracle Shared Server. You must use the DISCONNECT command to disconnect from your database session and leave Shared Server.
To disconnect from your database session, type the following command at the SQL*Plus prompt:
DISCONNECT

This will close your database connection and exit Shared Server.
The EXIT command is used to exit SQL*Plus, not to leave Shared Server. If you try to use the EXIT command to leave Shared Server, you will get the following error message:
SP2-0113: Shared Server: EXIT command not allowed

To avoid this error message, use the DISCONNECT command to disconnect from your database session and leave Shared Server. Here is an example of how to disconnect from your database session and leave Shared Server:
SQL> DISCONNECT

This will close your database connection and exit Shared Server. You will then be returned to the command prompt.

Create Session start-up Scripts

/usr/local/etc (for HP/UX):
/usr/local/etc/profile (sh, ksh, bash)
/usr/local/etc/cshrc (csh)
/usr/local/etc/login (use for csh programs) 

For individual users, you can create session start-up scripts in your default home directory (as specified in /etc/passwd),
by placing a file in that directory. For example, if the /etc/password file shows this for the Oracle user, we would add a dot-file called
.profile in /home/oracle.

root> cat /etc/passwd|grep oracle

oracle:x:106:20001::/home/oracle:/bin/ksh
Other dot-file depend on the shell specified in /etc/passwd:
.profile (sh, ksh, bash)
.cshrc (csh)
.login (use for csh programs) 

SEMrush Software