Thursday, 27 August 2020

Multitenant - Install an application in the application root database


  • Multitenant - Install an application in the application root database

oracle@srv4:~> sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Tue Aug 25 17:37:16 2020

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                     READ ONLY  NO
         3 TEST1                             READ WRITE NO
         4 PLM1                              READ WRITE NO
         5 PDBREF                         READ ONLY  NO
         6 PROXYPDB                   READ WRITE NO
         7 HR_AC                           READ WRITE NO

SQL> conn sys/system123@hr_ac as sysdba
Connected.
SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         7 HR_AC                          READ WRITE NO


  • Install a new application in an application root 


SQL> ALTER PLUGGABLE DATABASE APPLICATION hr_app BEGIN INSTALL '1.0';

Pluggable database altered.

SQL> CREATE TABLESPACE hr_tbs;

Tablespace created.

SQL> CREATE USER HR IDENTIFIED BY oracle DEFAULT TABLESPACE HR_TBS QUOTA UNLIMITED ON
HR_TBS CONTAINER = ALL;  2

User created.

SQL> GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE VIEW, CREATE
PROCEDURE, CREATE TRIGGER TO HR;  2

Grant succeeded.

SQL> ALTER SESSION SET CURRENT_SCHEMA=hr;

Session altered.

SQL> host mkdir /home/oracle/scripts

hr_app_v1.0.sql


  • Upload tables and data on hr_app_v1.0.sql file as per data accordingly : 

SQL> host vi /home/oracle/scripts/hr_app_v1.0.sql

SQL> host vi /home/oracle/scripts/hr_app_v1.0.sql


SQL> @/home/oracle/scripts/hr_app_v1.0.sql

Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


Table created.


  • After executing query end application installation

SQL> ALTER PLUGGABLE DATABASE APPLICATION hr_app END INSTALL '1.0';

Pluggable database altered.

SQL> column app_name format a15
SQL> column app_version format a10
SQL> column app_status format a15
SQL>SELECT APP_NAME, APP_VERSION, APP_STATUS FROM DBA_APPLICATIONS WHERE APP_IMPLICIT='N';

APP_NAME        APP_VERSIO APP_STATUS
--------------- ---------- ---------------
HR_APP          1.0        NORMAL

No comments:

Post a Comment