Amazon Partner

Tuesday, 6 February 2018

Application Containers



### Raw version of application container Demo.
### Will convert into full Detail blog by some unknown date.


sqlplus  "/ as sysdba"

show parameter create
show pdbs


CREATE  pluggable database  APPROOT AS APPLICATION CONTAINER ADMIN USER USER1 IDENTIFIED BY USER1;

 -- sqlplus  sys/welcome1@localhost:1522/APPROOT  as sysdba

alter session set container=APPROOT ;

alter pluggable database APPROOT open;

alter pluggable database application demo begin install '1.0';

create tablespace app datafile size 1m autoextend on next 1m;
create user app_user identified by app_user default tablespace app quota unlimited on app;

GRANT CREATE SESSION, CREATE TABLE TO  app_user;


create table app_user.tab1 SHARING=METADATA
(
col1 number,
col2 date,
col3 varchar2(20));

create table app_user.tab2 SHARING=DATA
(
col1 number,
col2 date,
col3 varchar2(20));


create table app_user.tab3 SHARING=EXTENDED DATA
(
col1 number,
col2 date,
col3 varchar2(20));

insert into app_user.tab1 select 1,sysdate,'meta-'||name from v$pdbs ;
insert into app_user.tab2 select 1,sysdate,'data-'||name from v$pdbs ;
insert into app_user.tab3 select 1,sysdate,'extend'||name from v$pdbs ;


commit;


colum app_name format a30

select app_name,app_version,app_status from DBA_APPLICATIONS ;

alter pluggable database application demo end install;





####

CREATE  pluggable database  APP1 ADMIN USER USER1 IDENTIFIED BY USER1;

alter pluggable database  APP1  open;


alter session set container=APP1;

select col1,col2,col3 from app_user.tab1;
select col1,col2,col3 from app_user.tab2;
select col1,col2,col3 from app_user.tab3;



 ALTER PLUGGABLE DATABASE APPLICATION ALL SYNC;

insert into app_user.tab1 select 2,sysdate,'meta-'||name from v$pdbs ;
insert into app_user.tab2 select 2,sysdate,'data-'||name from v$pdbs ;
insert into app_user.tab3 select 2,sysdate,'extend'||name from v$pdbs ;


commit;

create table app_user.app1tab4
(
col1 number,
col2 date,
col3 varchar2(20));





### another application pdbs

alter session set container=APPROOT ;

CREATE  pluggable database  APP2 ADMIN USER USER1 IDENTIFIED BY USER1;

alter pluggable database  APP2  open;


alter session set container=APP2;


 ALTER PLUGGABLE DATABASE APPLICATION ALL SYNC;


select col1,col2,col3 from app_user.tab1;
select col1,col2,col3 from app_user.tab2;
select col1,col2,col3 from app_user.tab3;


insert into app_user.tab1 select 2,sysdate,'meta-'||name from v$pdbs ;
insert into app_user.tab2 select 2,sysdate,'data-'||name from v$pdbs ;
insert into app_user.tab3 select 2,sysdate,'extend'||name from v$pdbs ;

commit;




select col1,col2,col3 from app_user.tab1;
select col1,col2,col3 from app_user.tab2;
select col1,col2,col3 from app_user.tab3;


create table app_user.app2tab5
(
col1 number,
col2 date,
col3 varchar2(20));







### root container
select app_name,app_version , app_status from DBA_APP_PDB_STATUS ;



==== clear demo
## connect to root Container

alter session set container=APPROOT ;

alter pluggable database APP1  close;
drop pluggable database APP1 including datafiles;

alter pluggable database APP2  close;
drop pluggable database APP2 including datafiles;


alter session set container=CDB$ROOT ;
alter pluggable database APPROOT  close;
drop pluggable database APPROOT including datafiles;




No comments:

Post a Comment