Thursday, April 12, 2012

Local connections using sqlplus take too long

After tracing the oracle client using trace level 16 (SUPPORT) the following was seen in the trace file:

(1) [000001 11-APR-2012 12:45:30:468] nsbasic_brc: exit: oln=0, dln=66, tot=76, rc=0
(1) [000001 11-APR-2012 12:45:30:468] nioqrc: exit
(1) [000001 11-APR-2012 12:45:30:469] snlinGetAddrInfo: entry
(1) [000001 11-APR-2012 12:48:10:477] snlinGetAddrInfo: exit
(1) [000001 11-APR-2012 12:48:10:478] snlinFreeAddrInfo: entry
(1) [000001 11-APR-2012 12:48:10:478] snlinFreeAddrInfo: exit
(1) [000001 11-APR-2012 12:48:10:478] nioqsn: entry
(1) [000001 11-APR-2012 12:48:10:478] nioqsn: exit
(1) [000001 11-APR-2012 12:48:10:478] nioqrc: entry

The function snlinGetAddrInfo is used for hostname resolution. The solution has to be find in the system (OS) settings.
What needs to be checked are following files:
/etc/nsswitch.conf
/etc/hosts
/etc/resolv.conf
if the hostname resolution is working correctly. UNIX standard is that first should be checked local database (/etc/hosts) and then LDAP. This will be achieved by configuring /etc/nsswitch.conf file as following example:
hosts: files [NOTFOUND=continue] dns
In this case were found misspelled records in the /etc/resolv.conf file (as this file was not used, it was removed).