This discussion is archived
8 Replies Latest reply: May 29, 2012 12:53 AM by 468439 RSS

How to connect to Oracle RAC via SCAN

468439 Newbie
Currently Being Moderated
I just finished Oracle RAC install but I cannot connect via the SCAN name from a remote client - only via the VIP:

$ sqlplus system/syst3ms@rac-scan.xxx.local:1521/racdb.development.info

SQL*Plus: Release 11.2.0.3.0 Production on Fri May 25 15:14:13 2012

Copyright (c) 1982, 2011, Oracle. All rights reserved.

ERROR:
ORA-12545: Connect failed because target host or object does not exist

This is Oracle 11r2 on Unbreakable Linux 6.2. The sqlplus above is from Instant Client 11.2. Further info is:

$ ./srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node racnode1
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node racnode2
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node racnode2


./srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node racnode1

$ nslookup rac-scan
Server:          172.20.0.15
Address:     172.20.0.15#53

Name:     rac-scan.xxx.local
Address: 172.20.0.213
Name:     rac-scan.xxx.local
Address: 172.20.0.214
Name:     rac-scan.xxx.local
Address: 172.20.0.210

on racnode1:
$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:1A:A0:96:A6:B2
inet addr:172.20.0.221 Bcast:172.20.0.255 Mask:255.255.255.0 <--- public ip
inet6 addr: fe80::21a:a0ff:fe96:a6b2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9458999 errors:0 dropped:0 overruns:0 frame:0
TX packets:14852588 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4001261935 (3.7 GiB) TX bytes:1196090235 (1.1 GiB)
Interrupt:20 Memory:fdfc0000-fdfe0000

eth0:1 Link encap:Ethernet HWaddr 00:1A:A0:96:A6:B2
inet addr:172.20.0.212 Bcast:172.20.0.255 Mask:255.255.255.0 <---- VIP
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000

eth0:2 Link encap:Ethernet HWaddr 00:1A:A0:96:A6:B2
inet addr:172.20.0.214 Bcast:172.20.0.255 Mask:255.255.255.0 <---- one of the SCAN ips
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000

eth1 Link encap:Ethernet HWaddr 90:E2:BA:0F:F9:8F
inet addr:10.0.0.2 Bcast:10.0.0.255 Mask:255.255.255.0 <---- private interconnect
inet6 addr: fe80::92e2:baff:fe0f:f98f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:26461881 errors:4 dropped:0 overruns:0 frame:2
TX packets:33628826 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4053295644 (3.7 GiB) TX bytes:695537051 (663.3 MiB)

on racnode2

eth0 Link encap:Ethernet HWaddr 00:1A:A0:96:A4:5B
inet addr:172.20.0.174 Bcast:172.20.0.255 Mask:255.255.255.0 <--- public IP
inet6 addr: fe80::21a:a0ff:fe96:a45b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3233473 errors:0 dropped:0 overruns:0 frame:0
TX packets:1766459 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41109717 (39.2 MiB) TX bytes:179509273 (171.1 MiB)
Interrupt:20 Memory:fdfc0000-fdfe0000

eth0:1 Link encap:Ethernet HWaddr 00:1A:A0:96:A4:5B
inet addr:172.20.0.211 Bcast:172.20.0.255 Mask:255.255.255.0 <--- VIP
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000

eth0:2 Link encap:Ethernet HWaddr 00:1A:A0:96:A4:5B
inet addr:172.20.0.210 Bcast:172.20.0.255 Mask:255.255.255.0 <--- another SCAN IP
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000

eth0:3 Link encap:Ethernet HWaddr 00:1A:A0:96:A4:5B
inet addr:172.20.0.213 Bcast:172.20.0.255 Mask:255.255.255.0 <--- another SCAN IP
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:fdfc0000-fdfe0000


$ ./lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-MAY-2012 15:12:35

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN1
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 25-MAY-2012 14:28:11
Uptime 0 days 0 hr. 44 min. 23 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/racnode1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.20.0.214)(PORT=1521)))
Services Summary...
Service "racdb.development.info" has 2 instance(s).
Instance "racdb1", status READY, has 1 handler(s) for this service...
Instance "racdb2", status READY, has 1 handler(s) for this service...
Service "racdbXDB.development.info" has 2 instance(s).
Instance "racdb1", status READY, has 1 handler(s) for this service...
Instance "racdb2", status READY, has 1 handler(s) for this service...
The command completed successfully

