【问题标题】:Expdp with special character @ password resulting in error带有特殊字符@密码的expdp导致错误
【发布时间】:2021-11-22 23:49:31
【问题描述】:

我有一组新的盒子,我需要在其中复制 export , 所有这些机器都有系统用户密码和复杂的东西,比如@等。

例如:

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 看起来不错并且能够解决我相信这与密码有关@我尝试将密码放在双引号中,将转义字符添加到特殊字符等,但没有工作任何指导都会很棒

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

编辑:正如这里建议的那样,我尝试过但没有奏效,仍然抛出同样的错误

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

【问题讨论】:

  • @DmitryDemin OP声明“我已尝试将密码放在双引号中”。您确定该解决方案也适用于EXPDP 吗?如果您随后投票将其作为重复项关闭;如果您不是,那么 SQL/Plus 的解决方案可能不适用于 EXPDP
  • @GBA_Switch 请edit您的问题显示您尝试使用引号/转义字符的选项。你说它“不起作用”,但如果你把引号放在错误的地方,那可能就是原因。
  • 您需要使用双引号并像这样保护特殊字符:\@
  • 为什么要让自己扭曲以试图正确地逃避问题角色?只需更改密码,以便其中没有“@”。当您使用它时,请确保它也没有“$”或“%”,因为这些可能会导致 *nix 中的 shell 处理器或 Windblows 中的命令处理器出现问题。当您使用它时,请修改密码复杂性功能以首先禁止这些字符。

标签: oracle passwords oracle12c tnsnames


【解决方案1】:
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

【讨论】:

  • 感谢您的时间,因为有时间限制的活动我已经通过授予用户(他们没有复杂的密码)必要的权限来完成任务......但我会在未来尝试这种 par 文件方法操作并将在此处更新
猜你喜欢
  • 2020-02-07
  • 1970-01-01
  • 2020-10-05
  • 2021-10-12
  • 2014-03-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多