Oracle - Connect Via SqlPlus I have a local installation of Oracle. I want to add the XMLDB package to it. As step 1, I need to connect to it via sqlplus. And I am not able to. 

The installation has a database called Pm.

Here is what I have tried on the command line:

sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 17 12:11:44 2016

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

Enter user-name: SYSTEM@PM
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name: SYSTEM@Pm
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name: system@PM
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

C:\Users\sgupta&gt;sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 17 12:14:15 2016

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

Enter user-name: system@Pm
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Here is what the tnsnames.ora file looks like:

# tnsnames.ora Network Configuration File: C:\app\sgupta\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

PM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = bentreki-E6330.callidussoftware.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = Pm)
    )
  )

CM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = bentreki-E6330.callidussoftware.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = CM)
    )
  )

PM20154 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = bentreki-E6330.callidussoftware.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = Pm20154)
    )
  )


And I have checked that the service is running:



Not sure why I keep getting the error 'ORA-12154: TNS:could not resolve the connect identifier specified'.
TLDR; Copy listener.ora and tnsnames.ora from app/sgupta/product/11.2.0/dbhome_1/NETWORK/ADMIN
to app/sgupta/product/11.2.0/dbclient_1/network/admin

I had the tnsnames.ora and listern.ora files in C:/app/sgupta/product/11.2.0/dbhome_1/NETWORK/ADMIN.

When I used tnsping on the command line, i was getting following error message:

tnsping PM

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Product
016 15:10:08

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
C:\app\sgupta\product\11.2.0\client_1\network\admin\sqlnet.ora

TNS-03505: Failed to resolve name


I noticed how it was looking in the C:\app\sgupta\product\11.2.0\client_1\network\admin folder. And that the sqlnet.ora looked like following:

# sqlnet.ora Network Configuration File: C:\app\sgupta\product\11.2.0\client_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)


So I figured sqlnet.ora is expecting a TNSNAMES file in the same folder.

So I copied listener.ora and tnsnames.ora from app/sgupta/product/11.2.0/dbhome_1/NETWORK/ADMIN
to app/sgupta/product/11.2.0/dbclient_1/network/admin.

After that tnsping worked. And sqlplus also connected.

tnsping PM

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 17-FEB-2
016 15:14:40

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
C:\app\sgupta\product\11.2.0\client_1\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = bentreki
-E6330.callidussoftware.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = Pm)))
OK (20 msec)

C:\Users\sgupta&gt;sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 17 15:15:01 2016

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

Enter user-name: SYSTEM@PM
Enter password:

Connected to:
Oracle Database 11g Release 11.2.0.1.0 - 64bit Production