Sunday, September 26, 2010

ORA-12532: TNS:invalid argument

Problem Description
While connecting to oracle database it fails with ORA-12532: TNS:invalid argument like below.
$ sqlplus system@bddip

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Sep 26 13:18:56 2010

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

Enter password:
ERROR:
ORA-12532: TNS:invalid argument
Cause of the Problem
If you look for the Oracle error message for ORA-12532 you will see,
ORA-12532:TNS:invalid argument
Cause: An internal function received an invalid parameter.
Action: Not normally visible to the user. For further details, turn on tracing and reexecute the operation. If error persists, contact Oracle Customer Support.
It sounds like oracle bug. If you do tnsping it also fails like below,
$tnsping ddip
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.100.1)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bddip.com)))
TNS-12532: TNS:invalid argument
If you enable client tracing you will see,
ntt2err: soc  error - operation=1, ntresnt[0]=502, ntresnt[1]=113, ntresnt[2]=0 
ntt2err: exit
nttcni: exit
nttcon: exit
nserror: entry
nserror: nsres: id=0, op=65, ns=12532, ns2=12560; nt[0]=502, nt[1]=113, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
nsopen: unable to open transport
The OS error 113 indicates that there is no route to host in Linux platform.

Based on tracing we can say the problem happened due to firewall settings or there is a network issue.

Note that the problem can also happened due to bad password definition for user that you are using connect. For example in the password there is '@' symbol.

Solution of the Problem
Ensure that firewall is not blocking the connection. You can easily test it from client machine by using telnet.
$ telnet {database server IP} {listener port}

If your database server IP address is 192.168.100.1 and listener port is 1521 then issue,

$ telnet 192.168.100.1 1521

You would get a blank screen with blinking cursor. It will fail to connect if there is either firewall or network transport issue.

Remove underlying firewall.

Also if you have '@' character with the password field then remove the character.

No comments:

Post a Comment