Oracle 12c – How to Create PDB Manager User

oracleoracle-12c

I create user C##ADMIN in database for manage pdbs .

sqlplsqlplus sys/rootpass@172.17.0.2/orcl as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Sat May 26 15:17:09 2018

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> create user C##ADMIN identified by adminpass container=all ;

User created.

SQL> GRANT CREATE SESSION, SYSOPER,PDB_DBA,DBA, CREATE PLUGGABLE DATABASE TO c##admin CONTAINER=ALL ;

Grant succeeded.

SQL> 

My problem is C##ADMIN user can not list pdbs !

sqlplus C##admin/adminpass@172.17.0.2/orcl

SQL*Plus: Release 12.1.0.2.0 Production on Sat May 26 15:20:14 2018

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

Last Successful login time: Sat May 26 2018 15:17:32 +04:30

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select pdb_name,status from cdb_pdbs;

no rows selected

SQL> 

Which permission is forgotten?

Best Answer

How the Oracle Multitenant Option Affects Privileges

A common user connected to the root can see metadata pertaining to PDBs by way of the container data objects (for example, multitenant container database (CDB) views and V$ views) in the root, provided that the common user has been granted privileges required to access these views and his CONTAINER_DATA attribute has been set to allow seeing data about various PDBs.

SQL> create user C##ADMIN identified by adminpass container=all ;

User created.

SQL> GRANT CREATE SESSION, SYSOPER,PDB_DBA,DBA, CREATE PLUGGABLE DATABASE TO c##admin CONTAINER=ALL ;

Grant succeeded.

SQL> conn C##ADMIN/adminpass
Connected.
SQL> select PDB_NAME from cdb_pdbs;

no rows selected

Granting the required privilege:

SQL> conn / as sysdba
Connected.
SQL> alter user c##admin set container_data=all for cdb_pdbs container=current;

User altered.

SQL> conn C##ADMIN/adminpass
Connected.
SQL> select PDB_NAME from cdb_pdbs;

PDB_NAME
---------
PDB$SEED
PDB1