hguser
hguser

Reputation: 36028

how to connect to oracle rac in asp.net

We just set up the Oracle RAC environment today and we use the single oracle database instance before.

Now we have four nodes in the RAC whose physical IPs are :

192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4

Also the there are four virtual IPs:

192.168.1.11
192.168.1.22
192.168.1.33
192.168.1.44

And we can connect 192.168.1.1 to use the oracle EM Database Console.

Now I do not know how to set the connection string in my web.config of the asp.net application.

Since when we use the single instance we just set the string like this:

provider=MSDAORA;data source=ORCL;user id=xx;password=xx

The "ORCL" here is the local net service name which can be found in the tnsnames.ora(the machine on which the IIS work).

Any idea?

UPDATE:

I use the oledb api.

Upvotes: 1

Views: 1710

Answers (1)

Mark J. Bobak
Mark J. Bobak

Reputation: 14403

You didn't make mention of SCAN address, so, I assume you're not on 11gR2.

Since your OLE data source makes reference to the ORCL connection identifier, that's where you'll want to configure your RAC load balancing and failover, in the tnsnames.ora definition of 'ORCL'.

Something like this ought to do it:

ORCL=
(DESCRIPTION=
  (LOAD_BALANCE=ON)
  (FAILOVER=ON)
  (ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.11)(PORT=1521))
                (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.22)(PORT=1521))
                (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.33)(PORT=1521))
                (ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.44)(PORT=1521))
              )
  (CONNECT_DATA=(FAILOVER_MODE=(TYPE=SELECT)
                               (METHOD=BASIC)
                )
                (SERVICE_NAME=ORCL)
  )
)

Hope that helps.

Upvotes: 3

Related Questions