docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

ERROR: ORA-12547: TNS:lost contact

Open ChrisJBurns opened this issue 5 years ago • 19 comments

So I have cloned this repo and built the oracle/database:12.2.0.1-ee image locally. Everything worked fine.

Now I am trying to run this built image with the following docker-compose file:

oracle:
    image: oracle/database:12.2.0.1-ee
    container_name: oracle
    volumes:
      - oracle:/opt/oracle/oradata # persistent oracle database data.
    ports:
      - 1521:1521
      - 8080:8080
      - 5500:5500

volumes:
  oracle:
    name: oracle

In the docker-compose file I am doing nothing special, just the standard stuff I saw in the sample docker-compose file in this repo. The only difference is that I am using a named value to get over the permissions issues that I've seen on the issues board. However, that being said, when I run the docker-compose file with docker-compose up, I receive the below.

ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: qLAVE9zSuQw=1

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 14-AUG-2020 22:59:35

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

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

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /opt/oracle/product/12.2.0.1/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/e7bde90b6c02/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.2.0.1.0 - Production
Start Date                14-AUG-2020 22:59:35
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.2.0.1/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/e7bde90b6c02/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
[WARNING] [DBT-11209] Current available physical memory is less than the required physical memory (2,048MB) for creating the database.
[WARNING] [DBT-10102] The listener configuration is not selected for the database. EM DB Express URL will not be accessible.
   CAUSE: The database should be registered with a listener in order to access the EM DB Express URL.
   ACTION: Select a listener to be registered or created with the database.
Copying database files
1% complete
2% complete
DBCA Operation failed.
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
[ 2020-08-14 22:59:40.071 UTC ] Copying database files
DBCA_PROGRESS : 1%
[ 2020-08-14 22:59:40.263 UTC ] ORA-12547: TNS:lost contact

DBCA_PROGRESS : 2%
[ 2020-08-14 22:59:40.421 UTC ] Error while cataloging RMAN Backups
[ 2020-08-14 22:59:40.526 UTC ] DBCA_PROGRESS : DBCA Operation failed.

SQL*Plus: Release 12.2.0.1.0 Production on Fri Aug 14 22:59:40 2020

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

ERROR:
ORA-12547: TNS:lost contact


Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
      <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
Enter user-name: SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
      <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
mv: cannot stat '/opt/oracle/product/12.2.0.1/dbhome_1/dbs/spfileORCLCDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/12.2.0.1/dbhome_1/dbs/orapwORCLCDB': No such file or directory
ORACLE_HOME = [/home/oracle] ? ORACLE_BASE environment variable is not being set since this
information is not available for the current user ID .
You can set ORACLE_BASE manually if it is required.
Resetting ORACLE_BASE to its previous value or ORACLE_HOME
The Oracle base remains unchanged with value /opt/oracle
/opt/oracle/checkDBStatus.sh: line 26: sqlplus: command not found
#####################################
########### E R R O R ###############
DATABASE SETUP WAS NOT SUCCESSFUL!
Please check output for further info!
########### E R R O R ###############
#####################################
The following output is now a tail of the alert.log:
tail: cannot open '/opt/oracle/diag/rdbms/*/*/trace/alert*.log' for reading: No such file or directory
tail: no files remaining

