Step 5 - Delete and Recreate a Database
You can also use CLI to delete a database. Run odacli delete-database
to remove database db2
. Be sure to use the ID of your db2
database, which is likely different from the one in this workbook. Note that you can also use the database name instead of the ID.
$ odacli delete-database -i d1e615c3-5855-4b19-9ad0-40b620ac5f13
{
"jobId" : "ccde4700-3c1e-423a-8079-477f49f8cd5f",
"status" : "Running",
"message" : null,
"reports" : [ {
"taskId" : "TaskZJsonRpcExt_10048",
"taskName" : "Validate db d1e615c3-5855-4b19-9ad0-40b620ac5f13 for deletion",
"taskResult" : "OK",
"startTime" : "February 26, 2022 01:49:40 AM UTC",
"endTime" : "February 26, 2022 01:49:40 AM UTC",
"status" : "Success",
"taskDescription" : null,
"parentTaskId" : "TaskSequential_10046",
"jobId" : "ccde4700-3c1e-423a-8079-477f49f8cd5f",
"tags" : [ ],
"reportLevel" : "Info",
$ odacli list-databases
ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID
---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ----------------------------------------
324a42ea-bba2-477d-8bca-5a26af159f1c db3 SI 19.13.0.0.211019 false OLTP odb1 ASM CONFIGURED ecfa440e-2482-40c1-8ccd-67316cd48ba2
$ odacli delete-database -i d1e615c3-5855-4b19-9ad0-40b620ac5f13
{
"jobId" : "ccde4700-3c1e-423a-8079-477f49f8cd5f",
"status" : "Running",
"message" : null,
"reports" : [ {
"taskId" : "TaskZJsonRpcExt_10048",
"taskName" : "Validate db d1e615c3-5855-4b19-9ad0-40b620ac5f13 for deletion",
"taskResult" : "OK",
"startTime" : "February 26, 2022 01:49:40 AM UTC",
"endTime" : "February 26, 2022 01:49:40 AM UTC",
"status" : "Success",
"taskDescription" : null,
"parentTaskId" : "TaskSequential_10046",
"jobId" : "ccde4700-3c1e-423a-8079-477f49f8cd5f",
"tags" : [ ],
"reportLevel" : "Info",
$ odacli list-databases
ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID
---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ----------------------------------------
324a42ea-bba2-477d-8bca-5a26af159f1c db3 SI 19.13.0.0.211019 false OLTP odb1 ASM CONFIGURED ecfa440e-2482-40c1-8ccd-67316cd48ba2
Using the CLI, create a new database db4
.
$ odacli create-database -n db4 -v 19.13.0.0
Enter SYS, SYSTEM and PDB Admin user password:
Retype SYS, SYSTEM and PDB Admin user password:
Job details
----------------------------------------------------------------
ID: aa259376-4ac0-474a-8730-8c8e1c8ac504
Description: Database service creation with db name: db4
Status: Created
Created: February 26, 2022 1:51:50 AM UTC
Message:
Task Name Start Time End Time Status
---------------------------------------- ----------------------------------- ----------------------------------- ----------
# odacli list-databases
ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID
ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID
---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ----------------------------------------
324a42ea-bba2-477d-8bca-5a26af159f1c db3 SI 19.13.0.0.211019 false OLTP odb1 ASM CONFIGURED ecfa440e-2482-40c1-8ccd-67316cd48ba2
deac01db-eaa8-4f4e-a511-aea042be3a18 db4 SI 19.13.0.0.211019 false OLTP odb1 ASM CONFIGURED c3c63738-703e-4c1d-98de-95b551b67468