带有特殊字符@密码的Expdp导致错误

Expdp with special character @ password resulting in error

我有一组新的盒子,我需要在其中复制一份导出文件, 所有这些机器都有系统用户密码,其中包含@等复杂的东西..

例如:

expdp system/yada@yada1233*something @hostname:portnumber/servicename
schemas=soso directory=xyz dumpfile=mydump.dmp logfile=mylog.log

错误: UDE-12154:操作生成 Oracle 错误 12154 ORA-12154:TNS: 无法解析指定的连接标识符

是的,我知道这看起来像是服务名称解析问题,但 tnsping 看起来不错并且能够解决我相信这与密码有关@我试过将密码放在双引号中,将转义字符添加到特殊字符等但是 none 工作任何指导都会很棒

我也尝试过没有特殊字符的用户,它工作正常

编辑:这里建议的是我尝试过但没有用的东西,仍然抛出同样的错误

expdp system/'yada@yada1233*something' @hostname:portnumber/servicename
schemas=soso directory=xyz dumpfile=mydump.dmp logfile=mylog.log

expdpsystem/"yada@yada1233*something*"@hostname:portnumber/servicename schemas=soso directory=xyz dumpfile=mydump.dmp logfile=mylog.log

expdp system/\"yada@yada1233*something\" @hostname:portnumber/servicename
schemas=soso directory=xyz dumpfile=mydump.dmp logfile=mylog.log

expdp system/"yada\@yada1233\*something" @hostname:portnumber/servicename
schemas=soso directory=xyz dumpfile=mydump.dmp logfile=mylog.log
SQL> create user "Scott" identified by "T@ger!"
  2  ;

User created.


SQL>  grant connect, resource to "Scott";

Grant succeeded.

SQL>  grant read,write on directory  DATA_PUMP_DIR to "Scott";

Grant succeeded.

示例 1

more  exp_dp_stroy.sh
 #!/bin/bash

export ORACLE_SID=orastb3
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1


I=`date +"%d-%m-%y"`
NAMEDUMPFILE=autotest.dmp.$I
PARFILE=/u02/script/parfile_expdp_stroy_autotest
LOG=/u02/script/parfile_expdp_log.log

$ORACLE_HOME/bin/expdp  parfile=$PARFILE  DUMPFILE = $NAMEDUMPFILE  2>$LOG



more /u02/script/parfile_expdp_stroy_autotest
USERID = \"Scott\"/\"T@ger!\"
#    username/password
#SCHEMAS    = "Scott"
DIRECTORY = DATA_PUMP_DIR
CONTENT=ALL
FLASHBACK_TIME=SYSTIMESTAMP


Export: Release 11.2.0.4.0 - Production on Fri Oct 1 17:03:32 2021

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "Scott"."SYS_EXPORT_SCHEMA_01":  "Scott"/******** parfile=/u02/script/parfile_expdp_stroy_autotest dumpfile=autotest.dmp.01-10-21.
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Master table "Scott"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for Scott.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/orastb3/dpdump/autotest.dmp.01-10-21
Job "Scott"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Oct 1 17:05:05 2021 elapsed 0 00:01:31

示例 2

more /u02/script/parfile_expdp_stroy_autotest
    USERID = \"Scott\"/\"T@ger!\"@orastb3
    #    username/password
    #SCHEMAS    = "Scott"
    DIRECTORY = DATA_PUMP_DIR
    CONTENT=ALL
    FLASHBACK_TIME=SYSTIMESTAMP

Export: Release 11.2.0.4.0 - Production on Fri Oct 1 17:26:21 2021

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "Scott"."SYS_EXPORT_SCHEMA_01":  "Scott"/********@orastb3 parfile=/u02/script/parfile_expdp_stroy_autotest dumpfile=autotest.dmp.01-10-21.
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Master table "Scott"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for Scott.SYS_EXPORT_SCHEMA_01 is:
  /u01/app/oracle/admin/orastb3/dpdump/autotest.dmp.01-10-21
Job "Scott"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Oct 1 17:26:47 2021 elapsed 0 00:00:25