http://space.itpub.net/9252210/viewspace-594453
今天在做數據導出的時候,由于用戶名的密碼使用的是特殊字符,所以遇到了錯誤
代碼:“EXP-00056: 遇到
ORACLE 錯誤 12154”,網上查找原因,需要用引號擴起來,但是os不同,方式也不同:
windows os: exp username/"""password"""@devdb --3個雙引號擴密碼
linux/unix os: exp 'username/"password"@devdb' --1個雙引號擴密碼,1個單引號擴全部
實驗結果如下:
1.創建帶有特殊字符密碼的用戶
C:\Documents and Settings\Home>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 5月 7 17:37:36 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connsys/oracle@devdbas sysdba
已連接。
SQL> create user exp identified by "12345!@#$%";
用戶已創建。
SQL> grant connect, resource to exp;
授權成功。
SQL> conn exp/"12345!@#$%"@devdb2
已連接。
SQL> create table table1 as select * from dual;
表已創建。
SQL> exit
2.windows os導出測試
C:\Documents and Settings\Home>expexp/12345!@#$%@devdbfile=c:\exp.dmp wner=exp
Export: Release 9.2.0.1.0 - Production on 星期四 5月 7 17:39:42 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
EXP-00056: 遇到 ORACLE 錯誤 12154
ORA-12154: TNS: 無法處理服務名
EXP-00000: 導出終止失敗
C:\Documents and Settings\Home>exp exp/"12345!@#$%"@devdb2file=c:\exp.dmp wner=exp
Export: Release 9.2.0.1.0 - Production on 星期四 5月 7 17:39:57 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
EXP-00056: 遇到 ORACLE 錯誤 12154
ORA-12154: TNS: 無法處理服務名
EXP-00000: 導出終止失敗
C:\Documents and Settings\Home>exp exp/"""12345!@#$%"""@devdb2file=c:\exp.dmp wner=exp
Export: Release 9.2.0.1.0 - Production on 星期四 5月 7 17:41:54 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
已導出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集
. 正在導出 pre-schema 過程對象和操作
. 正在導出用戶 EXP 的外部函數庫名稱
. 導出 PUBLIC 類型同義詞
. 導出私有類型同義詞
. 正在導出用戶 EXP 的對象類型定義
即將導出 EXP 的對象 ...
. 正在導出數據庫鏈接
. 正在導出序號
. 正在導出群集定義
. 即將導出 EXP 的表通過常規路徑 ...
. . 正在導出表 TABLE1 1 行被導出
. 正在導出同義詞
. 正在導出視圖
. 正在導出存儲的過程
. 正在導出運算符
. 正在導出引用完整性約束條件
. 正在導出觸發器
. 正在導出索引類型
. 正在導出位圖, 功能性索引和可擴展索引
. 正在導出后期表活動
. 正在導出實體化視圖
. 正在導出快照日志
. 正在導出作業隊列
. 正在導出刷新組和子組
. 正在導出維
. 正在導出 post-schema 過程對象和操作
. 正在導出統計
在沒有警告的情況下成功終止導出。
3.linux/unix os導出測試
[oracle@rac2 ~]$ expexp/12345!@#$%@devdbfile=./exp.dmp wner=exp
-bash:!@#$%@devdb: event not found
[oracle@rac2 ~]$ exp exp/"""12345!@#$%"""@devdbfile=./exp.dmp wner=exp
-bash:!@#$%"""@devdb: event not found
[oracle@rac2 ~]$exp 'exp/"12345!@#$%"@devdb'file=./exp.dmp wner=exp
Export: Release 10.2.0.4.0 - Production on Thu May 7 19:21:32 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user EXP
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user EXP
About to export EXP's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export EXP's tables via Conventional Path ...
. . exporting table TABLE1 1 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.