Create user and assign connection permission in Database Oracle 19c

Tram Ho

Before going into the main content, we will learn through:

What is Multitenant Architecture in Oracle Database?

To make it easier to imagine I will compare the architecture of Oracle 11g and 12c at some point, from version 11g and earlier, each instance only serves 1 database so n databases I need to create n instances. With such an architecture in the situation that if there are many databases running on 1 server, there will be many redundant resources, which are not optimized.

image.png

In version 12c, Oracle introduced the concept of Multitenant, we will have a parent database Container Database (CDB), which is responsible for storing and managing common control information. In addition, we will have child databases attached to the parent database, called Pluggable databases (PDBs). This is where the real user data is stored. In a nutshell, PDBs live on CDB. CDB provides processes and memory for PDB to work

image.png

Note: CDB can also store data, but it is recommended by Oracle not to store data in CDB to avoid conflicts affecting database performance.

There is a special PDB that is generated when initializing the CDB, called the seed PDB (PDB$SEED) and it can only be read, not modified.

The management of users and permissions is a bit different from the oracle 11g environment.

In a Multitenant environment there are two types of users:

  • Common User: User used in all containers (root and all PDBs)
  • Local User: A user that is only used in a specific PDB. The same username can be created in different PDBs

Likewise there are two types of roles:

  • Common Role: This role is shared by all containers (Root and PDBs).
  • Local Role: This role is used for specific PDBs. The role name may be the same in different PDBs.
  1. Check Container name, switch Pluggable

  1. Create User, Role
  • Create User
  • Create common user on Container Database (CDB), when creating prefix C##

Note: If you don’t want to use the c## character, use the following tip

config system use the command: alter system set _common_user_prefix = ” scope=spfile;

  • Create local use

  • Create role
  • Create common roles

  • Create local roles

  • Assign role permissions to common and local users

  1. Create tablespace To deploy a new project, we need to create a new tablesapce and create an account assigning permissions on that new tablesapce for the project team to use. The purpose is to create tablespaces to easily manage the development capacity of a project.

Hope the article is helpful for those of you who are learning about Oracle database

Share the news now

Source : Viblo