Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
oracle_multitenant_application_container [2021/11/13 17:42] andonovjoracle_multitenant_application_container [2021/11/14 20:45] (current) – [Create & Set the container MAP] andonovj
Line 471: Line 471:
 {{:screen_shot_2021-11-12_at_7.32.42_pm.png?800|}} {{:screen_shot_2021-11-12_at_7.32.42_pm.png?800|}}
  
-==== Clone ====+==== Clone Application Container ====
 From Oracle 12.2, we can clone the entire application container as well. From Oracle 12.2, we can clone the entire application container as well.
  
Line 493: Line 493:
 SQL> create pluggable database appcdb as application container admin user pdbadmin identified by Pass123;  SQL> create pluggable database appcdb as application container admin user pdbadmin identified by Pass123; 
 Pluggable database created. Pluggable database created.
-SQL> alter pluggable database Nuvola open;+SQL> alter pluggable database appcdb open;
 Pluggable database altered. Pluggable database altered.
    
Line 527: Line 527:
 SQL> CREATE TABLE c##andonovj.containermap ( SQL> CREATE TABLE c##andonovj.containermap (
 country VARCHAR2(30) NOT NULL) country VARCHAR2(30) NOT NULL)
-PARTITION BY LIST (region) (+PARTITION BY LIST (country) (
 PARTITION north VALUES ('CANADA','USA'), PARTITION north VALUES ('CANADA','USA'),
 PARTITION central VALUES ('GUATEMALA','NICARAGUA'), PARTITION central VALUES ('GUATEMALA','NICARAGUA'),
Line 579: Line 579:
  
 <Code:bash> <Code:bash>
-SQL> alter session set container=appcdb;+SQL> alter session set container=north;
 Session altered. Session altered.
 SQL> insert into c##andonovj.revenue values ('CANADA',1000); SQL> insert into c##andonovj.revenue values ('CANADA',1000);
 SQL> insert into c##andonovj.revenue values ('USA',2000); SQL> insert into c##andonovj.revenue values ('USA',2000);
 +SQL> commit;
 +SQL> alter session set container=central;
 +Session altered.
 +SQL> commit;
 SQL> insert into c##andonovj.revenue values ('GUATEMALA',3000); SQL> insert into c##andonovj.revenue values ('GUATEMALA',3000);
 SQL> insert into c##andonovj.revenue values ('NICARAGUA',4000); SQL> insert into c##andonovj.revenue values ('NICARAGUA',4000);
 +SQL> alter session set container=south;
 +Session altered.
 +SQL> commit;
 SQL> insert into c##andonovj.revenue values ('ARGENTINA',5000); SQL> insert into c##andonovj.revenue values ('ARGENTINA',5000);
 SQL> insert into c##andonovj.revenue values ('BRAZIL',6000); SQL> insert into c##andonovj.revenue values ('BRAZIL',6000);
 SQL> commit; SQL> commit;
-SQL> ALTER PLUGGABLE DATABASE APPLICATION Application_JULIEN ALL SYNC; 
 </Code> </Code>
  
 +After that you can end the upgrade or installation and sync every application PDB
  
 Now, when you select from that table, the query will be redirect to all PDBs and thus the data will be sharded across the PDBs. If the PDBs are proxy PDBs, it can be even distributed in different continents. Now, when you select from that table, the query will be redirect to all PDBs and thus the data will be sharded across the PDBs. If the PDBs are proxy PDBs, it can be even distributed in different continents.
 The logic is, if you connect to the ROOT, you can see the information across all PDBs, if you connect to a specific PDB, you can select the data only in that PDB and what is shared in the root, you CANNOT see data from other PDBs. The logic is, if you connect to the ROOT, you can see the information across all PDBs, if you connect to a specific PDB, you can select the data only in that PDB and what is shared in the root, you CANNOT see data from other PDBs.
 +
 +===== Cloning =====
 +In this part we will perform the following operations:
 +
 +  * Clone a remote non-application PDB into application Container
 +  * Clone application container
 +
 +
 +==== Cloning a remote non-app PDB to application root ====
 +The procedure is the same as cloning a PDB, but after we create it, the PDB will be in restricted mode:
 +
 +<Code:bash|Check new PDB>
 +SQL> show pdbs;
 +
 +    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
 +---------- ------------------------------ ---------- ----------
 +         6 APDB2                          READ WRITE YES
 +SQL>
 +SQL>
 +</Code>
 +
 +That is because when we clone a nonapp PDB into application container we need to convert it:
 +
 +<Code:bash|Check error>
 +NAME                           ACTION                                                       MESSAGE
 +------------------------------ ------------------------------------------------------------ ----------------------------------------------------------------------------------------------------
 +APDB2                          Run pdb_to_apppdb.sql.                                       Non-Application PDB plugged in as an Application PDB, requires pdb_to_apppdb.sql be run.
 +
 +SQL>
 +</Code>
 +
 +Then we need to run:
 +
 +<Code:bash|Run appdb.sql>
 +SQL> alter session set container=apdb2;
 +SQL> $@ORACLE_HOME/rdbms/admin/pdb_to_apppdb.sql
 +........................
 +SQL>
 +SQL> show pdbs;
 +
 +    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
 +---------- ------------------------------ ---------- ----------
 +         6 APDB2                          READ WRITE YES
 +
 +SQL> alter pluggable database apdb2 close;
 +
 +Pluggable database altered.
 +
 +SQL> alter pluggable database apdb2 open;
 +
 +Pluggable database altered.
 +
 +SQL> show pdbs;
 +
 +    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
 +---------- ------------------------------ ---------- ----------
 +         6 APDB2                          READ WRITE NO
 +SQL>
 +
 +</Code>
 +
 +Also this procedure can be done with a local PDB.
 +
 +===== Conversions =====
 +Last but not least, in this part we will:
 +
 +  * Convert normal PDB into application root container
 +  * Convert regular PDB into application PDB
 +  * Relocating a PDB
  • oracle_multitenant_application_container.1636825356.txt.gz
  • Last modified: 2021/11/13 17:42
  • by andonovj