Oracle

無法在 Docker 上轉儲 Oracle 中的數據庫

  • February 17, 2020

Oracle 在 Docker 上執行良好,我可以毫無問題地從 sqlDeveloper 連接,但我無法在 bash 命令行中將數據庫日誌轉儲到 Docker 中。

跑:

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

我得到:

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

解決此頁面上的 ORA-12547 錯誤我看到最可能的選項是 Oracle 沒有權限:

ORA-12547 錯誤的可能解決方案包括:

  • 錯誤的核心參數設置(例如“ulimit”設置太小)
  • ORACLE 執行檔 ($ORACLE_HOME/bin/oracle.exe) 的權限不正確
  • $ORACLE_HOME/rdbms/lib/config.o 為 0 字節
  • Oracle 二進製文件未正確連結

哪些使用者需要訪問$ORACLE_HOME/bin/oracle.exe

我能夠複製錯誤。沒有使用者名參數的第一次登錄到 docker 容器(您將以 root 使用者身份登錄)

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

我將添加使用者參數並記住架構在 pdb 中,您需要在 expdp 中添加連接標識符

   C:\>docker exec -it -u oracle xedbd bash
   [oracle@89feb4161c93 /]$ expdp system/oracle@xepdb1 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

引用自:https://dba.stackexchange.com/questions/259850