Tag: create databsae

  • Oracle Database Appliance : Create Snapshot Database Using OAKCLI

    About ODA Snapshot Database


    • ODA Snapshot Database is created using oakcli command line utility
    • ODA automates the entire snapshot database creation process
    • Snapshot Database is created by taking a snapshot of the Oracle ASM Cluster File System (ACFS) where the source data files reside
    • The Source Database can be:
      • Non-RAC
      • RAC
      • RAC One Node
    • Snapshot Database requires less time and Storage
    • No downtime for source database for creating snapshot database
    • You can create an Oracle RAC database from an Oracle RAC One Node database
    • Create snapshot database feature is not available in ODA X6 – S / M / L
    • Create snapshot database feature is planned for 12.2 ODA X6 – S / M / L  RDBMS


    Prerequisites



    The Source Database must meet the following requirement to create Snapshot Database

    • It shouldn’t be a Standby database
    • It shouldn’t be a Container database
    • It shouldn’t be in READ-ONLY, RESTRICTED or ONLINE BACKUP Mode
    • It must be in ARCHIVE LOG Mode
    • All datafiles should be ONLINE
    • It shouldn’t use centralized wallet with TDE
    • It should be 11.2.0.4 and above



    Important Note


    • Both the Compute Nodes in ODA cluster must have system clock synchronized. The create snapshot database command may fail if the clocks are not synchronized.
    • You can’t create a RAC snapshot database from Non-RAC source database and vice versa
    • You can create Non-RAC snapshot Database from a Non-RAC Snapshot database



    Courtesy Oracle



    Steps to Create Snapshot Database Using oakcli utility


    • List existing databases

    [root@odanode1 ~]# oakcli show databases
    Name     Type       Storage   HomeName             HomeLocation                               Version
    —–    ——     ——–  ————–       —————-                           ———-
    orcldb   RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1  12.1.0.2.170117(24732082,24828633)
    odatest  RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1  12.1.0.2.170117(24732082,24828633)


    • Make source database is ARCHIVE LOG Mode

    SQL> select name, open_mode, database_role, log_mode from gv$database;


    NAME      OPEN_MODE            DATABASE_ROLE    LOG_MODE
    ——— ——————– —————- ————
    ODATEST   READ WRITE           PRIMARY          ARCHIVELOG
    ODATEST   READ WRITE           PRIMARY          ARCHIVELOG


    SQL> archive log list;
    Database log mode              Archive Mode
    Automatic archival             Disabled
    Archive destination            USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence     53
    Current log sequence           54


    • List the database files

    SQL> set lines 400 pages 200
    SQL> col name for a120
    SQL> select name, status from v$datafile;


    NAME                                                                                                                     STATUS
    ———————————————————————————————————————— ——-
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_system_doqhbjop_.dbf                        SYSTEM
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_sysaux_doqhbnkx_.dbf                        ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_undotbs1_doqhbq7b_.dbf                      ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_undotbs2_doqhbzyd_.dbf                      ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_users_doqhc0tz_.dbf                         ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_test_ffsnh1x9_.dbf                          ONLINE


    6 rows selected.


    • Syntax for oakcli create command

    [root@odanode1 ~]# oakcli create -h
    Usage:
    oakcli create {database | dbstorage | snapshotdb| dbhome | db_config_params } [<options>]
    Where:
             database            – Creates the Database
             snapshotdb          – Creates the Snapshot Database
             dbhome              – Creates the Database Home
             dbstorage           – Creates Storage for a given Database
             db_config_params    – Creates the Database configuration parameter file
    [root@odanode1 ~]# oakcli create snapshotdb -h
    Usage:
          oakcli create snapshotdb  -db <db_name> -from <db_name>


          where:
             db_name      – Name of the database to be created.
             from         – Source database for creating  the snapshot database.


    • Execute the following command to create snapshot database

    Here we are creating a snapshot database newdb from source database odatest


    [root@odanode1 ~]# oakcli create snapshotdb -db newdb -from odatest
    INFO: 2018-04-22 14:51:11: Please check the logfile  ‘/opt/oracle/oak/log/odanode1/tools/12.1.2.10.0/createdb_newdb_56401.log’ for more details


    Please enter the ‘root’  password :
    Please re-enter the ‘root’ password:


    Please enter the ‘SYS’  password for the Database odatest:
    Please re-enter the ‘SYS’ password:
    Please select one of the following for Database Deployment  [1 .. 2] :
    1    => RACONE
    2    => RAC
    2
    The selected value is : RAC


    Specify the  Database Class (1. odb-01 ‘1 core, 8 GB memory’   2. Others) [1] :
    The selected value is : odb-01 ‘1 core, 8 GB memory’
    ……….Completed

    SUCCESS: All nodes in /opt/oracle/oak/temp_clunodes.txt are pingable and alive.
    ……
    SUCCESS: All nodes in /opt/oracle/oak/temp_clunodes.txt are pingable and alive.
    INFO: 2018-04-22 14:54:03: Creating the SNAP Database ‘newdb’ from the source Database ‘odatest’
    INFO: 2018-04-22 14:54:11: Do not perform any Structural change to Database ‘odatest’ till SNAP Database ‘newdb’ is created
    INFO: 2018-04-22 14:54:31: Taking SNAP of the Database ‘odatest’
    INFO: 2018-04-22 14:54:32: Successfully took  the SNAP of database: odatest
    INFO: 2018-04-22 14:55:24: Creating controlfile for database: newdb
    INFO: 2018-04-22 14:56:05: Successfully created the control file for the database : newdb
    INFO: 2018-04-22 14:56:05: Adding log files for the second thread for the database : newdb
    INFO: 2018-04-22 14:56:11: Successfully added the log files for second thread
    INFO: 2018-04-22 14:56:15: Recovering the database: newdb,  snapshot time : ‘2018-04-22:14:54:32’ , until time : ‘2018-04-22:14:54:49’
    INFO: 2018-04-22 14:56:17: Successfully recovered the database
    INFO: 2018-04-22 14:56:17: Opening the database with resetlogs
    INFO: 2018-04-22 14:56:27: Successfully opened the database after recovery
    INFO: 2018-04-22 14:56:31: Setting the temporary tablespace for database : newdb
    INFO: 2018-04-22 14:56:33: Successfully set the temporary tablespace for the database : newdb
    INFO: 2018-04-22 14:57:35: Successfully changed the Database ID
    INFO: 2018-04-22 14:58:51: Adding the Database resource to the clusterware
    INFO: 2018-04-22 14:59:48: Successfully started the database
    INFO: 2018-04-22 14:59:48: Updating the TNS entries for the database newdb
    INFO: 2018-04-22 15:00:24: Successfully set the RMAN SNAPSHOT control file
    INFO: 2018-04-22 15:00:34: Disabling the external references in the database ‘newdb’ inherited from ‘odatest’
    INFO: 2018-04-22 15:00:35: Successfully disabled the external references
    INFO: 2018-04-22 15:00:59: Run the SQL script ‘/u01/app/oracle/product/12.1.0.2/dbhome_1/enable_external_refs_newdb_oMj0.sql’ on the 
    database ‘newdb’ to enable these external references
     Also need to restart the database after running the SQL script
    SUCCESS: 2018-04-22 15:01:57: Successfully created the Database ‘newdb’ from ‘odatest’


    • List the databases

    We can now see the newdb database created and it using ACFS file system


    [root@odanode1 ~]# oakcli show databases
    Name     Type       Storage   HomeName             HomeLocation                               Version                     
    —–    ——     ——–  ————–       —————-                           ———-                  
    orcldb   RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1  12.1.0.2.170117(24732082,24828633)
    newdb    RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1  12.1.0.2.170117(24732082,24828633)
    odatest  RAC        ACFS      OraDb12102_home1     /u01/app/oracle/product/12.1.0.2/dbhome_1  12.1.0.2.170117(24732082,24828633)


    • Verify the newly create snapshot database

    SQL> select name, open_mode, database_role, log_mode from gv$database;


    NAME      OPEN_MODE            DATABASE_ROLE    LOG_MODE
    ——— ——————– —————- ————
    NEWDB     READ WRITE           PRIMARY          ARCHIVELOG
    NEWDB     READ WRITE           PRIMARY          ARCHIVELOG


    SQL> archive log list;
    Database log mode              Archive Mode
    Automatic archival             Enabled
    Archive destination            USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence     2
    Next log sequence to archive   3
    Current log sequence           3
    SQL> set lines 400 pages 200
    SQL> col name for a100
    SQL> select name, status from v$datafile;


    NAME                                                                                                 STATUS
    —————————————————————————————————- ——-
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_system_doqhbjop_.dbf        SYSTEM
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_sysaux_doqhbnkx_.dbf        ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_undotbs1_doqhbq7b_.dbf      ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_undotbs2_doqhbzyd_.dbf      ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_users_doqhc0tz_.dbf         ONLINE
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile/o1_mf_test_ffsnh1x9_.dbf          ONLINE


    6 rows selected.


    [root@odanode1 ~]# cd /u02/app/oracle/oradata/datastore/.ACFS/snaps/newdb/NEWDB/datafile
    [root@odanode1 datafile]# ls -ltr
    total 3676440
    -rw-r—– 1 oracle asmadmin   23076864 Apr 21 06:00 o1_mf_temp_doqhbr2n_.tmp
    -rw-r—– 1 oracle asmadmin  387981312 Apr 22 14:54 o1_mf_undotbs2_doqhbzyd_.dbf
    -rw-r—– 1 oracle asmadmin    5251072 Apr 22 14:54 o1_mf_users_doqhc0tz_.dbf
    -rw-r—– 1 oracle asmadmin 1073750016 Apr 22 14:54 o1_mf_test_ffsnh1x9_.dbf
    -rw-rw—- 1 oracle asmadmin   23076864 Apr 22 15:01 o1_mf_temp_ffspq06s_.tmp
    -rw-r—– 1 oracle asmadmin  734011392 Apr 22 15:21 o1_mf_system_doqhbjop_.dbf
    -rw-r—– 1 oracle asmadmin  319823872 Apr 22 15:21 o1_mf_undotbs1_doqhbq7b_.dbf
    -rw-r—– 1 oracle asmadmin 1216356352 Apr 22 15:21 o1_mf_sysaux_doqhbnkx_.dbf




    Conclusion


    In this article we have demonstrated how to create snapshot database using oakcli. Using oakcli automates the entire snapshot database creating process. Snapshot Database is created by taking a snapshot of the Oracle ASM Cluster File System (ACFS) where the source data files reside.

  • Oracle Database Appliance: Create Database Using Database Configuration Parameter File

    Introduction


    In my previous articles, we have learned how to Create Oracle Database Appliance Database Configuration Parameter file. 


    If you want to create a database with different database configuration parameter then you must create a database configuration file with your desired parameters. You can use the ‘oakcli create db_config_params’ command to create a database configuration file. The configuration files are created under the locatoin ‘/opt/oracle/oak/install/dbconf’ with a default extension of ‘.dbconf’.


    Refer to the blog post at on how to create a databsae configuration file
    http://netsoftmate.blogspot.com/2018/05/oracle-database-appliance-database-configuration-file.html


    In this article we will demonstrate how to create a database using custom configuration parameter file.


    One can use OAKCLI or DBCA utility to create the database on ODA. But it is recommended to use OAKCLI on ODA to create the database. With OAKCLI, creating database is very easy and it is just one command.


    Courtesy Oracle



    Steps to Create a Database Using Configuration File


    • Login to Compute node 1 as root user and execute the following command:

    [root@odanode1]# oakcli create database -db testdb -oh OraDb12102_home1 -params ayx.conf
    INFO: 2018-04-23 16:13:42: Please check the logfile  ‘/opt/oracle/oak/log/odanode1/tools/12.1.2.10.0/createdb_testdb_94038.log’ for more details


    Please enter the ‘root’  password :
    Please re-enter the ‘root’ password:


    Please enter the ‘SYSASM’  password : (During deployment we set the SYSASM password to ‘welcome1’):
    Please re-enter the ‘SYSASM’ password:


    Please select one of the following for Database type  [1 .. 3] :
    1    => OLTP
    2    => DSS
    3    => In-Memory
    1 –> Enter 1 for OLTP and hit return
    The selected value is : OLTP
    Please select one of the following for Database Deployment  [1 .. 3] :
    1    => EE : Enterprise Edition
    2    => RACONE
    3    => RAC
    3 –> Enter 3 for RAC and hit return
    The selected value is : RAC


    Specify the  Database Class (1. odb-01 ‘1 core, 8 GB memory’   2. Others) [1] : 2 –> Enter 2 for Others and hit return


    Please select one of the following for Database Class [1 .. 9] :
    1    => odb-01s  (   1 cores ,     4 GB memory)
    2    =>  odb-01  (   1 cores ,     8 GB memory)
    3    =>  odb-02  (   2 cores ,    16 GB memory)
    4    =>  odb-04  (   4 cores ,    32 GB memory)
    5    =>  odb-06  (   6 cores ,    48 GB memory)
    6    =>  odb-12  (  12 cores ,    96 GB memory)
    7    =>  odb-16  (  16 cores ,   128 GB memory)
    8    =>  odb-20  (  20 cores ,   160 GB memory)
    9    =>  odb-24  (  24 cores ,   192 GB memory)
    3 –> Enter 3 for odb-02
    The selected value is : odb-02  (   2 cores ,    16 GB memory)
    INFO   : Logging all actions in the file /opt/oracle/oak/onecmd/tmp/odanode1-20180423161500.log and traces in the file /opt/oracle/oak/onecmd/tmp/odanode1-20180423161500.trc
    INFO   : Loading the configuration file /opt/oracle/oak/onecmd/create_database.params…
    INFO   : Creating the node list files…
    INFO   : Setting up ssh for root…
    INFO   : Setting up SSH across the Private Network…


    …………Completed
    INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.24 /root/DoAllcmds.sh
    INFO   : Background process 99086 (node: 192.168.16.24) gets done with the exit code 0
    INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.25 /root/DoAllcmds.sh
    INFO   : Background process 99132 (node: 192.168.16.25) gets done with the exit code 0
    INFO   : Setting up SSH completed successfully
    INFO   : Running the command /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd –exclude=*zip –exclude=*gz –exclude=*log –exclude=*trc –exclude=*rpm to sync directory</opt/oracle/oak/onecmd> on node <192.168.16.25>
    SUCCESS: Ran /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd –exclude=*zip –exclude=*gz —exclude=*log –exclude=*trc –exclude=*rpm and it returned: RC=0


    ……….Completed
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /root/DoAllcmds.sh
    INFO   : Background process 99840 (node: odanode1) gets done with the exit code 0
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /root/DoAllcmds.sh
    INFO   : Background process 99887 (node: odanode2) gets done with the exit code 0
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161544.sh
    INFO   : Background process 99960 (node: odanode1) gets done with the exit code 0
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161544.sh
    INFO   : Background process 307 (node: odanode2) gets done with the exit code 0
    INFO   : Setting up SSH for user oracle…
    …INFO   : checking nodes in /opt/oracle/oak/onecmd/tmp/db_nodes…

    SUCCESS: All nodes in /opt/oracle/oak/onecmd/tmp/db_nodes are pingable and alive.
    INFO   : Checking SSH setup for user (oracle) on nodes in /opt/oracle/oak/onecmd/tmp/db_nodes…
    INFO   : Did not do scp for node : odanode1
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161609.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161609.sh
    INFO   : Background process 1220 (node: odanode1) gets done with the exit code 0
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161609.sh
    INFO   : Background process 1266 (node: odanode2) gets done with the exit code 0
    INFO   : Setting up ACFS storage
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/acfsm_94038.sh
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/acfsm_94038.sh
    INFO   : Background process 1669 (node: odanode1) gets done with the exit code 0
    INFO   : Background process 1715 (node: odanode2) gets done with the exit code 0
    INFO: 2018-04-23 16:16:27: Successfully setup the storage structure for the database ‘testdb’
    SUCCESS: Successfully setup ACFS storage for the database testdb
    INFO   : Creating Database using DBCA…
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161627.sh
    INFO   : Background process 4974 (node: odanode1) gets done with the exit code 0
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20180423161627.sh
    INFO   : Background process 5026 (node: odanode2) gets done with the exit code 0
    INFO   : Running DBCA using /opt/oracle/oak/onecmd/tmp/dbca-testdb.sh on odanode1 as oracle…
    INFO   : Check output in /opt/oracle/oak/onecmd/tmp/dbca-testdb-20180423161500.log on odanode1
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/dbca-testdb.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbca-testdb.sh
             Instance testdb1 is running on node odanode1
             Instance testdb2 is running on node odanode2
    INFO   : One or more Instances running on the cluster nodes.
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl setenv database -d testdb -t ‘TZ=America/New_York’ to set DB timezone
    INFO   : Running the command /u01/app/12.1.0.2/grid/bin/crsctl stat resource ora.testdb.db -p
    .INFO   : Did not do scp for node : odanode1
    ..
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/dbupdates-testdb.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbupdates-testdb.sh
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl stop database -d testdb
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl start database -d testdb
    INFO: 2018-04-23 16:31:42: Successfully set the RMAN SNAPSHOT control file
    .INFO   : Did not do scp for node : odanode1
    ..
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
    SUCCESS: 2018-04-23 16:32:13: Successfully created the Database : testdb
    INFO   : Resecuring the environment… odanode1 odanode2
    INFO   : Removing the SSH setup for root…
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 chmod 751 /opt/oracle/oak/onecmd/tmp
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 chmod 751 /opt/oracle/oak/onecmd/tmp
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /bin/rm -rf /root/.ssh
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /bin/rm -rf /root/.ssh




    Conclusion
    In this article we have learned how to create a database on Oracle Database Appliance using Database Configuration parameter file. If you want to create a database with different database configuration parameter then you must create a database configuration file first with your desired parameters. Creating an Oracle Database on ODA is just one step process. OAKCLI utility takes care of everything for you to create the database.

  • Oracle Database Appliance: Create Database

    Introduction


    In my previous articles, we have learned how to Deploy an Oracle Database Appliance. 
    One can use OAKCLI or DBCA utility to create the database on ODA. But it is recommended to use OAKCLI on ODA to create the database.
    With OAKCLI, creating database is very easy and it is just one command.
    Let’s see how to quickly create a database on ODA.


    Steps to create Database on ODA


    • List the existing RDBMS Oracle Homes. With OAKCLI it is very easy to get the Oracle Homes Printed.

    [root@odanode1 ~]# oakcli show dbhomes
    Oracle Home Name Oracle Home version Home Location
    —————- ——————- ————
    OraDb12102_home1 /u01/app/oracle/product/12.1.0.2/dbhome_1


    You can also use the following option to get the Oracle HOME Name.


    [root@odanode1 ~]# cd /u01/app/oraInventory/ContentsXML
    [root@odanode1 ContentsXML]# grep -i “HOME NAME” inventory.xml
    <HOME NAME=”OraGrid12102″ LOC=”/u01/app/12.1.0.2/grid” TYPE=”O” IDX=”1″ CRS=”true”>
    <HOME NAME=”OraDb12102_home1″ LOC=”/u01/app/oracle/product/12.1.0.2/dbhome_1″ TYPE=”O” IDX=”2″>


    Here we have only Oracle HOME name OraDb12102_home1. We will be using this name to create the database.


    • Using OAKCLI to create database. Let’s see the options available.

    Display options that can be used with OAKCLI


    [root@odanode1 ~]# oakcli -h
    Usage:  oakcli show       – Shows disk, diskgroup, expander, controller, server, processor, memory, power, cooling, network, enclosure, storage, version, fs, raidsyncstatus, dbhomes, 


    dbstorage, databases, db_config_params, core_config_key, env_hw, ASR
            oakcli configure  – Configures the Network or ASR or additional Net
            oakcli apply      – Applies the core_config_key
            oakcli locate     – Locates a disk
            oakcli deploy     – Deploys the Database Appliance
            oakcli update     – Updates the Database Appliance
            oakcli validate   – Validates the Database Appliance
            oakcli manage     – Manages the OAK repository, diagcollect etc.,
            oakcli unpack     – Unpack the given package to OAK repository
            oakcli copy       – Copies the deployment config file
            oakcli upgrade    – Upgrades database
            oakcli stordiag   – Run storage diagnostic tool on both Nodes
            oakcli test       – Test ASR
            oakcli orachk     – Performs configuration settings check on ODA
            oakcli create     – Creates Database, DB storage, snapshotdb, dbhome, db_config_params file
            oakcli delete     – Deletes Database, DB storage, dbhome, db_config_params file
            oakcli modify     – Performs modify opeartions on Database
            oakcli resize     – Resizes DB storage


    Display options that can be used with OAKCLI CREATE


    [root@odanode1 ~]# oakcli create -h
    Usage:
    oakcli create {database | dbstorage | snapshotdb| dbhome | db_config_params } [<options>]
    Where:
             database            – Creates the Database
             snapshotdb          – Creates the Snapshot Database
             dbhome              – Creates the Database Home
             dbstorage           – Creates Storage for a given Database
             db_config_params    – Creates the Database configuration parameter file


    Display options that can be used with OAKCLI CREATE DATABASE 


    [root@odanode1 ~]# oakcli create database -h
    Usage:
          oakcli create database  -db <db_name> [[[-oh <home>] | [-version <version>]]  [-params <params_file>] [-cdb]]


          where:
             db_name      – Name of the database to be created.
             home         – Existing oracle home for creating the database. By default we create a new database home.
             version      – Database Version information for creating the database home. [ex. 11.2.0.2.7] If not provided create the database home from latest available bits.
             params_file  – Name of the db_config_parameter file [This file can be created using using ‘oakcli create db_config_params’].
                            If not provided, create the database using  default configuration file
             cdb          – Creates this database as a container database


    • Create Database as follows

    When you execute the create database command, it will prompt you the following details:

      • root password
      • SYSASM password
      • Databsae Type (OLTP, DSS or In-Memory)
      • Database Deployment (EE, RACONE or RAC)
      • Database Class

    [root@odanode1 ~]# oakcli create database -db odatest -oh OraDb12102_home1
    INFO: 2017-07-04 12:02:24: Please check the logfile  ‘/opt/oracle/oak/log/odanode1/tools/12.1.2.10.0/createdb_odatest_71669.log’ for more details
    INFO: 2017-07-04 12:02:26: Database parameter file is not provided. Will be using default parameters for DB creation


    Please enter the ‘root’  password :
    Please re-enter the ‘root’ password:


    Please enter the ‘SYSASM’  password : (During deployment we set the SYSASM password to ‘welcome1’):
    Please re-enter the ‘SYSASM’ password:
    Please select one of the following for Database type  [1 .. 3] :
    1    => OLTP
    2    => DSS
    3    => In-Memory
    1
    The selected value is : OLTP
    Please select one of the following for Database Deployment  [1 .. 3] :
    1    => EE : Enterprise Edition
    2    => RACONE
    3    => RAC
    3
    The selected value is : RAC


    Specify the  Database Class (1. odb-01 ‘1 core, 8 GB memory’   2. Others) [1] : 2


    Please select one of the following for Database Class [1 .. 9] :
    1    => odb-01s  (   1 cores ,     4 GB memory)
    2    =>  odb-01  (   1 cores ,     8 GB memory)
    3    =>  odb-02  (   2 cores ,    16 GB memory)
    4    =>  odb-04  (   4 cores ,    32 GB memory)
    5    =>  odb-06  (   6 cores ,    48 GB memory)
    6    =>  odb-12  (  12 cores ,    96 GB memory)
    7    =>  odb-16  (  16 cores ,   128 GB memory)
    8    =>  odb-20  (  20 cores ,   160 GB memory)
    9    =>  odb-24  (  24 cores ,   192 GB memory)
    3
    The selected value is : odb-02  (   2 cores ,    16 GB memory)
    INFO   : Logging all actions in the file /opt/oracle/oak/onecmd/tmp/odanode1-20170704120410.log and traces in the file /opt/oracle/oak/onecmd/tmp/odanode1-20170704120410.trc
    INFO   : Loading the configuration file /opt/oracle/oak/onecmd/create_database.params…
    INFO   : Creating the node list files…
    INFO   : Setting up ssh for root…
    INFO   : Setting up SSH across the Private Network…
    …………Completed
    INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.24 /root/DoAllcmds.sh
    INFO   : Running as root: /usr/bin/ssh -l root 192.168.16.25 /root/DoAllcmds.sh
    INFO   : Background process 77365 (node: 192.168.16.24) gets done with the exit code 0
    INFO   : Background process 77412 (node: 192.168.16.25) gets done with the exit code 0
    INFO   : Setting up SSH completed successfully
    INFO   : Running the command /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd –exclude=*zip –exclude=*gz –exclude=*log –exclude=*trc —


    exclude=*rpm to sync directory</opt/oracle/oak/onecmd> on node <192.168.16.25>
    SUCCESS: Ran /usr/bin/rsync -tarqvz /opt/oracle/oak/onecmd/ root@192.168.16.25:/opt/oracle/oak/onecmd –exclude=*zip –exclude=*gz –exclude=*log –exclude=*trc –exclude=*rpm and it 


    returned: RC=0


    ……….Completed
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /root/DoAllcmds.sh
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /root/DoAllcmds.sh
    INFO   : Background process 78082 (node: odanode1) gets done with the exit code 0
    INFO   : Background process 78130 (node: odanode2) gets done with the exit code 0
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120453.sh
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120453.sh
    INFO   : Background process 78210 (node: odanode1) gets done with the exit code 0
    INFO   : Background process 78256 (node: odanode2) gets done with the exit code 0
    INFO   : Setting up SSH for user oracle…
    …INFO   : checking nodes in /opt/oracle/oak/onecmd/tmp/db_nodes…

    SUCCESS: All nodes in /opt/oracle/oak/onecmd/tmp/db_nodes are pingable and alive.
    INFO   : Checking SSH setup for user (oracle) on nodes in /opt/oracle/oak/onecmd/tmp/db_nodes…
    INFO   : Did not do scp for node : odanode1
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120518.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120518.sh
    INFO   : Background process 79851 (node: odanode1) gets done with the exit code 0
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120518.sh
    INFO   : Background process 79897 (node: odanode2) gets done with the exit code 0
    INFO   : Setting up ACFS storage
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/acfsm_71669.sh
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/acfsm_71669.sh
    INFO   : Background process 80312 (node: odanode1) gets done with the exit code 0
    INFO   : Background process 80360 (node: odanode2) gets done with the exit code 0
    INFO: 2017-07-04 12:05:36: Successfully setup the storage structure for the database ‘odatest’
    SUCCESS: Successfully setup ACFS storage for the database odatest
    INFO   : Creating Database using DBCA…
    INFO   : Did not do scp for node : odanode1
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120536.sh
    INFO   : Background process 83721 (node: odanode1) gets done with the exit code 0
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /opt/oracle/oak/onecmd/tmp/DoAllcmds-20170704120536.sh
    INFO   : Background process 83768 (node: odanode2) gets done with the exit code 0
    INFO   : Running DBCA using /opt/oracle/oak/onecmd/tmp/dbca-odatest.sh on odanode1 as oracle…
    INFO   : Check output in /opt/oracle/oak/onecmd/tmp/dbca-odatest-20170704120410.log on odanode1
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/dbca-odatest.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbca-odatest.sh
             Instance odatest1 is running on node odanode1
             Instance odatest2 is running on node odanode2
    INFO   : One or more Instances running on the cluster nodes.
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl setenv database  odatest -t ‘TZ=America/New_York’ to set 


    DB timezone
    INFO   : Running the command /u01/app/12.1.0.2/grid/bin/crsctl stat resource ora.odatest.db -p
    .INFO   : Did not do scp for node : odanode1
    ..
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/dbupdates-odatesth
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/dbupdates-odatest.sh
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl stop database -ddatest
    INFO   : Running export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1;/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/srvctl start database -odatest
    INFO: 2017-07-04 12:24:56: Successfully set the RMAN SNAPSHOT control file
    .INFO   : Did not do scp for node : odanode1
    ..
    INFO   : This is root, will become oracle and run: /bin/su oracle -c /usr/bin/ssh -l oracle odanode1 /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
    INFO   : Running on the local node: /bin/su oracle -c /opt/oracle/oak/onecmd/tmp/runDatapatch.sh
    SUCCESS: 2017-07-04 12:25:27: Successfully created the Database : odatest
    INFO   : Resecuring the environment… odanode1 odanode2
    INFO   : Removing the SSH setup for root…


    INFO   : Running as root: /usr/bin/ssh -l root odanode1 chmod 751 /opt/oracle/oak/onecmd/tmp


    INFO   : Running as root: /usr/bin/ssh -l root odanode2 chmod 751 /opt/oracle/oak/onecmd/tmp
    INFO   : Running as root: /usr/bin/ssh -l root odanode2 /bin/rm -rf /root/.ssh
    INFO   : Running as root: /usr/bin/ssh -l root odanode1 /bin/rm -rf /root/.ssh


    ********THIS COMPLETES THE DATABASE CREATION PROCESS***********


    • Validate Database



    SQL> select * from v$version;


    BANNER                                                                               CON_ID
    ——————————————————————————– ———-
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production              0
    PL/SQL Release 12.1.0.2.0 – Production                                                    0
    CORE    12.1.0.2.0      Production                                                                0
    TNS for Linux: Version 12.1.0.2.0 – Production                                            0
    NLSRTL Version 12.1.0.2.0 – Production                                                    0


    SQL> select name,open_mode,database_role,log_mode,flashback_on from v$database;


    NAME      OPEN_MODE            DATABASE_ROLE    LOG_MODE     FLASHBACK_ON
    ——— ——————– —————- ———— ——————
    ODATEST   READ WRITE           PRIMARY          ARCHIVELOG   NO




    [oracle@odanode1 ~]$ srvctl status database -d odatest
    Instance odatest1 is running on node odanode1
    Instance odatest2 is running on node odanode2


    [oracle@odanode1 ~]$ srvctl config database -d odatest
    Database unique name: odatest
    Database name: odatest
    Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
    Oracle user: oracle
    Spfile: /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/odatest/spfileodatest.ora
    Password file: /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/odatest/orapwodatest
    Domain:
    Start options: open
    Stop options: immediate
    Database role: PRIMARY
    Management policy: AUTOMATIC
    Server pools:
    Disk Groups:
    Mount point paths: /u01/app/oracle/oradata/datastore,/u02/app/oracle/oradata/datastore,/u01/app/oracle/fast_recovery_area/datastore
    Services:
    Type: RAC
    Start concurrency:
    Stop concurrency:
    OSDBA group: dba
    OSOPER group: racoper
    Database instances: odatest1,odatest2
    Configured nodes: odanode1,odanode2
    Database is administrator managed


    SQL> set lines 150
    SQL> select name from v$datafile;


    NAME
    —————————————————————————————————————-
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_system_doqhbjop_.dbf
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_sysaux_doqhbnkx_.dbf
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_undotbs1_doqhbq7b_.dbf
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_undotbs2_doqhbzyd_.dbf
    /u02/app/oracle/oradata/datastore/.ACFS/snaps/odatest/ODATEST/datafile/o1_mf_users_doqhc0tz_.dbf


    SQL> select name from v$controlfile;


    NAME
    —————————————————————————————————————-
    /u01/app/oracle/oradata/datastore/odatest/ODATEST/controlfile/o1_mf_doqhbb49_.ctl


    SQL> select member from v$logfile;


    MEMBER
    —————————————————————————————————————-
    /u01/app/oracle/oradata/datastore/odatest/ODATEST/onlinelog/o1_mf_1_doqhbb7f_.log
    /u01/app/oracle/oradata/datastore/odatest/ODATEST/onlinelog/o1_mf_2_doqhbf18_.log
    /u01/app/oracle/oradata/datastore/odatest/ODATEST/onlinelog/o1_mf_3_doqhxbg9_.log
    /u01/app/oracle/oradata/datastore/odatest/ODATEST/onlinelog/o1_mf_4_doqhxg9m_.log




    Conclusion
    In this article we have learned how to create a database on Oracle Database Appliance. Creating an Oracle Database on ODA is just one step process. OAKCLI utility takes care of everything for you to create the database. You can also use the DBCA utility to create the database but it is recommended to use OAKCLI utility to create database.