Monday, 28 August 2017

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.

No comments:

Post a Comment

Comparing Oracle Database Appliance X8-2 Model Family

September 2019 Oracle announced Oracle Database Appliance X8-2 (Small, Medium and HA). ODA X8-2 comes with more computing resources com...