Tuesday, January 31, 2012

SQL Plus Easy Connect error TNS-12504

One method to connect to Oracle database is using Easy Connect, meaning that you don'n need any client side configuration.

With Easy Connect, you supply all information that is required for the Oracle Net connection as part of the connect string. Easy Connect connection strings take the following form:
<username>/<password>@<hostname>:<listener port>/<service name>
The listener port and service name are optional. If the listener port is not provided, Oracle Net assumes that the default port of 1521 is being used. If the service name is not provided, Oracle Net assumes that the database service name and host name provided in the connect string are identical.
SQL> connect sys@192.168.40.222/oratest as sysdba
raise error 
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
To avoid this error you must give also the password for user connecting to database
SQL> conn sys/passwd@192.168.40.222/oratest as sysdba
Connected.
SQL>

No comments:

Post a Comment