Saturday, 17 November 2012

ORA-12154: TNS:could not resolve the connect identifier specified



Q. HOW TO SOLVE ERROR

“ORA-12154: TNS:could not resolve the connect identifier specified”

ANSWER:-

FIRST OF ALL GO TO ORACLE FOLDER IN YOUR LOGICAL DRIVE.
FOR EXAMPLE:-
I HAVE INSTALL ORACLE IN LOCAL DISK C:\
SO I HAVE TO FOLLOW FOLLOWING PATH

C:\oracle\product\10.2.0\db_1\network\ADMIN

NOW OPEN “listener.ora” FILE WITH NOTPAD.

WE HAVE TO SET THAT FILE AS FOLLOWING:-


# listener.ora Network Configuration File: c:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = david-a1084b)(PORT = 1521))
    )
  )


NOW WE HAVE TO OPEN “tnsnames.ora” FILE WITH NOTPAD AND SET AS FOLLOWING:-


# tnsnames.ora Network Configuration File: c:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = david-a1084b)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)/*--(ORCL IS DATABASE NAME)--*/
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
/*-----NOTE:- HERE HOST IS YOUR COMPUTER NAME------*/

NOW OPEN “sqlnet.ora” AND SET AS FOLLOWING:-

# sqlnet.ora Network Configuration File: c:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

AFTER THIS OPEN CONTROL PANEL AND CLICK ON “SYSTEM”
AFTER THAT CLICK ON “ADVANCE OPTION"
AFTER THAT CLICK ON “ENVIRONMENT VARIABLE”


CLICK ON NEW ON SYSTEM VARIABLE AND USER VARIABLE FOR ORACLE
THEN
SET VARIABLE NAME= “TNS_ADMIN”
VARIABLE VALUE= C:\oracle\product\10.2.0\db_1\network\ADMIN
THEN CLICK ON ALL OK THEN RESTART SERVICES OF ORACLE OR RESTART YOUR COMPUTER.
THEN CONNECT WITH DATABASE NAME

FOR EXAMPLE:-

IN SQL PROMPT:-

CONN SCOTT/TIGER@ORCL;

HERE ORCL IS DATABASE NAME.

No comments:

Post a Comment