Cannot dump database in Oracle on Docker

All we need is an easy explanation of the problem, so here it is.

Oracle is working fine on Docker, I can connect from sqlDeveloper with no problem, but I cannot dump the database logging into Docker in the bash command line.

Runnung:

expdp CONFIG0001-TEST/xxxxxxx DIRECTORY=backups DUMPFILE=dumpfile.dmp 
      LOGFILE=config_export.log SCHEMAS=CONFIG0001-TEST

I get:

UDE-12547: operation generated ORACLE error 12547
ORA-12547: TNS:lost contact

Troubleshooting the ORA-12547 error on this page I see that the most likely option is that Oracle doesn’t have permission:

Possible solutions to to the ORA-12547 error include:

  • Bad kernel parameters settings (e.g. “ulimit” set too small)
  • Incorrect permissions on the ORACLE executable ($ORACLE_HOME/bin/oracle.exe)
  • $ORACLE_HOME/rdbms/lib/config.o is 0 bytes
  • Oracle binaries have not been linked correctly

What user needs to have access to $ORACLE_HOME/bin/oracle.exe ?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I was able to replicate the error.First login without username parameter into docker container(you’ll logged in as root user)

C:\>docker exec -it xedbd bash
bash-4.2# expdp system/oracle  dumpfile=test01.dmp directory=DATA_PUMP_DIR logfile=test.log

Export: Release 18.0.0.0.0 - Production on Mon Feb 17 21:22:19 2020
Version 18.4.0.0.0

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

UDE-12547: operation generated ORACLE error 12547
ORA-12547: TNS:lost contact

I’ll add user parameter and remember the schema is in pdb you need to add connect identifier in expdp

    C:\>docker exec -it -u oracle xedbd bash
    [[email protected] /]$ expdp system/[email protected] dumpfile=test01.dmp directory=DATA_PUMP_DIR logfile=test.log schemas=test

    Export: Release 18.0.0.0.0 - Production on Mon Feb 17 21:24:12 2020
    Version 18.4.0.0.0

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

    Connected to: Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
    Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/********@xepdb1 dumpfile=test01.dmp directory=DATA_PUMP_DIR logfile=test.log schemas=test
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
    Processing object type SCHEMA_EXPORT/USER
    Processing object type SCHEMA_EXPORT/ROLE_GRANT
    Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
    Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
    Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    . . exported "TEST"."T1"                                 9.978 MB   72834 rows
    Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************
    Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
    /opt/oracle/admin/XE/dpdump/9ECC9107E3AE0AADE053020011AC6840/test01.dmp
    Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at Mon Feb 17 21:24:53 
   2020 elapsed 0 00:00:39

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply