Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Perl DBI connection with RAC environment

RE: Perl DBI connection with RAC environment

From: Peter McLarty <p.mclarty_at_cqu.edu.au>
Date: Thu, 5 Apr 2007 14:26:04 +1000
Message-ID: <27AA2E9CA7A0C44283BC1E9B00086AA905EECDA1@UNIMAIL.staff.ad.cqu.edu.au>


Yes thats it as you can sqlplus to the sansrv you can dbi to the sansrv I loose the host ip and let dbi find its way with tnsnames and let oracle Net do the work for me  

But if you have set up tnsname to have sansrv as a service with mumtliple hosts then you can specify the tnsnames entry for it and then you are in action as your tnsnames will have all nodes in its entry.  

STUDD1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = bhost-vip)(PORT = 1521))
(LOAD_BALANCE = yes)

    )
    (CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = STUDD1.example.com)
(FAILOVER_MODE =

        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )

    )
  )
With this the Oracle Net takes over working out which instance to connect to and if a node fails then load balancing simply relocates your connection to a new node
I have this in a perl script for connecting and use the database name not the instance for the variable $_[0] this is used for an admin scripthence the / as username  

Seems to work relaibly although not been used in production  

my $dsn = "dbi:Oracle:$_[0]";

my $dbh = DBI->connect( $dsn, '/', '',

{

ora_session_mode => 2,

RaiseError => 1,

AutoCommit => 0

}

)

HTH   Cheers


From: Sanjay Mishra [mailto:smishra_97_at_yahoo.com] Sent: Thursday, 5 April 2007 01:05 PM
To: Peter McLarty; oracle-l_at_freelists.org Subject: RE: Perl DBI connection with RAC environment

Peter  

It means that If I have created a service on RAC as SANSRV where I had specified both node as preferred and TAF to SELECT. Now It means I can specify
Host - VIP of any of the RAC Node
SID - SANSRV   Please correct me if I am wrong    


	The fish are biting.
	Get more visitors

<http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/ sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50 > on your site using Yahoo! Search Marketing. <http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/ sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50 >

Food fight?
<http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTE wOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&s id=396545367> Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A.
<http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTE wOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&s id=396545367>

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 04 2007 - 23:26:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US