Copying and moving a PDB from a container database located on Container Cloud Service into a container database located on Database Cloud Service

Two Cloud services must be provisioned:

  • One multitenant 12cR2 database located on Database Cloud Services
  • One Container Cloud service

 

Once these services are provisioned:

  • A 12cR2 docker image must be deployed on the container. Once a container with this images is started, together with the ‘ccs’ multitenant database with a first ccsa pdb, the multitenant database¬† must be switched to archive log, and a new schema must be created to connect to via the database located on dbcs.
  • Security rules must setup in such a way to allow SQL*Net connectivity between both database hosts.
  • From the container database located on DBcs, a database link must be created to access the container database.

To deploy the 12cR2 image, first added the oracle container registry

ccs01

Then, when deploying the container, map the default listener port 1521 to the host port 1531. Also specify the container name and initial PDB.

ccs2

To switch in archivelog the container database located on the container cloud service, login on the container worker host and launch the following sqlplus command, then proceed as usual to move the database in archivelog

$ docker exec -it <imagename> bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

 

Login with sys on the container database located on docker, to create a new user with sysoper and create pluggable database privilege:

sqlplus sys/<passwd>@<ccs_worker_host>:1531/ccs.localdomain AS SYSDBA

SQL> CREATE USER c##ccs IDENTIFIED BY <password> CONTAINER=ALL;
SQL> GRANT CREATE SESSION, DBA, SYSOPER, CREATE PLUGGABLE DATABASE TO c##ccs CONTAINER=ALL;

 

From the multitenant database located on DBcs, create a database link

$ sqlplus sys/<password>@<dbcs_host>:1521/dbcs.aXXX.oraclecloud.internal AS SYSDBA

SQL> CREATE PUBLIC DATABASE LINK ccs_link
     CONNECT TO c##ccs IDENTIFIED BY <passwd>
     USING '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ip_adress_of_the_container_worker>)(PORT = 1531))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ccs.localdomain)))';

 

Still from the multitenant database located on DBcs, launch the command to create a copy of the database:

SQL> CREATE PLUGGABLE DATABASE ccsa_clone1 FROM ccsa@ccs_link;

 

To instead relocate the db:

SQL> CREATE PLUGGABLE DATABASE ccs_clone2 FROM ccsa@ccs_link RELOCATE;

 

Then open the new local PDB in read-write

SQL> ALTER PLUGGABLE DATABASE ccs_clone1 OPEN;
SQL> ALTER PLUGGABLE DATABASE ccs_clone2 OPEN;
Advertisements

OCI: Oracle users creation

To standardize on all users and groups creation on Oracle Public Cloud:

Linux

To setup a middle tier:

groupadd -g 1001 oinstall 
useradd -u 1001 -g oinstall -G 1001 -m -d /home/oracle oracle
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown oracle:oinstall /u01/app/oracle /u01/app/oraInventory

To install the database:

groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 oper
groupadd -g 1004 backupdba
groupadd -g 1005 dgdba
groupadd -g 1006 kmdba
useradd -u 1001 -g oinstall -G 1001,1002,1004,1005,1006 -m -d /home/oracle oracle
useradd -u 1002 -g oinstall -m -d /home/emagent emagent

Solaris

groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 oper
groupadd -g 1004 backupdba
groupadd -g 1005 dgdba
groupadd -g 1006 kmdba
useradd -u 1001 -g oinstall -G 1001,1002,1004,1005,1006 -m -d /export/home/oracle oracle
useradd -u 1002 -g oinstall -m -d /export/home/emagent emagent