Search code examples
oracle-databasepasswordsoracle12ctnsnames

Expdp with special character @ password resulting in error


I have set of new boxes where I need to take a copy of export , All of this machines have system user password with complex stuff like@ etc..

Ex:

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

ERROR: UDE-12154:opertion generated oracle error 12154 ORA-12154:TNS:could not resolve the connect identifier specified

Yeah I know this looks like service name resolution issue but tnsping looks good and is able to resolve I believe this has to do with password having @I have tried putting the password in double quotes adding escape character to special characters etc but none work any guidance would be great

Also I tried with user that don't have special characters it works fine

edit : As Suggested here are things I tried and didn't work and still threw the same error

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

Solution

  • 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.
    

    Example 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
    

    Example 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