导入 DMP 文件时出现 Oracle 错误 12154

jam*_*mes 6 oracle oracle-11g-r2 import

我的设置

我正在运行Windows 7 64 位,使用适用于 Windows 64 位的 Oracle DB 11g R2。我将 Oracle SQL Developer Release 3.0 (4.0.2.15.21) 作为我的数据库的 GUI。


我按照这篇文章中关于如何导入 Oracle .DMP 文件的说明进行操作。我在命令提示符中发出了这个命令:C:\>imp sys@dev/password12345 FROMUSER=FOOADMIN TOUSER=FOOADMIN file=c:\fooadmin.dmp full=yes

然后它提示我输入密码,我在其中输入正确的密码,然后收到此错误:

IMP-00058: ORACLE error 12154 encountered
ORA-12154: TNS:could not resolve the connect identifier specified
IMP-00000: Import terminated unsuccessfully
Run Code Online (Sandbox Code Playgroud)

Actual Question: How do I fix this error and be able to import the .dmp file successfully? Or what are some steps I can head towards to potentially get this working...?


My Files & What I've Done

I have looked through countless posts on this same issue. My tnsnames.ora, listener.ora, & sqlnet.ora are located in this directory: C:\oracle\product\11.2.0\dbhome\NETWORK\ADMIN

My connection in my tnsnames.ora file looks like this (I have also tried to put my computer name as the HOST, instead of 127.0.0.1)...

DEV =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = DEV)
  )
 )
Run Code Online (Sandbox Code Playgroud)

PATH Variables

I added the following to my PATH (I realize there may be some unnecessary item in there, I just wanted to be on the safe side. ): C:\oracle\product\11.2.0\dbhome\bin;C:\oracle\product\11.2.0\client_1;C:\oracle\product\11.2.0\client_1\bin;%ORACLE_HOME%\bin;

I also created two more variables in my System Variables...

TNS_ADMIN C:\oracle\product\11.2.0\dbhome\NETWORK\ADMIN

TNS_NAMES C:\oracle\product\11.2.0\dbhome\NETWORK\ADMIN

kub*_*zyk 6

Use this on Windows (three nested double quotes):

exp system/password_for_system@dev file=c:\fooadmin.dmp full=yes

imp """sys/password12345@dev as sysdba""" FROMUSER=FOOADMIN TOUSER=FOOADMIN file=c:\fooadmin.dmp
Run Code Online (Sandbox Code Playgroud)

In general imp would work as intended with sys account, it is just not recommended. But exp with sys account could possibly produce inconsistent dump file silently. So it's better to avoid it, for example use system.