OCI: Cloning a non-CDB as a PDB

This note describes how to clone a non-CDB as a PDB located on a OCI dbsystem.

 

#1 From the source non-CDB:

CREATE USER ebs_clone IDENTIFIED BY <password>;
GRANT CREATE SESSION TO ebs_clone;
GRANT CREATE PLUGGABLE DATABASE TO ebs_clone;
ALTER SYSTEM SET local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=<private ip of the dbsystem>)(PORT=1521))' SCOPE=BOTH SID='*';
ALTER SYSTEM REGISTER;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE OPEN READ ONLY;

 

#2 From the target CDB:

ALTER SESSION SET global_names=FALSE
/
DROP DATABASE LINK ebs_link
/
CREATE DATABASE LINK ebs_link
CONNECT TO ebs_clone IDENTIFIED BY <password> 
USING '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = <private ip of the dbsystem>)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = <non-CDB service>)))'
/
SELECT COUNT(1) FROM dual@ebs_link
/

 

#3 Submit the clone (started from the CDB)

ALTER PLUGGABLE DATABASE <pdbname> CLOSE
/
DROP PLUGGABLE DATABASE <pdbname> INCLUDING DATAFILES
/
CREATE PLUGGABLE DATABASE <pdbname> FROM NON$CDB@ebs_link
/
SELECT name, open_mode FROM v$pdbs;
/
select message,time from pdb_plug_in_violations
/

 

#3 Run non_cdb_to_pdb.sql

ALTER SESSION SET CONTAINER=<pdbname>
@?/rdbms/admin/non_cdb_to_pdb.sql

 

#4 Run datapatch to level up the PDB

 

#5 Address plug-in violation

Checkout this note for resolution

Advertisements

OCI: Setting up a compute VM for eBS middle tier (generic)

This note is a generic note to detail how a VM compute should be prepare to deploy eBS, irrespective of the release. Additional steps will be performed, per release.

 

#1 Provision a default image with OL6.9, with a default 50GB.

 

#2 Create the oracle:oinstall user, use this note as a guideline

 

#3 Create a 200GB block volume to host the shared appltop

 

#4 Attach the block volume to the compute instance

Execute the scsi instructions on the oci console to attach the block volume

 

#5 Extend the book disk to create the /u01 partition

fdisk /dev/sdb
mkfs.ext4 /dev/sdb1 -L oracle -m 1

 

#4 Update /etc/fstab with the following content

LABEL=oracle /ebsapp ext4 defaults 0 0

 

#5 Mount the partition

mkdir /ebsapp
mount -a
chown oracle:oinstall /ebsapp

 

#6 Create the oratab file

touch /etc/oratab
chown oracle:oinstall /etc/oratab

 

#7 Create the oraInst.loc

touch /etc/oraInst.loc
chown oracle:oinstall /etc/oraInst.loc

 

#8 Create the local oraInventory

mkdir -p /u01/app/oraInventory
chown oracle:oinstall /u01/app/oraInventory

 

#8 Edit the oraInst.loc file with the following content

inventory_loc=/u01/app/oraInventory
inst_group=oinstall

 

#9 Install the linux dependencies via yum

yum install oracle-ebs-server-R12-preinstall

 

#10 Install the extra dependencies for R12.2

yum install compat-libstdc++-33

 

#11Adjust the kernel parameters

Set the following parameters in sysctl.conf

kernel.shmmax = 2147483648 
kernel.shmmni = 4096
vm.hugetlb_shm_group = 1002 <= dba group id

And reload the parameters sysctl -p

 

 

OCI: PDB plugin violations

This note is how to handle the common plug-in violations warning or errors found during eBS lift and shift to OCI and OCI-c.

 

#1 Database option OMW mismatch: PDB installed version NULL. CDB installed version 12.1.0.2.0

Solution: install the oracle workspace manager by running @?/rdbms/admin/owminst.plb

 

#2 Database option DV mismatch: PDB installed version NULL. CDB installed version 12.1.0.2.0

Solution: install DV on the PDB by running the script ?/rdbms/admin/catmac SYSAUX TEMP <syspassword>

 

#3 Database option OLS mismatch: PDB installed version NULL. CDB installed version 12.1.0.2.0.

Solution: Upgrade the pdb with ?/rdbms/admin/catols.sql

 

#4 Database option MGD mismatch: PDB installed version 12.1.0.2.0. CDB installed version NULL

Solution not tested, but it should be solved by applying the patch 22747454 which is part of the ETCC bundle.
Note that the datapatch portion of this patch may result into an error “ORA-25932 Error at line 68: ORA-29532: Java call terminated by uncaught Java exception” that may be solved by running the following workaround, before running again datapatch.

 call dbms_java.grant_policy_permission('JAVA_ADMIN','SYS','javax.management.MBeanServerPermission','*');
 call dbms_java.grant_policy_permission('JAVA_ADMIN','SYS','javax.management.MBeanPermission','*');

 

#5 PDB needs to import keys from source

 Solution: Import the key following this note.

OCI: PDB needs to import keys from source (12.1.0.2)

This note is how to handle the plug-in warning “PDB needs to import keys from source” with 12.1.0.2, after a non-CDB database has been converted as a PDB inside another CDB database located in an OCI DBsystem.

In the example below, <password1> is the key setup to the non-CDB database to be imported and <password2> is the key setup on the target CDB (identical to the sys and system passwords specified from the console).

#1 Apply the patch 23271203

For OCI 180116, the patch is p23271203_12102180116ProactiveBP_Linux-x86-64.zip

 

#2 Export the keys from the source database (non-CDB):

administer key management set keystore open identified by "<password1>";
administer key management export encryption keys with secret "<password1>"
to '/tmp/key_source.exp' identified by "<password1>";

 

#3 Recreate the wallet from the target CDB

! rm '/opt/oracle/dcs/commonstore/wallets/tde/<cdb>/cwallet.sso

administer key management set keystore close;
administer key management set keystore open identified by "<password2>";
administer key management set key identified by "<password2>" with backup;
administer key management create AUTO_LOGIN keystore from keystore 
'/opt/oracle/dcs/commonstore/wallets/tde/<cdb>' identified by "<password2>";

 

#4 Import the key from the PDB

alter session set container=<PDB>;
administer key management set keystore open identified by "<password2>";
administer key management import keys with secret "<password1>"
from '/tmp/key_prod.exp' identified by "<password2>" with backup;

 

References

MOS 1944507.1 TDE Wallet Problem in 12c: Cannot do a Set Key operation when an auto-login wallet is present
MOS 2392653.1 How to UnPlug/Plug-in PDB (TDE Enabled) in DBaaS Environment

OCI-c: dbaas_monitor password change

To change the DbaaS_Monitor password of an DBCS instance:

Login as oracle (via ssh opc@) then

cd /u01/app/oracle/product/ords/

 

and

java -jar ords.war user dbaas_monitor "OSAdmin"

Enter a password for user dbaas_monitor:
 Confirm password for user dbaas_monitor:
 May 17, 2018 9:52:26 PM oracle.dbtools.standalone.ModifyUser execute
 INFO: Created user: dbaas_monitor in file: /u01/app/oracle/product/ords/conf/ords/credentials