Good Contents Are Everywhere, But Here, We Deliver The Best of The Best.Please Hold on!
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.

0

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.

0