天天看點

linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】

今天同僚在外地讓幫忙導出一下資料庫執行個體,因為不了解他負責的那一塊,是以出了一些問題,總結如下:

oracle使用者遠端登入資料庫伺服器上,執行下圖紅框中的指令1,報錯如下圖紅框2:

linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】
linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】

看到這一句之後【ORA-12154: TNS:could not resolve the connect identifier specified】百思不得其解,

因為我在本地自己的電腦,用同樣的使用者名密碼和執行個體名【sun_test】,可以用plsql登入資料庫,為啥會報錯identifier錯誤。

下圖為我本地的tnsnames.ora檔案的配置,執行個體名sun_test

linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】
linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】

=============================================================================================

後來我檢視了伺服器的tnsnames.ora檔案,發現如下圖

linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】
linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】

後來我把語句改成

>exp giccard/[email protected]_cardfs file=/home/oracle/20150703.dmp full=y

linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】
linux下導出oracle時報錯【ORA-12154: TNS:could not resolve the connect identifier specified】

就一切OK了,看來,在伺服器本地導出檔案時要用伺服器本地的連接配接名