无法在docker容器外部连接到oracle:12.1.0.2

时间:2019-09-30 06:59:46

标签: linux oracle docker oracle12c

oracle容器上次日志:

SQL> Mon Sep 30 06:06:45 2019
Shutting down instance (immediate)
Stopping background process SMCO
Shutting down instance: further logons disabled
Mon Sep 30 06:06:46 2019
Stopping background process CJQ0
Stopping background process MMNL
Stopping background process MMON
License high water mark = 13
Mon Sep 30 06:06:48 2019
Stopping Job queue slave processes, flags = 7
Mon Sep 30 06:06:48 2019
Job queue slave processes stopped
All dispatchers and shared servers shutdown
ALTER DATABASE CLOSE NORMAL
Mon Sep 30 06:06:50 2019
Mon Sep 30 06:06:50 2019
SMON: disabling tx recoveryStopping Emon pool

Stopping Emon pool
Mon Sep 30 06:06:50 2019
SMON: disabling cache recovery
Database closed.
Database dismounted.
Mon Sep 30 06:06:51 2019
Shutting down archive processes
Archiving is disabled
Mon Sep 30 06:06:51 2019
Thread 1 closed at log sequence 21
Successful close of redo thread 1
Completed: ALTER DATABASE CLOSE NORMAL
ALTER DATABASE DISMOUNT
Shutting down archive processes
Archiving is disabled
Completed: ALTER DATABASE DISMOUNT
Mon Sep 30 06:06:52 2019
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-SEP-2019 06:08:37

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting /opt/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/97ffb86e57bb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                30-SEP-2019 06:08:38
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/97ffb86e57bb/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
The listener supports no services
The command completed successfully

SQL*Plus: Release 12.1.0.2.0 Production on Mon Sep 30 06:08:38 2019

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size                  2924928 bytes
Variable Size             520097408 bytes
Database Buffers         1073741824 bytes
Redo Buffers               13848576 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################
The following output is now a tail of the alert.log:
AQPC started with pid=30, OS id=89 
Database Characterset for PDB$SEED is AL32UTF8
Opening pdb PDB$SEED (2) with Resource Manager plan: DEFAULT_PLAN
Database Characterset for ORCLPDB1 is AL32UTF8
Opening pdb ORCLPDB1 (3) with Resource Manager plan: DEFAULT_PLAN
Pluggable database ORCLPDB1 opened read write
Starting background process CJQ0
Mon Sep 30 06:08:48 2019
CJQ0 started with pid=31, OS id=199 
Completed: ALTER DATABASE OPEN
Mon Sep 30 06:08:49 2019
Shared IO Pool defaulting to 64MB. Trying to get it from Buffer Cache for process 61.
===========================================================
Dumping current patch information
===========================================================
No patches have been applied
===========================================================
Mon Sep 30 06:08:49 2019
db_recovery_file_dest_size of 4560 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Mon Sep 30 06:44:13 2019
Warning: VKTM detected a time drift.
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details.

内部容器: enter image description here

,它在内部可以正常工作: enter image description here

我的机器上的docker ps: enter image description here

我的机器上的端口: enter image description here

当我尝试连接时: enter image description here

该如何解决此问题?

更新:

我现在在日志文件中发现了差异:

-当容器不能正常工作时:

db_recovery_file_dest_size of 4560 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Warning: VKTM detected a time drift.
Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details.
Stopping container.
SIGTERM received, shutting down database!

-现在,当一切看起来都很好时:

db_recovery_file_dest_size of 4560 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Mon Sep 30 09:19:22 2019
Closing scheduler window
Restoring Resource Manager plan DEFAULT_PLAN via scheduler window
Setting Resource Manager plan DEFAULT_PLAN at pdb ORCLPDB1 (3) via parameter
Mon Sep 30 09:21:31 2019
XDB installed.
XDB initialized.

1 个答案:

答案 0 :(得分:1)

docker ps中,端口似乎与127.0.0.1:1521绑定。

如何启动容器?

它不应该与本地主机绑定,所以应该像

0.0.0.0:1521->1521/tcp 

正如您所提到的,它在容器内部正常工作,而不是docker run命令有问题。

尝试使用以下命令或仔细检查configuration

docker run -d -p 8080:8080 -p 1521:1521 --name OracleDB oracle

更新:

如果以上方法仍无法解决问题,则这也是在此issueoracle_database-issue-4108894中解决的oracle docker镜像问题。

或者您可以按照@Alex的步骤进行操作。

  

我按照以下步骤"Running Oracle Database Enterprise and Standard Edition 2 in a Docker container" After创建了容器   初始化后,容器在重新启动计算机之前工作正常。然后   发生了我上面描述的事情。现在我用重启了容器   更好的wi-fi连接,并且工作正常。