Skip to main content
oracleUncategorized

Changing password of common user whereas one PDB closed

By January 12, 2015October 7th, 2016No Comments2 min read

Overview: In this scenario you change the password of a common user whereas one PDB is closed. What happens when you open the PDB and need to connect under this user to the PDB ?

[oracle@12casm ~]$ . oraenv
ORACLE_SID = [cdb1] ? cdb1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@12casm ~]$ sqlplus /nolog
SQL> connect sys/[email protected]:1521/cdb1 as sysdba
SQL> select name,open_mode from v$database;
SQL> select name,open_mode from v$pdbs;
NAME                                   OPEN_MODE
------------------------------              ----------
PDB$SEED                           READ ONLY
PDB1                                     MOUNTED
PDB2                                     MOUNTED
PDB3                                     MOUNTED
SQL> alter pluggable database pdb1 open;
Pluggable database altered.
SQL> create user c##1 identified by oracle container=all;
User created.
SQL> grant create session to c##1 CONTAINER=ALL;
Grant succeeded.
SQL> select distinct username from cdb_users where username='C##1 ';
no rows selected
SQL> select username, common, con_id from cdb_users where username like 'C##%';
USERNAME        COM     CON_ID
--- ----------------------------------------
C##1                      YES         1
C##1                      YES         3
SQL> select name,con_id,open_mode from v$pdbs;
NAME                               CON_ID OPEN_MODE
------------------------------ ---------- ----------------------
PDB$SEED                                          2              READ ONLY
PDB1                                   3              READ WRITE
PDB2                                   4              MOUNTED
PDB3                                   5              MOUNTED
SQL> grant create session to c##1 container=all;
Grant succeeded.
SQL> connect c##1/oracle@localhost:1521/pdb1;
Connected.
SQL> connect sys/[email protected]:1521/cdb1 as sysdba
Connected.
SQL> alter pluggable database pdb1 close;
Pluggable database altered.
SQL> alter user c##1 identified by oracle123;
User altered.
SQL> alter pluggable database pdb1 open;
Pluggable database altered.
SQL> connect c##1/oracle@localhost:1521/pdb1;
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
SQL> connect c##1/oracle123@localhost:1521/pdb1;
Connected.

 

Result: The change to the common user waits for PDB4 to be opened and then is applied.

Leave a Reply