Create a portable database in Oracle

Open SQL Plus

Open the SQL Plus and enter the username. Enter the username as sys as sysdba.

When you are connecting to the Oracle DB, you connect to a CDB ( Container Database) name ROOT. For checking the connection enter the below command.

show con_name;

CON_NAME
------------------------------
CDB$ROOT

Need to switch to the pluggable database, you can check the existing PDB with below command and connect to the same.

SHOW PBDS;
ALTER SESSION SET CONTAINER = XEPDB1;

Before creating a user we need to open the database with the below command.

ALTER DATABASE OPEN;

Create a user as below.

CREATE USER user_name IDENTIFIED BY user_password;

Grant permsions to the created user.

GRANT CONNECT, RESOURCE, DBA TO user_name;

With the below command you can connect to the PDB.

CONNECT user_name@XEPDB1;
Enter password:
Connected.

ALTER SESSION SET CONTAINER = BINO_DB;

ALTER SESSION SET CONTAINER = CDB$ROOT;

SELECT * FROM V$CONTAINERS;

select * from v$datafile;

SELECT * FROM v$session;

CONNECT BINO@BINO_DB;

ALTER DATABASE OPEN;

SHOW TNS;

create pluggable database BINO_DB admin user BINO identified by BINO file_name_convert = (’\ORADATA\XE', ‘ORADATA\XE') ;

GRANT CONNECT, RESOURCE, DBA TO BINO;

select sys_context(‘USERENV’,‘SID’) from dual;

SELECT * from v$pdbs;

select * from V$database;

select ora_database_name from dual;

References

oracletutorial
geeksforgeeks
Object is


Read More