Difference between revisions of "Application Containers"

From Robs_Wiki
Jump to: navigation, search
(Create the Application Root)
Line 14: Line 14:
  
 
SQL> alter pluggable database myapp_root save state;
 
SQL> alter pluggable database myapp_root save state;
 +
 +
Pluggable database altered.
 +
</pre>
 +
== Create an application inside the Application Root ==
 +
<pre>
 +
SQL> alter session set container = myapp_root;
 +
 +
SQL> alter pluggable database application myapp begin install '1.0';
 +
 +
Pluggable database altered.
 +
 +
SQL> create tablespace myapp_data datafile size 10M autoextend on maxsize 500M;
 +
 +
Tablespace created.
 +
 +
SQL> create user myapp_owner identified by myapp_owner default tablespace myapp_data container=all;
 +
 +
User created.
 +
 +
SQL> grant create session, create table to myapp_owner;
 +
 +
Grant succeeded.
 +
 +
SQL> alter user myapp_owner quota unlimited on myapp_data;
 +
 +
User altered.
 +
 +
SQL> alter session set current_schema=myapp_owner;
 +
 +
Session altered.
 +
 +
SQL> create table myapp_table sharing=metadata (n number primary key);
 +
 +
Table created.
 +
 +
SQL> create table myapp_static sharing=data (n number primary key, s varchar2(20));
 +
 +
Table created.
 +
 +
SQL> insert into myapp_static values (1,'ONE');
 +
 +
1 row created.
 +
 +
SQL> insert into myapp_static values (2,'TWO');
 +
 +
1 row created.
 +
 +
SQL> insert into myapp_table values (1);
 +
 +
1 row created.
 +
 +
SQL> commit;
 +
 +
Commit complete.
 +
 +
SQL> alter pluggable database application myapp end install '1.0';
  
 
Pluggable database altered.
 
Pluggable database altered.
 
</pre>
 
</pre>

Revision as of 08:49, 4 October 2020

Introduction

Oracle 12.2 introduces the concept of application containers, which act like a mini-root container. They can be used to centralize shared configuration and applications, which are used by their dependent application PDBs.

Create the Application Root

SQL> create pluggable database myapp_root as application container admin user rob identified by rob roles = (DBA);

Pluggable database created.

SQL> alter pluggable database myapp_root open;

Pluggable database altered.

SQL> alter pluggable database myapp_root save state;

Pluggable database altered.

Create an application inside the Application Root

SQL> alter session set container = myapp_root;

SQL> alter pluggable database application myapp begin install '1.0';

Pluggable database altered.

SQL> create tablespace myapp_data datafile size 10M autoextend on maxsize 500M;

Tablespace created.

SQL> create user myapp_owner identified by myapp_owner default tablespace myapp_data container=all;

User created.

SQL> grant create session, create table to myapp_owner;

Grant succeeded.

SQL> alter user myapp_owner quota unlimited on myapp_data;

User altered.

SQL> alter session set current_schema=myapp_owner;

Session altered.

SQL> create table myapp_table sharing=metadata (n number primary key);

Table created.

SQL> create table myapp_static sharing=data (n number primary key, s varchar2(20));

Table created.

SQL> insert into myapp_static values (1,'ONE');

1 row created.

SQL> insert into myapp_static values (2,'TWO');

1 row created.

SQL> insert into myapp_table values (1);

1 row created.

SQL> commit;

Commit complete.

SQL> alter pluggable database application myapp end install '1.0';

Pluggable database altered.