Enabling Database Resident Connection Pooling

ygzhou518發表於2012-03-30


Oracle Database includes a default connection pool called SYS_DEFAULT_CONNECTION_POOL. By default, this pool is created, but not started. To enable database resident connection pooling, you must explicitly start the connection pool.

To enable database resident connection pooling:

  1. Start the database resident connection pool, as described in "Starting the Database Resident Connection Pool".

  2. Route the client connection requests to the connection pool, as described in "Routing Client Connection Requests to the Connection Pool".

Starting the Database Resident Connection Pool

To start the connection pool, use the following steps:

  1. Start SQL*Plus and connect to the database as the SYS user.

  2. Issue the following command:

    SQL> EXECUTE DBMS_CONNECTION_POOL.START_POOL();
    

Once started, the connection pool remains in this state until it is explicitly stopped. The connection pool is automatically restarted when the database instance is restarted if the pool was active at the time of instance shutdown.

In an Oracle Real Application Clusters (Oracle RAC) environment, you can use any instance to manage the connection pool. Any changes you make to the pool configuration are applicable on all Oracle RAC instances.

Routing Client Connection Requests to the Connection Pool

In the client application, the connect string must specify the connect type as POOLED.

The following example shows an easy connect string that enables clients to connect to a database resident connection pool:

examplehost.company.com:1521/books.company.com:POOLED

The following example shows a TNS connect descriptor that enables clients to connect to a database resident connection pool:

(DESCRIPTION=
   (ADDRESS=(PROTOCOL=tcp) (HOST=myhost/IP)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales)(SERVER=POOLED))
 )

Disabling Database Resident Connection Pooling

To disable database resident connection pooling, you must explicitly stop the connection pool. Use the following steps:

  1. Start SQL*Plus and connect to the database as the SYS user.

  2. Issue the following command:

    SQL> EXECUTE DBMS_CONNECTION_POOL.STOP_POOL();
    

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24867586/viewspace-719960/,如需轉載,請註明出處,否則將追究法律責任。

相關文章