4.3.8.1 ADD DATABASE

This command adds an Oracle database; either a non-container database (non-CDB), container database (CDB), or pluggable database (PDB) to an existing CDB.

Syntax

ADD DATABASE 
   [ BLOCKSIZE=blocksize ]
   [ CHARSET=database_character_set
   DATADG=data_diskgroup
   [ DBLANG=database_language ]
   DBNAME=database_name
   [ UNIQUENAME=database_unique_name ] 
   [ DBTEMPLATE=database_template ] 
   [ DBTYPE=database_type ]
   [ HOSTNAMES='host_names' ] 
   RECODG=reco_diskgroup
WHERE
   { DBHOMEID=database_home_id |
     CLUSTERNUMBER=cluster_number DBHOMELOC=database_home_location |
     CLUSTERNAME=cluster_name DBHOMELOC=database_home_location |
     CLUSTERID=cluster_id DBHOMELOC=database_home_location |
     CLUSTERNUMBER=cluster_number CDBNAME=container_database_name |
     CLUSTERNAME=cluster_name CDBNAME=container_database_name |
     CLUSTERID=cluster_id CDBNAME=container_database_name }

Arguments

You can specify the following attributes for the new Oracle database:

  • BLOCKSIZE : Optionally, specifies the block size for the new database. The default value is 8192. This argument is not required for pluggable databases.

  • CHARSET : Optionally, specifies the character set to use for the new database. The default value is AL32UTF8. This argument is not required for pluggable databases.

  • DATADG : Specifies the name of the DATA disk group for the new database. This argument is not required for pluggable databases.

  • DBLANG : Optionally, specifies the language to use for the new database. The default value is all_langs. This argument is not required for pluggable databases.

  • DBNAME : Specifies the name of the new database.

  • UNIQUENAME : Specifies the unique name of the new database. The default value is dbname.

  • DBTEMPLATE : Specifies the template to use when creating the new database, ADMIN or DW. The default value is ADMIN. This argument is not required for pluggable databases.

  • DBTYPE : Optionally, specifies the type of database to create:

    • normal DB : Adds a non-container database (non-CDB). This is the default value.

    • CDB : Adds a container database.

    • PDB : Adds a pluggable database to an existing CDB.

  • HOSTNAMES : Optionally, specifies a comma-separated list of host names on which the database should run. The default value is the list of nodes registered with the database home.

  • RECODG : Specifies the name of the RECO disk group for the new database. This argument is not required for pluggable databases.

The following arguments are available in the WHERE clause:

  • DBHOMEID : Specifies the es.xml ID of the database home.

  • CLUSTERNUMBER : Specifies the cluster number in the es.xml, starting at 1

  • CLUSTERNAME : Specifies the name of the cluster

  • CLUSTERID : Specifies the es.xml ID of the cluster

  • DBHOMELOCATION : Specifies the path for the target database home.

  • CDBNAME : Specifies the database name for the container database. This argument is required only when DBTYPE=PDB

Example 4-16 Adding a New Oracle Database Using OEDACLI

This example shows how to add a new database to the configuration.

  1. Load the OEDA XML configuration file.

    oedacli> LOAD FILE NAME=Oracle-test.xml 
    SUCCESS - file loaded OK 
    Customer : ora07adm01 - Oracle
  2. Use the command LIST DATABASEHOMES to identify the databasehome_id associated with the target database home. This database home will be used to create the new database.

    oedacli> LIST DATABASEHOMES
    version : "CloneInstall" 
    cluster : 
    id : "c0_clusterHome" 
    databaseHomeName : "c0_DbHome_0" 
    databaseSwOwner : "c0_oracle" 
    databaseVersion : "12.2.0.1.170718" 
    databaseHomeLoc : "/u01/app/oracle/product/12.2.0.1/dbhome_1" 
    inventoryLocation : "/u01/app/oraInventory" 
    language : "all_langs" 
    machines : 
    machine : ... 
    ... 
    patches : 
    patch : 
    patchNumber : "26133434" 
    basedir : "/u01/app/oracle" 
    useZfs : "false" 
    id : "c0_databaseHome1"
  3. Create an action for creating the new database. You must provide a name for the new database, and the names of the DATA and RECO disk groups that the new database should use. Also, use the ID retrieved in the previous step to specify the Oracle Home in which to create this database.

    oedacli> ADD DATABASE DBNAME='testdb' DATADG='DATAC1' RECODG='RECOC1' 
    WHERE DBHOMEID='c0_databaseHome'
  4. Save the action.

    oedacli> SAVE ACTION
  5. Merge all actions.

    oedacli> MERGE ACTIONS
    processMerge 
    processMergeActions 
    Merging Action : add database dbname='testdb' DATADG='DATAC1' RECODG='RECOC1' 
    where DBHOMEID='c0_databaseHome' 
    Merging ADD DATABASE 
    Action Validated and Merged OK
  6. Save the action to a new Engineered Systems XML configuration file.

    oedacli> SAVE FILE NAME ='cli-test-2databases.xml' 
    File : cli-test-2databases.xml saved OK
  7. Deploy the actions.

    oedacli> DEPLOY ACTIONS 
    Deploying Action ID : 4 add database dbname='testdb' DATADG='DATAC1' RECODG='
    RECOC1' where DBHOMEID='c0_databaseHome' 
    Deploying ADD DATABASE 
    Running datapatch on database 'testdb' 
    Done... 
    Done