For the complete syntax for the ODACLI create database options, please refer to the CLI Documentation from Oracle.
First list the database homes available for you to leverage:
# odacli list-dbhomes ID Name DB Version Home Location Status ---------------------------------------- -------------------- ---------------------------------------- --------------------------------------------- ---------- 2fb3858a-61a7-4f49-b792-695c619d7cee OraDB18000_home1 18.1.0.0.0 /u01/app/oracle/product/18.0.0.0/dbhome_1 CONFIGURED 880eca0b-eed7-497f-8a69-fedc1db34130 OraDB12102_home2 12.1.0.2.160419 /u01/app/oracle/product/12.1.0.2/dbhome_2 CONFIGURED c1c52e57-53e9-4791-b553-32cc2c280ca4 OraDB12102_home1 12.1.0.2.160419 /u01/app/oracle/product/12.1.0.2/dbhome_1 CONFIGURED d5003afa-ba43-4453-add6-67444ed83d9d OraDB19000_home1 19.9.0.0.201020 /u01/app/oracle/product/19.0.0.0/dbhome_1 CONFIGURED
We are going to create an Oracle 19c database, so we will use the ID from the OraDB19000_home1. Execute the following ODACLI command to create a 2-node RAC database on ASM called DEV with a pluggable database called pdb1. For the SYS, SYSTEM and PDB Admin user password, we must meet the following requirements for passwords:
password length (minimum: 9 / maximum: 30) characters
password should contain ALL of the following:
a) at least two uppercase letters
b) at least two lowercase letters
c) at least two numbers
d) at least two special characters, valid characters are # _ –
[root@odax8a ContentsXML]# odacli create-database -n DEV -cl oltp -dh d5003afa-ba43-4453-add6-67444ed83d9d -s odb1 -p pdb1 -r ASM -c -y RAC
Enter SYS, SYSTEM and PDB Admin user password: OraBora123##
Retype SYS, SYSTEM and PDB Admin user password:
Job details
----------------------------------------------------------------
ID: c2cbce12-82bd-41a1-ae5d-86dd363ce5b6
Description: Database service creation with db name: DEV
Status: Created
Created: May 24, 2021 7:22:01 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
We can obtain the status of the database creation job with the describe-job option:
[root@odax8a ContentsXML]# odacli describe-job -i c2cbce12-82bd-41a1-ae5d-86dd363ce5b6
Job details
----------------------------------------------------------------
ID: c2cbce12-82bd-41a1-ae5d-86dd363ce5b6
Description: Database service creation with db name: DEV
Status: Running
Created: May 24, 2021 7:22:01 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Setting up ssh equivalance May 24, 2021 7:22:02 PM CDT May 24, 2021 7:22:02 PM CDT Success
Database Service creation May 24, 2021 7:22:04 PM CDT May 24, 2021 7:22:04 PM CDT Running
Database Creation May 24, 2021 7:22:04 PM CDT May 24, 2021 7:22:04 PM CDT Running
We can review the dcs-agent.log file to see the details of the tasks that Oracle is performing:
[root@odax8a ContentsXML]# tail -30f /opt/oracle/dcs/log/dcs-agent.log
"tags" : [ ],
"reportLevel" : "Info"
}, {
"updatedTime" : "Mon May 24, 2021 19:22:04.449 (CDT) [1621902124449]",
"startTime" : "Mon May 24, 2021 19:22:04.445 (CDT) [1621902124445]",
"endTime" : "Mon May 24, 2021 19:22:04.449 (CDT) [1621902124449]",
"taskId" : "TaskZJsonRpcExt_402",
"status" : "Running",
"taskResult" : "",
"taskName" : "Database Creation",
"taskDescription" : null,
"parentTaskId" : "TaskSequential_401",
"jobId" : "c2cbce12-82bd-41a1-ae5d-86dd363ce5b6",
"tags" : [ ],
"reportLevel" : "Info"
} ],
"createTimestamp" : "Mon May 24, 2021 19:22:01.097 (CDT) [1621902121097]",
"resourceList" : [ {
"updatedTime" : "Mon May 24, 2021 19:22:02.743 (CDT) [1621902122743]",
"resourceId" : "203ee5ff-53ed-41aa-bb3e-b8a4fa5d0681",
"jobId" : "c2cbce12-82bd-41a1-ae5d-86dd363ce5b6",
"resourceType" : "DB"
}, {
"updatedTime" : "Mon May 24, 2021 19:22:02.500 (CDT) [1621902122500]",
"resourceId" : "f8d5de58-1763-4959-b2f3-cdd8f9675b2c",
"jobId" : "c2cbce12-82bd-41a1-ae5d-86dd363ce5b6",
"resourceType" : "Storage"
} ],
"description" : "Database service creation with db name: DEV"
}
We can display the details of the database creation job again to see that it completed successfully within 20 minutes.
[root@odax8a ContentsXML]# odacli describe-job -i c2cbce12-82bd-41a1-ae5d-86dd363ce5b6
Job details
----------------------------------------------------------------
ID: c2cbce12-82bd-41a1-ae5d-86dd363ce5b6
Description: Database service creation with db name: DEV
Status: Success
Created: May 24, 2021 7:22:01 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Setting up ssh equivalance May 24, 2021 7:22:02 PM CDT May 24, 2021 7:22:02 PM CDT Success
Database Service creation May 24, 2021 7:22:04 PM CDT May 24, 2021 7:41:20 PM CDT Success
Database Creation May 24, 2021 7:22:04 PM CDT May 24, 2021 7:37:59 PM CDT Success
Change permission for xdb wallet files May 24, 2021 7:37:59 PM CDT May 24, 2021 7:37:59 PM CDT Success
Add Startup Trigger to Open all PDBS May 24, 2021 7:37:59 PM CDT May 24, 2021 7:38:00 PM CDT Success
SqlPatch upgrade May 24, 2021 7:39:21 PM CDT May 24, 2021 7:39:59 PM CDT Success
Running dbms_stats init_package May 24, 2021 7:39:59 PM CDT May 24, 2021 7:40:01 PM CDT Success
updating the Database version May 24, 2021 7:40:02 PM CDT May 24, 2021 7:40:04 PM CDT Success
Set CPU pool May 24, 2021 7:40:04 PM CDT May 24, 2021 7:40:04 PM CDT Success
create Users tablespace May 24, 2021 7:41:20 PM CDT May 24, 2021 7:41:24 PM CDT Success
Clear all listeners from Database {203ee5ff-53ed-41aa-bb3e-b8a4fa5d0681} May 24, 2021 7:41:24 PM CDT May 24, 2021 7:41:25 PM CDT Success
We can login to our DEV container database and see that the pluggable database called pdb1 is open in read-write mode:
[oracle@odax8a ~]$ . oraenv
ORACLE_SID = [DEV] ? DEV1
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@odax8a ~]$
[oracle@odax8a ~]$
[oracle@odax8a ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Mon May 24 19:46:56 2021
Version 19.9.0.0.0
Copyright (c) 1982, 2020, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.0.0.0
SQL>
SQL>
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
In our example above, we created a RAC database. We can create a single instance database on the ODA as well. Here is an example ODACLI command to create a single instance database that is not containerized:
[root@odax8a ~]# odacli create-database -n oraqa -cl oltp -dh d5003afa-ba43-4453-add6-67444ed83d9d -s odb1 -r ACFS -y SI -g 1
Enter SYS, SYSTEM and PDB Admin user password:
Retype SYS, SYSTEM and PDB Admin user password:
The “-g 1” specifics that we want the single instance database to run on the second node. If we specified “-g 0”, the database will run on the first node of the ODA.
Job details
----------------------------------------------------------------
ID: fded47a6-1115-499e-90ee-5d01d7c4d182
Description: Database service creation with db name: oraqa
Status: Created
Created: May 25, 2021 4:47:41 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
[root@odax8a ~]# odacli describe-job -i fded47a6-1115-499e-90ee-5d01d7c4d182
Job details
----------------------------------------------------------------
ID: fded47a6-1115-499e-90ee-5d01d7c4d182
Description: Database service creation with db name: oraqa
Status: Success
Created: May 25, 2021 4:47:41 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
Setting up ssh equivalance May 25, 2021 4:47:47 PM CDT May 25, 2021 4:47:47 PM CDT Success
Creating volume dcloraqa May 25, 2021 4:47:47 PM CDT May 25, 2021 4:48:06 PM CDT Success
Creating volume datoraqa May 25, 2021 4:48:06 PM CDT May 25, 2021 4:48:24 PM CDT Success
Creating volume rdooraqa May 25, 2021 4:48:24 PM CDT May 25, 2021 4:48:43 PM CDT Success
Creating ACFS filesystem for DATA May 25, 2021 4:48:43 PM CDT May 25, 2021 4:49:03 PM CDT Success
Creating ACFS filesystem for FLASH May 25, 2021 4:49:03 PM CDT May 25, 2021 4:49:19 PM CDT Success
Database Service creation May 25, 2021 4:49:21 PM CDT May 25, 2021 5:00:12 PM CDT Success
Database Creation May 25, 2021 4:49:21 PM CDT May 25, 2021 4:57:29 PM CDT Success
Change permission for xdb wallet files May 25, 2021 4:57:29 PM CDT May 25, 2021 4:57:29 PM CDT Success
Place SnapshotCtrlFile in sharedLoc May 25, 2021 4:57:29 PM CDT May 25, 2021 4:57:32 PM CDT Success
SqlPatch upgrade May 25, 2021 4:58:52 PM CDT May 25, 2021 4:59:14 PM CDT Success
Running dbms_stats init_package May 25, 2021 4:59:14 PM CDT May 25, 2021 4:59:17 PM CDT Success
updating the Database version May 25, 2021 4:59:17 PM CDT May 25, 2021 4:59:20 PM CDT Success
Set CPU pool May 25, 2021 4:59:20 PM CDT May 25, 2021 4:59:20 PM CDT Success
create Users tablespace May 25, 2021 5:00:12 PM CDT May 25, 2021 5:00:15 PM CDT Success
Clear all listeners from Databse {fec53e5d-85f3-4481-badf-84ae113a796d} May 25, 2021 5:00:15 PM CDT May 25, 2021 5:00:16 PM CDT Success
Copy Pwfile to Shared Storage May 25, 2021 5:00:18 PM CDT May 25, 2021 5:00:20 PM CDT Success
To create a containerized database, we add the -c option, and also specify the name for the PDB with the -p option:
[root@odax8a ~]# odacli create-database -n oraprod -cl oltp -dh d5003afa-ba43-4453-add6-67444ed83d9d -s odb1 -r ACFS -y SI -g 0 -c -p pdb
Enter SYS, SYSTEM and PDB Admin user password:
Retype SYS, SYSTEM and PDB Admin user password:
Job details
----------------------------------------------------------------
ID: 3ff6bf06-af2a-4f28-a3d5-9be8aced3451
Description: Database service creation with db name: oraprod
Status: Created
Created: May 25, 2021 8:18:58 PM CDT
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
