Creating Application Seeds

You can create application seeds in several different ways, including using the PDB seed, cloning an existing PDB, and plugging in an unplugged PDB by using the CREATE PLUGGABLE DATABASE statement.

About Creating an Application Seed

To create a new application seed in an application container, use the CREATE PLUGGABLE DATABASE statement with the AS SEED clause.

You can use an application seed to provision an application container with application PDBs that have the application root’s applications installed. Typically, the application container’s applications are installed in the application root before seed creation. After the application seed is created, it is synchronized with the application root so that the applications are installed in the application seed. When that is complete, any PDBs created using the application seed have the applications installed. When an application in the application root is upgraded or patched, the application seed must be synchronized with the application root to apply these changes.

An application container can have zero or one application seeds. When you create an application seed using the AS SEED clause of CREATE PLUGGABLE DATABASE, you do not specify its name. The application seed name is always application_container_name$SEED, where application_container_name is the name of the application seed’s application container. For example, an application seed in the salesact application container must be named salesact$SEED.

When you create a new application seed, you must specify an administrator for the application container in the CREATE PLUGGABLE DATABASE statement. The statement creates the administrator as a local user in the application container and grants the PDB_DBA role locally to the administrator.

Preparing for an Application Seed

Prerequisites must be met before creating an application seed.

Ensure that the following prerequisites are met before creating an application seed:

  • The CDB must exist.

    See "Creating a CDB: Basic Steps".

  • The CDB must be in read/write mode.

  • The application container to which the application seed will belong must be in read/write mode.

  • The current user must be a common user whose current container is the application root to which the application seed will belong.

  • The current user must have the CREATE PLUGGABLE DATABASE system privilege.

  • For the application seed to include the application for the application container, the application must be installed in the application root.

Creating an Application Seed

You create an application seed by including the AS SEED clause in the CREATE PLUGGABLE DATABASE statement.

An application seed in an application container is similar to the seed in a CDB. An application seed enables you to create application PDBs that meet the requirements of an application container quickly and easily.

Before creating an application seed, complete the prerequisites described in "Preparing for an Application Seed".
  1. In SQL*Plus, ensure that the current container is the application root.
  2. Run the CREATE PLUGGABLE DATABASE statement, and include the AS SEED clause, to create the application seed. Specify other clauses when they are required.
    After you create the application seed, it is in mounted mode, and its status is NEW. You can view the open mode of an application seed by querying the OPEN_MODE column in the V$PDBS view. You can view the status of an application seed by querying the STATUS column of the CDB_PDBS or DBA_PDBS view.
    A new default service is created for the application seed. The service has the same name as the application seed and can be used to access the application seed. Oracle Net Services must be configured properly for clients to access this service.
  3. Open the new application seed in read/write mode.
  4. You must open the new application seed in read/write mode for Oracle Database to complete the integration of the new application seed into the application container. An error is returned if you attempt to open the application seed in read-only mode. After the application seed is opened in read/write mode, its status is NORMAL.
  5. Perform one or more of the following actions:
    • If the application seed was created from the PDB seed, then switch container to the application seed, and use an ALTER PLUGGABLE DATABASE statement with the SYNC clause to synchronize the application seed. Synchronizing with the application root instantiates one or more of the application root’s applications in the application seed.
    • If the application seed was created from an application root, then switch container to the application seed, and run the pdb_to_apppdb.sql script to convert the application root to an application PDB.
    These actions are not required when the application seed is created by cloning an application PDB.
  6. Close the application seed, and then open it in open read-only mode.
  7. Back up the application seed.
    An application seed cannot be recovered unless it is backed up.

    Note:

    • If an error is returned during application seed creation, then the application seed being created might be in an UNUSABLE state. You can check an application seed’s state by querying the CDB_PDBS or DBA_PDBS view, and you can learn more about application seed creation errors by checking the alert log. An unusable application seed can only be dropped.

    • When an application in the application root is upgraded or patched in the application root, the application seed must synchronize with the application root to include the changes.

Example 14-8 Creating an Application Seed from the PDB seed

