Today, We can download patch[10098816] or 11.2.0.2 on Solaris.



Installation Type | Zip File |
---|---|
Oracle Database Client |
|
Deinstall |
|
This page contains my experiences and my thoughts about Information Technology and something new what I learned in my life.
Installation Type | Zip File |
---|---|
Oracle Database Client |
|
Deinstall |
|
Oracle DRCPCheck perl module version and then start example for DRCP:
DBD::Oracle now supports DRCP (Database Resident Connection Pool) so if you have an 11.2 database and the DRCP
is turned on you can now direct all of your connections to it simply adding ":POOLED" to the SID or setting a
connection attribute of ora_drcp, or set the SERVER=POOLED when using a TNSENTRY style connection or even by
setting an environment variable ORA_DRCP. All of which are demonstrated below;
$dbh = DBI->connect("dbi:Oracle:DB:POOLED","username","password")
$dbh = DBI->connect("dbi:Oracle:","username@DB:POOLED","password")
$dbh = DBI->connect("dbi:Oracle:DB","username","password",{ora_drcp=>1})
$dbh = DBI->connect("dbi:Oracle:DB","username","password",{ora_drcp=>1, ora_drcp_class=>"my_app", ora_drcp_min=>10})
$dbh = DBI->connect("dbi:Oracle:host=foobar;sid=ORCL;port=1521;SERVER=POOLED", "scott/tiger", "")
$dbh = DBI->connect("dbi:Oracle:", q{scott/tiger@(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST= foobar)(PORT=1521))
(CONNECT_DATA=(SID=ORCL)(SERVER=POOLED)))}, "")
if ORA_DRCP environment var is set the just this
$dbh = DBI->connect("dbi:Oracle:DB","username","password")
$ perl -e 'use DBI; print $DBI::VERSION,"\n";'tnsnames.ora file. -- we can read more... Configuring Database Resident Connection Pooling
1.614
$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";'
1.25
ORCL_POOL=Code 1: (testdrcp.pl)
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxtest01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)(SERVER=POOLED)))
#!/usr/bin/perl -wtest code 1:
use DBI;
my $dbh = DBI->connect("dbi:Oracle:orcl_pool","scott","tiger")
||
die( $DBI::errstr . "\n" );
my $sth = $dbh->prepare("begin dbms_lock.sleep(5); end;");
$sth->execute();
$ perl testdrcp.plbecause we don't start connection pool on database.
DBI connect('orcl_pool','scott',...) failed: ORA-28547: connection to server failed, probable Oracle Net admin error (DBD ERROR: OCISessionBegin) at testdrcp.pl line 4 ORA-28547: connection to server failed, probable Oracle Net admin error (DBD ERROR: OCISessionBegin)
SQL> execute dbms_connection_pool.start_pool;test code 1 again:
PL/SQL procedure successfully completed.
$ perl testdrcp.plThat mean, database created connection pooling and closed after executed.
-- NO ERROR --
SQL> select username, status, server, program from v$session where username='SCOTT'; -- while code running
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT ACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select username, status, server, program from v$session where username='SCOTT'; -- code finished
no rows selected
#!/usr/bin/perl -wtest code 2:
use DBI;
my $dbh = DBI->connect("dbi:Oracle:orcl_pool","scott","tiger",{ora_drcp=>1})
||
die( $DBI::errstr . "\n" );
my $sth = $dbh->prepare("begin dbms_lock.sleep(5); end;");
$sth->execute();
$ perl testdrcp.plFrom code, ora_drcp=>1, that make connection pooling be "INACTIVE" after executed (hold connection), but it created new connection class every time when connect database.
-- NO ERROR --
SQL> select username, status, server, program from v$session where username='SCOTT'; -- while code running
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT ACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select username, status, server, program from v$session where username='SCOTT'; -- code finished
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
$ perl testdrcp.pl -- test again
-- NO ERROR --
SQL> select username, status, server, program from v$session where username='SCOTT'; -- while code running
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SCOTT ACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select username, status, server, program from v$session where username='SCOTT'; -- code finished
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select * from V$CPOOL_CC_INFO;Then How to reuse connection class?
POOL_NAME CCLASS_NAME
-------------------------------------------------- --------------------------------------------------
SYS_DEFAULT_CONNECTION_POOL SCOTT.OCI:SP:kJxcQGCWisTgQKjAIwEaOB
SYS_DEFAULT_CONNECTION_POOL SCOTT.OCI:SP:kJxcq/eyU8PgQKjAIwEaOD
#!/usr/bin/perl -wtest code 3:
use DBI;
my $dbh = DBI->connect("dbi:Oracle:orcl_pool","scott","tiger",{ora_drcp=>1, ora_drcp_class=>"my_app", ora_drcp_min=>10})
||
die( $DBI::errstr . "\n" );
my $sth = $dbh->prepare("begin dbms_lock.sleep(5); end;");
$sth->execute();
$ perl testdrcp.plFrom code, we use connection class, so connection reused connection class (my_app).
-- NO ERROR --
SQL> select username, status, server, program from v$session where username='SCOTT'; -- while code running
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT ACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select username, status, server, program from v$session where username='SCOTT'; -- code finished
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
$ perl testdrcp.pl --test again
-- NO ERROR --
SQL> select username, status, server, program from v$session where username='SCOTT'; -- while code running
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT ACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select username, status, server, program from v$session where username='SCOTT'; -- code finished
USERNAME STATUS SERVER PROGRAM
------------------------------ -------- --------- ------------------------------------------------
SCOTT INACTIVE POOLED perl@linuxtest01 (TNS V1-V3)
SQL> select * from V$CPOOL_CC_INFO;- Connect Attributes for DRCP :
POOL_NAME CCLASS_NAME
------------------------------ ------------------------------
SYS_DEFAULT_CONNECTION_POOL SCOTT.my_app