Oracle 12c impdp ORA-12154: TNS:could not resolve the connect identifier specified

453 views Asked by At

I'm new with Oracle and I'm just trying to import a dump file. I'm able to create my container database, however when I go to run impdp gy/gy@mygy file=C:\app\impdir\EL1.DMP I am getting ORA-12154.

This is the script I used to create my pluggable db, now I think I just don't understand how to connect.

sqlplus / as sysdba
CREATE PLUGGABLE DATABASE mygy ADMIN USER gy identified by "gy"
DEFAULT TABLESPACE mygytbs
DATAFILE 'C:\app\me\product\21c\oradata\XE\XEPDB1\mygy.dbf'
SIZE 10M AUTOEXTEND ON
FILE_NAME_CONVERT=(
'C:\app\me\product\21c\oradata\XE\pdbseed\',
'C:\app\me\product\21c\oradata\XE\XEPDB2\');
alter session set container=mygy;
ALTER DATABASE OPEN;
CREATE OR REPLACE DIRECTORY impdir AS 'C:\app\impdir';
GRANT READ, WRITE ON DIRECTORY impdir TO gy;
GRANT DBA,CONNECT TO gy;

impdb

impdp gy/gy@mygy file=C:\app\impdir\EL1.DMP


Import: Release 21.0.0.0.0 - Production on Wed Nov 22 11:43:20 2023
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle and/or its affiliates.  All rights reserved.

UDI-12154: operation generated ORACLE error 12154
ORA-12154: TNS:could not resolve the connect identifier specified
2

There are 2 answers

0
pmdba On BEST ANSWER

The TNS alias mygy is not defined in your $ORACLE_HOME/network/admin/tnsnames.ora file, so the Oracle client doesn't know where to connect to.

0
veasna On

Tns not define :

  1. Register tns on databas
    sql> alter system set local_listener='address=(protocol=tcp)(host= hostname)(port=port_number))' scope=both;
    Sql> alter system register;
    
  2. Add service name with netca