Skip to content

Instantly share code, notes, and snippets.

@cruepprich
Last active October 15, 2021 16:25
Show Gist options
  • Save cruepprich/667d8b5f7a35a78ace384b898dc1a745 to your computer and use it in GitHub Desktop.
Save cruepprich/667d8b5f7a35a78ace384b898dc1a745 to your computer and use it in GitHub Desktop.
[Create PDB in OCI DBaaS] #database

As sysdba in CDB:

CREATE PLUGGABLE DATABASE TESTPDB ADMIN USER test_admin IDENTIFIED BY test_admin
 STORAGE (MAXSIZE 2G)
 DEFAULT TABLESPACE USERS
 DATAFILE '+DATA' SIZE 250M AUTOEXTEND ON;

ALTER PLUGGABLE DATABASE TESTPDB OPEN READ WRITE;

Log in to the command line as opc.

ssh [email protected]
sudo su - 

List databases and copy ID

[root@caddb1 ~]# dbcli  list-databases

ID                                       DB Name    DB Type  DB Version           CDB        
---------------------------------------- ---------- -------- -------------------- ---------- more ->
201eb8b7-2549-4d74-a345-0f67cfd2d1e4     caddb01    Si       19.9.0.0.0           true

Update the TDE Key (i used sysdba password gr_8lYk9_Q2p when prompted)

[root@caddb1 ~]# dbcli update-tdekey -i 201eb8b7-2549-4d74-a345-0f67cfd2d1e4 -p -n tangelie_1

Check for successful completion: [root@caddb1 ~]# dbcli list-jobs

ID                                       Description                                Created          Status
---------------------------------------- ------------------------------------------ ---------------- ----------
...
c4c56500-a683-4d06-8cc2-2bdf1727d337     TDE update caddb01 - PDBs: [tangelie_1]    February 4, 2021 Success

See job details:

dbcli describe-job -i c4c56500-a683-4d06-8cc2-2bdf1727d337

Connect as sysdba, switch to pdb and create a tablespace:

[oracle@caddb1 ~]$ sqlplus / as sysdba
SQL> alter session set container=tangelie_1;

Session altered.

SQL> create tablespace tangelie_1 datafile '+DATA';

Tablespace created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment