Tuesday, April 10, 2018

Common users in Oracle DB 12c

In a Multi tenant database,we can create user accounts within the PDB's just like we normally do. This user is container oriented. And this user wont have any access to other containers.

For example, let we want to have a DBA account called paul that would be able to create tablespaces in any PDB. For this purpose we will have to create a new kind of user account called a common account. 

I tried earlier as:



The common account naming format is similar to a normal account name - except that it starts with a special set of characters, C## by default. Too create a common user account called paul we will have to log into the root container and use the create user command as seen here:



SQL>create user c##paul identified by ; 

When the grant is issued from the ROOT container, the default scope of that grant is just to the ROOT container.  When a common user account is created, the account is created in all of the open PDB's of the pluggable database. At the same time, the account is not granted any privileges. 

To provide the connection permission to this user for all available pdbs:

grant create session to c##paul container=all;

Or, we can use:
create user c##paul identified by oracle container=all;


Then we will have to grant sysdba role to c#paul for all container.
grant sysdba to c##paul container=all;

No comments: