oracle / docker-images

Official source of container configurations, images, and examples for Oracle products and projects
https://developer.oracle.com/use-cases/#containers
Universal Permissive License v1.0
6.53k stars 5.42k forks source link

Failing to login using "SYS as SYSDBA" remotely to 12.2.0.1 single instance. No rows in v$pwfile_users. #1117

Closed MrRothstein closed 5 years ago

MrRothstein commented 5 years ago

After building and running a single instance database version 12.2.0.1I am unable to connect using SYS as SYSDBA remotely.

SQL> show parameter password

NAME TYPE VALUE
remote_login_passwordfile string EXCLUSIVE

SQL> select * from v$pwfile_users;

no rows selected

After manually removing the current file (link) and creating a new password file I am able to login and see SYS defined in the password file:

SQL> select username from v$pwfile_users;

USERNAME
SYS

I can see the password file being moved and linked in runOracle.sh, but I not able to follow where/when it's generated or why it ends up missing the SYS user which I believe should be there by default.

rodislav commented 5 years ago

Hello, I cannot connect as well to the db with user SYS and when I try to use sqlplus via docker exec the sql console says : Not connected

SQL> show parameter password
SP2-0640: Not connected
gvenzl commented 5 years ago

Can you please share the command(s) you are executing?

I can connect without any issues:

[oracle@ol7 dockerfiles]$ docker exec -ti 12.2.0.1-ee sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon Apr 8 09:40:33 2019

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@ol7 dockerfiles]$ docker exec -ti 12.2.0.1-ee sqlplus sys/vNdB+yzCTKs=1 as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon Apr 8 09:40:54 2019

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show parameter password

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile        string  EXCLUSIVE
SQL> 
rodislav commented 5 years ago

Hello, I was doing it as: docker exec -it oracleXE-12e bash -c "source /home/oracle/.bashrc; sqlplus /nolog" Now I tried with your example and it worked just fine.

Being here I'll mentions as well that in order to make it work in Intellij Idea, I had to set these params: SID: ORCLCDB User: sys as sysdba

gvenzl commented 5 years ago

If you want to connect via IntelliJ you should connect via the port and service name.

"sys/@//localhost:1521/ORCLCDB as sysdba" or "sys/@//localhost:1521/ORCLPDB1 as sysdba"

Connecting without password is discouraged as it only ever allows you to connect as SYS to the CDB directly but not how regular users would connect to the database.

rodislav commented 5 years ago

Hello, sure, I did used the password, is just the fact that in the User: field I had to use a text expression rather than a single value, e.g. sys as sysdba instead of sys with a separated option that would define the role.

In my particular case, I was using the dockerized db instance just to test some liquibase migrations before pushing into a protected environment.

gvenzl commented 5 years ago

Great! Closing issue.