FYI I have a storage driver of overlay2 (I'm running a mac using Catalina) which I've seen mentioned on a few issues, so I don't think it's that.

More information, the reason I am using this custom built image instead is because Partitioning is disabled on the pre-built image on DockerHub Store, and I just wanted to see if it was included in the image I built from this repository. However in efforts to just see if that was the case, I've spend the last few hours tackling with just getting this image to run.

I've seen across the issues that '/opt/oracle/product/12.2.0.1/dbhome_1/dbs/orapwORCLCDB': No such file or directory means that its a permissions issues however using the named volume I thought would resolve this. Open to suggestions.

ChrisJBurns avatar Aug 14 '20 23:08 ChrisJBurns

This is likely your issue.

[WARNING] [DBT-11209] Current available physical memory is less than the required physical memory (2,048MB) for creating the database.

bkenn avatar Aug 18 '20 20:08 bkenn

This is likely your issue.

[WARNING] [DBT-11209] Current available physical memory is less than the required physical memory (2,048MB) for creating the database.

I'm not too sure about that, if it was the reason for the failing I would expect an [ERROR] as opposed to a [WARNING]. Besides, I removed all volumes on my laptop before running the docker-compose up so I don't believe it could be a space issue.

ChrisJBurns avatar Aug 18 '20 20:08 ChrisJBurns

Were you able to solve this? I have the exact same issue, fixed the memory warning but still the same.

mcaxtr avatar Sep 03 '20 02:09 mcaxtr

@mcaxtr Not yet, I've retried on a different laptop and get the same errors. I just awaiting @gvenzl response as he seems to be the main source of knowledge in this area.

ChrisJBurns avatar Sep 05 '20 14:09 ChrisJBurns

The database setup for some reason fails with an error:

Copying database files
1% complete
2% complete
DBCA Operation failed.
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.

Can you check the log file, please? There should also be a *.trc file in /opt/oracle/cfgtoollogs/dbca/ORCLCDB or a sub-directory that has more details, please provide both.

gvenzl avatar Oct 16 '20 19:10 gvenzl

@gvenzl

So it's not easy to get the logs for ORCLDB.log due to the container quickly being shut down after the docker-compose up fails. However a cat returns the following:

/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log:

[oracle@f0542cc4c03c ~]$ cat /opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log
[ 2020-10-18 17:26:22.145 UTC ] Copying database files
DBCA_PROGRESS : 1%
[ 2020-10-18 17:26:22.384 UTC ] ORA-12547: TNS:lost contact

DBCA_PROGRESS : 2%
[ 2020-10-18 17:26:22.546 UTC ] Error while cataloging RMAN Backups
[ 2020-10-18 17:26:22.662 UTC ] DBCA_PROGRESS : DBCA Operation failed.
[oracle@f0542cc4c03c ~]$ cat /opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log
[ 2020-10-18 17:26:22.145 UTC ] Copying database files
DBCA_PROGRESS : 1%
[ 2020-10-18 17:26:22.384 UTC ] ORA-12547: TNS:lost contact

DBCA_PROGRESS : 2%
[ 2020-10-18 17:26:22.546 UTC ] Error while cataloging RMAN Backups
[ 2020-10-18 17:26:22.662 UTC ] DBCA_PROGRESS : DBCA Operation failed.

Additionally, when trying to find the *.trc files, when performing a ls -al /opt/oracle/cfgtoollogs/dbca/ORCLCDB/I only got the following. So no *.trc files

drwxr-x--- 2 oracle oinstall     4096 Oct 18 17:28 .
drwxr-x--- 3 oracle oinstall     4096 Oct 18 17:28 ..
-rw-r----- 1 oracle oinstall      172 Oct 18 17:28 CloneRmanRestore.log
-rw-r----- 1 oracle oinstall      293 Oct 18 17:28 ORCLCDB.log
-rw-r----- 1 oracle oinstall     2122 Oct 18 17:28 initORCLCDBTempOMF.ora
-rw-r----- 1 oracle oinstall 18726912 Oct 18 17:28 tempControl.ctl
-rw-r----- 1 oracle oinstall   862962 Oct 18 17:28 trace.log_2020-10-18_05-28-33-PM

ChrisJBurns avatar Oct 18 '20 17:10 ChrisJBurns

Thanks @ChrisJBurns, can you please retrieve and post the trace.log* file (sorry, thought it ended with *.trc)? Unfortunately, the log file doesn' tell us much new.

gvenzl avatar Oct 21 '20 18:10 gvenzl

@gvenzl

Yep, can do. It's very large the output.. not sure if you want me to hone in on a specific part of the log. I've attached a gist as it exceeds the comment character limit.

https://gist.github.com/ChrisJBurns/3dd26f04d9ae4f397b55dc18d85fc113

ChrisJBurns avatar Oct 21 '20 18:10 ChrisJBurns

@ChrisJBurns I had the same issue and it was because of the memory. I had to delete the docker image and recreate it with increased memory. docker rmi oracle/database:12.2.0.1-ee

emjaksa avatar Oct 22 '20 05:10 emjaksa

Is this still an issue?

Djelibeybi avatar Dec 04 '20 21:12 Djelibeybi

As far as I'm aware yes. I will try again and let you know just for clarity. But I believe the same outcome with occur.

ChrisJBurns avatar Dec 04 '20 22:12 ChrisJBurns

Just a note that Docker Desktop for Mac (and Windows) do weird things with the filesystem and networking due to their reliance on a hidden LinuxKit VM in which Docker is actually running.

You may have a better experience on a Mac or Windows using our Oracle Database Vagrant project instead, which leverages Vagrant to deploy Oracle Database inside an Oracle VM VirtualBox instance.

Djelibeybi avatar Dec 04 '20 22:12 Djelibeybi

I'll give it another try with more memory as suggested above.👍🏼 I'm currently AFK until Sunday, will update here with results.

ChrisJBurns avatar Dec 07 '20 19:12 ChrisJBurns

I met a similar error and turns out it is because I run as root and the mounted folder is under root permission, and the oracle user inside the container has no permission to write to the target folder. I resolve it by changing the folder owner to oracle user (uid 54321).

lappun avatar Dec 16 '20 07:12 lappun

Faced same issue since yesterday. Eventually, downgrading Docker desktop for mac from 3.2.1 to 3.0.0 unblocked me.

Container logs showed below message oracledb | ERROR: oracledb | ORA-12547: TNS:lost contact oracledb | ORA-12547: TNS:lost contact oracledb | LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-MAR-2021 16:31:14

milansutaria avatar Mar 11 '21 00:03 milansutaria

This issue is still present for me on an M1 mac using the latest docker desktop (3.3.1). Has there been any progress on this?

ellienieuwdorp avatar Apr 15 '21 23:04 ellienieuwdorp

@ChrisJBurns Any follow-up on this? I have the same issue, but it might be because I'm on AWS with t2.micro instance.

ChristophorusReyhan avatar May 05 '21 08:05 ChristophorusReyhan

I've not checked in a few weeks, I'm now on a separate project. But I was always unable to get it working. I had the same error as my original description.

ChrisJBurns avatar May 05 '21 20:05 ChrisJBurns

@ChrisJBurns I see, thank you for the response

ChristophorusReyhan avatar May 06 '21 03:05 ChristophorusReyhan

This issue is still present for me on an M1 mac using the latest docker desktop (3.3.1). Has there been any progress on this?

almost 2 years after the issue is still present. There's no hope for fix, I guess

Vergil333 avatar Feb 06 '23 12:02 Vergil333

@Vergil333 the "TNS:lost contact" message is a generic error raised when the Database Configuration Assistant can't create the database. In the case of the OP, the relevant accompanying error was likely a lack of memory. In your case, it's probably an OS compatibility issue that requires re-engineering the build/image for Apple Silicon. The output of the DBCA log would help confirm.

For anyone struggling to capture log/trace output from a container, try mounting the diagnostic directory to a local volume: -v /some/local/directory:/opt/oracle/diag That persists all the log files the database generates. They remain available locally even if the container exits. It also prevents the logs from polluting the container's runtime layer, which should receive as few filesystem changes as possible.

oraclesean avatar Feb 06 '23 14:02 oraclesean

Is this still an issue. We now have 19c ARM image available to try on Apple Silicon docker pull container-registry.oracle.com/database/enterprise:19.19.0.0

Closing this issue for now. Reopen if needed.

yunus-qureshi avatar Jul 28 '23 11:07 yunus-qureshi