We have set up RAC database on server. We can connect to database from sqlplus on the server using SCAN address. However, if I try to connect to RAC using SQL developer from client machine using SCAN address-based TNS entry, it shows the error
12-APR-2016 22:33:07 * (CONNECT_DATA=(CID=(PROGRAM=SQL Developer)(HOST=__jdbc__)(USER=User))(SERVICE_NAME=racdb)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.227.110)(PORT=63694)) * establish * racdb * 12516
TNS-12516: TNS:listener could not find available handler with matching protocol stack
Client machine is behind the firewall.
Here is the TNS entry.
RACDB =
(DESCRIPTION =
(LOAD_BALANCE = ON)
(FAILOVER = ON)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.1.149)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.1.150)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.1.151)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = racdb)
)
)
We cannot use DNS to resolve SCAN IPs from client side, so we used the IP address on the client machine. And IP addresses of SCAN are converted on client side using NAT. Below is their real addresses set on the server
# SCAN
#192.168.227.149 racdb-scan.esplink.mn racdb-scan
#192.168.227.150 racdb-scan.esplink.mn racdb-scan
#192.168.227.151 racdb-scan.esplink.mn racdb-scan
If we change the IP address of TNS entry to VIP addresses, the connection is successful and I can connect to RAC database.
Is it wrong to use SCAN addresses to connect to RAC?
Best Answer
Looks like the JDBC 11g NAT+RAC issue.
JDBC Connections Using SCAN Fail With ORA-12516/ORA-12520 (Doc ID 1555793.1)
The above note suggests upgrading the JDBC driver to 12c.
Whenever you connect through SCAN, your connection is redirected. Previous versions of the Oracle JDBC driver can not handle that properly.
If you download the latest SQL Developer, that comes with the 12.1.0.2 JDBC driver.
Another solution that I prefer is to use OCI with an Oracle Client instead of JDBC (this makes possible to cancel long-running queries in SQL Developer). After installing the Oracle Client, you can configure this in Tools / Preferences / Database / Advanced.