Search code examples
oracle-databaseoracle-sqldevelopersqlplusoracle12c

Cannot connect to new user just created on oracle on docker (ORA-01017)


I'm trying to use Oracle 12c on Ubuntu 18 to study for my work.

For it, I'm using docker-compose file I used to create in other PCs.

version: '2'
services:
 database:
   image: store/oracle/database-enterprise:12.2.0.1
   volumes:
     - ./data:/ORCL # persistent oracle database data.
   ports:
     - 1529:1521
     - 8082:8080
     - 5500:5500

After install, I can login as sysadmin and I enter those codes below to create a user.

ALTER SESSION SET CONTAINER = ORCLPDB1;
CREATE USER BUS IDENTIFIED BY DEMO_PASS;
GRANT CONNECT TO BUS;

and then, I try to connect to it.

sqlplus BUS/DEMO_PASS@localhost:1529/ORCLCDB.localdomain

I want to login as could in other PCs but instead of this, I'm getting this error.

ORA-01017: invalid username/password; logon denied

Solution

  • You're connecting to the wrong database - ORCLDB.localdomain is the service for the CONTAINER database.

    You did a, alter session set container = ORCLPDB1 => that is the database you want to connect to, so try

    sqlplus BUS/DEMO_PASS@localhost:1529/ORCLPDB1 
    

    Also if you're looking for a more user friendly CLI for Oracle, we build SQLcl.