This example assumes the following factors:

  • The application seed is being created in an application container named salesact.

  • Storage limits are not required for the application seed. Therefore, the STORAGE clause is not required.

  • The application seed does not require a default tablespace.

  • The PATH_PREFIX clause is not required.

  • The FILE_NAME_CONVERT clause and the CREATE_FILE_DEST clause are not required.

    Either Oracle Managed Files is enabled for the CDB, or the PDB_FILE_NAME_CONVERT initialization parameter is set. The files associated with the PDB seed will be copied to a new location based on the Oracle Managed Files configuration or the initialization parameter setting.

  • There is no file with the same name as the new temp file that will be created in the target location. Therefore, the TEMPFILE REUSE clause is not required.

  • No predefined Oracle roles need to be granted to the PDB_DBA role.

The following statement creates the application seed from the PDB seed, opens the application seed, switches containers to the application seed, synchronizes the application seed with the applications in the application root, closes the application seed, and then opens the application seed in open read-only mode:

CREATE PLUGGABLE DATABASE AS SEED 
  ADMIN USER actseedadm IDENTIFIED BY password;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER SESSION SET CONTAINER=salesact$SEED;
ALTER PLUGGABLE DATABASE APPLICATION ALL SYNC;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;

Because the application container name is salesact, the application seed name is salesact$SEED.

A local user with the name of the specified local administrator is created and granted the PDB_DBA common role locally in the application seed. If this user was not granted administrator privileges during application seed creation, then use the SYS and SYSTEM common users to administer to the application seed.

The application seed was synchronized with the application root when it was created. Therefore, the application seed includes the applications installed in the application root and the application common objects that are part of those applications. When a new application PDB is created using the application seed, the application PDB also includes the installed applications and application common objects.

Example 14-9 Creating an Application Seed From an Application PDB

This example assumes the following factors:

  • The application seed is being created in an application container named salesact.

  • The application seed is being created in an application PDB in the application container named salesapppdb.

  • Storage limits are not required for the application seed. Therefore, the STORAGE clause is not required.

  • The application seed does not require a default tablespace.

  • The PATH_PREFIX clause is not required.

  • The FILE_NAME_CONVERT clause and the CREATE_FILE_DEST clause are not required.

    Either Oracle Managed Files is enabled for the CDB, or the PDB_FILE_NAME_CONVERT initialization parameter is set. The files associated with the application root will be copied to a new location based on the Oracle Managed Files configuration or the initialization parameter setting.

  • There is no file with the same name as the new temp file that will be created in the target location. Therefore, the TEMPFILE REUSE clause is not required.

Given the preceding factors, the following statement creates the application seed from the application root, opens the application seed, closes the application seed, and opens the application seed in open read-only mode:

CREATE PLUGGABLE DATABASE AS SEED FROM salesapppdb;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;

Because the application container name is salesact, the application seed name is salesact$SEED.

The application seed was created from an application PDB. Therefore, the application seed includes the applications installed in the application root and the application common objects that are part of those applications. When a new application PDB is created using the application seed, the application PDB also includes the installed applications and application common objects.

Example 14-10 Creating an Application Seed From an Application Root

This example assumes the following factors:

  • The application seed is being created in an application container named salesact. The application seed is cloned from the root of the application container.

  • Storage limits are not required for the application seed. Therefore, the STORAGE clause is not required.

  • The application seed does not require a default tablespace.

  • The PATH_PREFIX clause is not required.

  • The FILE_NAME_CONVERT clause and the CREATE_FILE_DEST clause are not required.

    Either Oracle Managed Files is enabled for the CDB, or the PDB_FILE_NAME_CONVERT initialization parameter is set. The files associated with the application root will be copied to a new location based on the Oracle Managed Files configuration or the initialization parameter setting.

  • There is no file with the same name as the new temp file that will be created in the target location. Therefore, the TEMPFILE REUSE clause is not required.

Given the preceding factors, the following statement creates the application seed from the application root, opens the application seed, switches containers to the application seed, runs the pdb_to_apppdb.sql script to convert the application root to an application PDB, closes the application seed, and opens the application seed in open read-only mode:

CREATE PLUGGABLE DATABASE AS SEED FROM salesact;
ALTER PLUGGABLE DATABASE salesact$SEED OPEN;
ALTER SESSION SET CONTAINER=salesact$SEED;
@$ORACLE_HOME/rdbms/admin/pdb_to_apppdb.sql
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN READ ONLY;

Because the application container name is salesact, the application seed name is salesact$SEED.

The application seed was created from the application root. Therefore, the application seed includes the applications installed in the application root and the application common objects that are part of those applications. When a new application PDB is created using the application seed, the application PDB also includes the installed applications and application common objects.