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

> Hi @oeMoe, can you please share how you call SQL*Plus? Is it just `sqlplus / as sysdba`? I think the issue is related with the `root` user which is the user to be logged into the container. However, the database is running under the `oracle` user and therefore `sqlplus / as sysdba` cannot attach to the process.

Open callmehalpha opened this issue 4 years ago • 8 comments

Hi @oeMoe, can you please share how you call SQL*Plus? Is it just sqlplus / as sysdba? I think the issue is related with the root user which is the user to be logged into the container. However, the database is running under the oracle user and therefore sqlplus / as sysdba cannot attach to the process. However, you should be able to log on using a connection string, e.g.: sqlplus sys/LetsDocker@//localhost:1521/XE as sysdba

I'm having same issue and i'm not getting this solution what do you mean by connection string ?

Originally posted by @President-Temitope in https://github.com/oracle/docker-images/issues/332#issuecomment-864141289

callmehalpha avatar Jun 18 '21 16:06 callmehalpha

me too , i have follow on docker pull store/oracle/database-enterprise:12.2.0.1

Enter user-name: sys
Enter password:
ERROR:
ORA-12547: TNS:lost contact
sh-4.2$ ls -l $ORACLE_HOME/bin/oracle
-rwxr-x--x 1 oracle oinstall 395722363 Mar  2  2017 /u01/app/oracle/product/12.2.0/dbhome_1/bin/oracle
sh-4.2$ chmod u+s $ORACLE_HOME/bin/oracle
sh-4.2$
sh-4.2$ ls -l $ORACLE_HOME/bin/oracle
-rwsr-x--x 1 oracle oinstall 395722363 Mar  2  2017 /u01/app/oracle/product/12.2.0/dbhome_1/bin/oracle
sh-4.2$ su

[oracle@e859f5f6994c /]$ ls -l $ORACLE_HOME/bin/oracle
-rwsr-x--x 1 oracle oinstall 395722363 Mar  2  2017 /u01/app/oracle/product/12.2.0/dbhome_1/bin/oracle

yogithesymbian avatar Jun 25 '21 07:06 yogithesymbian

my full log on docker GUI

Setup Oracle Database
Oracle Database 12.2.0.1 Setup
Fri Jun 25 07:11:32 UTC 2021

Check parameters ......
log file is : /home/oracle/setup/log/paramChk.log
paramChk.sh is done at 0 sec

untar DB bits ......
log file is : /home/oracle/setup/log/untarDB.log

untarDB.sh is done at 59 sec

config DB ......
log file is : /home/oracle/setup/log/configDB.log

Fri Jun 25 07:12:31 UTC 2021
Start Docker DB configuration
Call configDBora.sh to configure database
Fri Jun 25 07:12:31 UTC 2021
Configure DB as oracle user
Setup Database directories ...

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 25 07:12:32 2021

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: Enter password: 
ERROR:
ORA-12547: TNS:lost contact


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
update password

Enter password for SYS: 
create pdb : ORCLPDB1

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 25 07:12:32 2021


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
Reset Database parameters

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 25 07:12:32 2021

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: Enter password: 
ERROR:
ORA-12547: TNS:lost contact


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 25-JUN-2021 07:12:33

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

Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/e859f5f6994c/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                25-JUN-2021 07:12:33
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/e859f5f6994c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

DONE!
Remove password info
Docker DB configuration is complete !

ERROR : config DB failed, please check log /home/oracle/setup/log/configDB.log for details!

JIT: pid 5408 requesting stop
2017-08-08T17:41:41.417556+00:00
ARCH: Archival disabled due to shutdown: 1090
Shutting down archive processes
Archiving is disabled
JIT: pid 5408 requesting stop
2017-08-08T17:41:41.436309+00:00

Stopping background process VKTM
2017-08-08T17:41:47.017665+00:00
Instance shutdown complete (OS id: 5408)
/usr/bin/tail: inotify cannot be used, reverting to polling: Function not implemented

yogithesymbian avatar Jun 25 '21 07:06 yogithesymbian

[oracle@e859f5f6994c /]$ cd $ORACLE_HOME/bin
[oracle@e859f5f6994c bin]$ ls -ltr oracle
-rwsr-x--x 1 oracle oinstall 395722363 Mar  2  2017 oracle
[oracle@e859f5f6994c bin]$ cd $ORACLE_HOME/bin
[oracle@e859f5f6994c bin]$ chmod 6751 oracle
[oracle@e859f5f6994c bin]$ ls -ltr oracle
-rwsr-s--x 1 oracle oinstall 395722363 Mar  2  2017 oracle
[oracle@e859f5f6994c bin]$ sqlplus sys/Oradoc_db1@ORCLCDB as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 25 07:23:33 2021

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

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Enter user-name: sys
Enter password:
ERROR:
ORA-12547: TNS:lost contact


Enter user-name:
ERROR:
ORA-12547: TNS:lost contact


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@e859f5f6994c bin]$
[oracle@e859f5f6994c bin]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 25 07:23:47 2021

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

SQL> connect sys as sysdba;
Enter password:
ERROR:
ORA-12547: TNS:lost contact


SQL>

yogithesymbian avatar Jun 25 '21 07:06 yogithesymbian

I later connected to it using sql developer

callmehalpha avatar Jun 25 '21 10:06 callmehalpha

I already posted this issue here (https://github.com/oracle/docker-images/issues/2046). If you are using windows or mac with docker and using host mounted filesystems you would not be able to login as sys, because you cannot still change file ownership for os mounted filesystems. This is a docker "bug" on those systems. Key files that ar responsible of managing sys password is owned by root, and oracle requires it to be owned by user oracle, but you cannot change the ownership of those files. The solution is to mount everything as volumes, non host shared, and change file ownership accordingly. Also you will get a boost in performance, as shared host volumes are very low performant on windows and mac. Details here: https://github.com/docker/for-win/issues/4824

The issue is that windows, and I think this also affects mac, expose all mounted os volumes as owned by root and with 777 file permissions, you can try to chown those files as many times you want, they will always be exposed to docker as owned by root user, not oracle.

yevon avatar Sep 17 '21 13:09 yevon

I already posted this issue here (#2046). If you are using windows or mac with docker and using host mounted filesystems you would not be able to login as sys, because you cannot still change file ownership for os mounted filesystems. This is a docker "bug" on those systems. Key files that ar responsible of managing sys password is owned by root, and oracle requires it to be owned by user oracle, but you cannot change the ownership of those files. The solution is to mount everything as volumes, non host shared, and change file ownership accordingly. Also you will get a boost in performance, as shared host volumes are very low performant on windows and mac. Details here: docker/for-win#4824

The issue is that windows, and I think this also affects mac, expose all mounted os volumes as owned by root and with 777 file permissions, you can try to chown those files as many times you want, they will always be exposed to docker as owned by root user, not oracle.

I've treid it on 3 last month ago, with change all permission to 777 but still 've the problem.

yogithesymbian avatar Sep 17 '21 21:09 yogithesymbian

Just make sure that the owner and the group is oracle, is not enought setting 777 permissions

yevon avatar Sep 17 '21 23:09 yevon

which dir`s owner and group

Charion-cz avatar Jul 12 '23 16:07 Charion-cz