Any ideas?
  • 1. Re: How to connect to Oracle RAC via SCAN
    mseberg Guru
    Currently Being Moderated
    Make sure you updated your local listener parameters like following :

    alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=racdb.development.info)(PORT=1521))))' sid='?' scope=both;


    Otherwise I believe this note is still on support :

    364855.1 RAC Connection Redirected To Wrong Host/IP ORA-12545

    Best Regards

    mseberg
  • 2. Re: How to connect to Oracle RAC via SCAN
    Levi-Pereira Guru
    Currently Being Moderated
    Hi,
    I just finished Oracle RAC install but I cannot connect via the SCAN name from a remote client - only via the VIP:
    $ sqlplus system/syst3ms@rac-scan.xxx.local:1521/racdb.development.info
    
    SQL*Plus: Release 11.2.0.3.0 Production on Fri May 25 15:14:13 2012
    
    Copyright (c) 1982, 2011, Oracle. All rights reserved.
    
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    >
    Any ideas?
    How does SCAN work?
    “When a client submits a request, the SCAN listener listening on a SCAN IP address and the SCAN port is contracted on a client’s behalf. Because all services on the cluster are registered with the SCAN listener, the SCAN listener replies with the address of the local listener (Using SCAN the connection is initiated using the SCANIP, but is established using the VIP) on the least-loaded node (Each scan listener keeps updated cluster load statistics) where the service is currently being offered. Finally, the client establishes connection to the service through the listener using VIP on the node where service is offered.All of these actions take place transparently to the client without any explicit configuration required in the client.”

    So, to SCAN Works you must aware:

    Server (cluster)
    -The service must be registered on Local/Scan Listener

    Database (rac)
    -You must use remote_listener parameter

    Cient
    -Must resolve all SCAN Names and VIP Names (check with nslookup)
    -Must access port of Listener


    Try it:
    http://levipereira.wordpress.com/2011/05/03/configuring-client-to-use-scan-11-2-0/

    Regards,
    Levi Pereira
  • 3. Re: How to connect to Oracle RAC via SCAN
    onedbguru Pro
    Currently Being Moderated
    You could read the documentation...

    http://www.oracle.com/technetwork/products/clustering/overview/scan-129069.pdf

    Pay attention to {local | remote}_listener parameters (can be set dynamically!!)
  • 4. Re: How to connect to Oracle RAC via SCAN
    468439 Newbie
    Currently Being Moderated
    Updating the local listener parameters seems to have helped. I can now connect from a client using the rac-scan name. However, I still have some issues, posted in another reply on this thread.

    Thanks
  • 5. Re: How to connect to Oracle RAC via SCAN
    468439 Newbie
    Currently Being Moderated
    How does SCAN work?
    “When a client submits a request, the SCAN listener listening on a SCAN IP address and the SCAN port is contracted on a client’s behalf. Because all services on the cluster are registered with the SCAN listener, the SCAN listener replies with the address of the local listener (Using SCAN the connection is initiated using the SCANIP, but is established using the VIP) on the least-loaded node (Each scan listener keeps updated cluster load statistics) where the service is currently being offered. Finally, the client establishes connection to the service through the listener using VIP on the node where service is offered.All of these actions take place transparently to the client without any explicit configuration required in the client.”

    So, to SCAN Works you must aware:

    Server (cluster)
    -The service must be registered on Local/Scan Listener
    I believe I've done this now but see below.
    Database (rac)
    -You must use remote_listener parameter
    The remote listener parameter I have is:

    SQL> show parameter remote listener

    NAME                    TYPE     VALUE
    ------------------------------------ ----------- ------------------------------
    remote_dependencies_mode     string     TIMESTAMP
    remote_listener           string     rac-scan:1521
    remote_login_passwordfile     string     EXCLUSIVE
    remote_os_authent          boolean     FALSE
    remote_os_roles           boolean     FALSE
    result_cache_remote_expiration     integer     0

    Cient
    -Must resolve all SCAN Names and VIP Names (check with nslookup)
    I'd made a mistake there. My VIP names were not available from DNS.
    -Must access port of Listener


    Try it:
    http://levipereira.wordpress.com/2011/05/03/configuring-client-to-use-scan-11-2-0/
    Thanks, that document was useful however I don't think I've got it completely right as yet as I have no listener_scan2.

    $ olsnodes -i -s -n
    racnode1     1     racnode1-vip     Active
    racnode2     2     racnode2-vip     Active

    srvctl config vip -n racnode1
    VIP exists.:racnode1
    VIP exists.: /racnode1-vip/172.20.0.212/255.255.255.0/eth0

    srvctl config vip -n racnode2
    VIP exists.:racnode2
    VIP exists.: /racnode2-vip/172.20.0.211/255.255.255.0/eth0

    srvctl config scan
    SCAN name: rac-scan.xxx.local, Network: 1/172.20.0.0/255.255.255.0/eth0
    SCAN VIP name: scan1, IP: /172.20.0.214/172.20.0.214
    SCAN VIP name: scan2, IP: /rac-scan.xxx.local/172.20.0.210
    SCAN VIP name: scan3, IP: /172.20.0.213/172.20.0.213

    SQL> select INST_ID, NAME, VALUE
    2 from gv$parameter
    3 where name like '%_listener%';

    INST_ID
    ----------
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------
         1
    local_listener
    (address=(protocol=tcp)(port=1521)(host=racnode1-vip.xxx.local))

         1
    remote_listener
    rac-scan:1521

    INST_ID
    ----------
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------

         2
    local_listener
    (address=(protocol=tcp)(port=1521)(host=racnode1-vip.xxx.local))

         2
    remote_listener

    INST_ID
    ----------
    NAME
    --------------------------------------------------------------------------------
    VALUE
    --------------------------------------------------------------------------------
    rac-scan:1521

    racnode1
    $ lsnrctl service listener_scan1

    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-MAY-2012 13:36:10

    Copyright (c) 1991, 2009, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
    Services Summary...
    Service "racdb.development.info" has 2 instance(s).
    Instance "racdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    REMOTE SERVER
    (address=(protocol=tcp)(port=1521)(host=racnode1-vip.xxx.local))
    Instance "racdb2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    REMOTE SERVER
    (address=(protocol=tcp)(port=1521)(host=racnode2-vip.xxx.local))
    Service "racdbXDB.development.info" has 2 instance(s).
    Instance "racdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: racnode1.xxx.local, pid: 3651>
    (ADDRESS=(PROTOCOL=tcp)(HOST=racnode1.xxx.local)(PORT=62553))
    Instance "racdb2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: racnode2.xxx.local, pid: 6501>
    (ADDRESS=(PROTOCOL=tcp)(HOST=racnode2.xxx.local)(PORT=10619))
    The command completed successfully

    $ lsnrctl service

    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-MAY-2012 13:38:02

    Copyright (c) 1991, 2009, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
    Services Summary...
    Service "+ASM" has 1 instance(s).
    Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "racdb.development.info" has 1 instance(s).
    Instance "racdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "racdbXDB.development.info" has 1 instance(s).
    Instance "racdb1", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: racnode1.xxx.local, pid: 3651>
    (ADDRESS=(PROTOCOL=tcp)(HOST=racnode1.xxx.local)(PORT=62553))
    The command completed successfully


    racnode2
    lsnrctl service listener_scan2
    none of listener_scan1, 2 or 3 say anything other than TNS-01101: Could not find service name listener_scanN
    lsnrctl service

    $ lsnrctl service

    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 28-MAY-2012 13:19:50

    Copyright (c) 1991, 2009, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
    Services Summary...
    Service "+ASM" has 1 instance(s).
    Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    LOCAL SERVER
    Service "racdb.development.info" has 1 instance(s).
    Instance "racdb2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:14 refused:0 state:ready
    LOCAL SERVER
    Service "racdbXDB.development.info" has 1 instance(s).
    Instance "racdb2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "D000" established:0 refused:0 current:0 max:1022 state:ready
    DISPATCHER <machine: racnode2.xxx.local, pid: 6501>
    (ADDRESS=(PROTOCOL=tcp)(HOST=racnode2.xxx.local)(PORT=10619))
    The command completed successfully

    UPDATE:
    $ srvctl config scan_listener
    SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521


    There is a period of time when I shutdown one node where I cannot connect and get "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"

    Edited by: MartinJEvans on May 28, 2012 2:02 PM
  • 6. Re: How to connect to Oracle RAC via SCAN
    Levi-Pereira Guru
    Currently Being Moderated
    Hi,
    There is a period of time when I shutdown one node where I cannot connect and get "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
    Shutting down Node A will relocate the SCAN listener to node B and that Scan Listener will be started with none Service.
    If on node B database is running, then the registration at the listener is done by PMON every 60 seconds... so

    - your scan listener starts (but does not know the service) --- error message
    - PMON registeres the service/database after 60 seconds -- no error...

    You have 3 IP that means 3 SCAN Listener avaliable, but if and you have bad luck to take the IP\Listener which being relocated to another node, in less of 60 seconds you can get error msg "ORA-12514"

    Regards,
    Levi Pereira
  • 7. Re: How to connect to Oracle RAC via SCAN
    468439 Newbie
    Currently Being Moderated
    Levi Pereira wrote:
    Hi,
    There is a period of time when I shutdown one node where I cannot connect and get "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
    Shutting down Node A will relocate the SCAN listener to node B and that Scan Listener will be started with none Service.
    If on node B database is running, then the registration at the listener is done by PMON every 60 seconds... so

    - your scan listener starts (but does not know the service) --- error message
    - PMON registeres the service/database after 60 seconds -- no error...

    You have 3 IP that means 3 SCAN Listener avaliable, but if and you have bad luck to take the IP\Listener which being relocated to another node, in less of 60 seconds you can get error msg "ORA-12514"
    Thanks. My problem was different to the above. If I shutdown the first node I could not connect using the scan address at all for around 1 minute.

    I was always suspicious that I only had one scan listener. It seems I added the resolution of the scan name to 3 IPs after installing grid so by default I only had one scan listener. I followed a blog at https://sosdba.wordpress.com/2010/07/30/scan-reconfiguration/ to reconfigure my scan and afterwards I had 3 scan listeners.

    Now, when I shut down one node I can get a connect failure once (usually whilst the node is not completely shut down) but it connects to the surviving node in much less than 60s.

    Thanks for you help.
  • 8. Re: How to connect to Oracle RAC via SCAN
    468439 Newbie
    Currently Being Moderated
    2 problems. I needed to update my local listener parameters and I needed to reconfigure SCAN as my scan address only resolved to 1 address when I installed grid.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points