有使用者問到這樣一個問題,在進行匯出操作時如何轉義口令中的@符號?
由於預設的Oracle會將@符號後面的字串當作服務名來解析,所以不加處理是不行的。
有的企業因為安全規則的需要,口令中都會加入@符號。
假定使用者口令如下:
SQL> alter user eygle identified by "eygle@com";
User altered.
如果預設匯出會出現如下錯誤:
[oracle@jumper oracle]$ exp eygle/eygle@com file=eygle.dmp tables=test
Export: Release 9.2.0.4.0 - Production on Fri Jan 4 11:17:48 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
EXP-00056: ORACLE error 12154 encountered
ORA-12154: TNS:could not resolve service name
EXP-00000: Export terminated unsuccessfully
通過轉義,可以成功匯出:
[oracle@jumper oracle]$ exp eygle/\"eygle@com\" file=eygle.dmp tables=test
Export: Release 9.2.0.4.0 - Production on Fri Jan 4 11:12:10 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table TEST 4136 rows exported
-The End-