Facing an internal inconsistency in the ODA derby database is very painful (see https://www.dbi-services.com/blog/oda-lite-what-is-this-odacli-repository/ for more info about the derby database). I have recently faced a case where the database deletion was failing and the database remained then in “Deleting” status. Connecting directly to the internal derby database and doing some self cleaning is very risky and should be performed at your own and known risk. So, in most of the case, a database inconsistency issue ends with an Oracle Support ticket to get their help for cleaning. Before doing so I wanted to look closer to the issue and was very happy to fix it myself. I wanted to share my experience here.
Issue description
As explained in the introduction, the database deletion failed and the database remained in “Deleting” status.
[root@prod1 ~]# odacli list-databases ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ---------------------------------------- ea49c5a8-8747-4459-bb99-cd71c8c87d58 testtst1 Si 12.1.0.2 false OLTP Odb1s ACFS Deleting 80a2e501-31d8-4a5d-83db-e04dad34a7fa
Looking at the job activity log, we can see that the deletion is failing while trying to delete the FileSystem.
[root@prod1 ~]# odacli describe-job -i 50a8c1c2-686e-455e-878f-eaa537295c9f Job details ---------------------------------------------------------------- ID: 50a8c1c2-686e-455e-878f-eaa537295c9f Description: Database service deletion with db name: testtst1 with id : ea49c5a8-8747-4459-bb99-cd71c8c87d58 Status: Failure Created: July 25, 2018 9:40:17 AM CEST Message: DCS-10011:Input parameter 'ACFS Device for delete' cannot be NULL. Task Name Start Time End Time Status ---------------------------------------- ----------------------------------- ----------------------------------- ---------- database Service deletion for ea49c5a8-8747-4459-bb99-cd71c8c87d58 July 25, 2018 9:40:17 AM CEST July 25, 2018 9:40:22 AM CEST Failure database Service deletion for ea49c5a8-8747-4459-bb99-cd71c8c87d58 July 25, 2018 9:40:17 AM CEST July 25, 2018 9:40:22 AM CEST Failure Validate db ea49c5a8-8747-4459-bb99-cd71c8c87d58 for deletion July 25, 2018 9:40:17 AM CEST July 25, 2018 9:40:17 AM CEST Success Database Deletion July 25, 2018 9:40:18 AM CEST July 25, 2018 9:40:18 AM CEST Success Unregister Db From Cluster July 25, 2018 9:40:18 AM CEST July 25, 2018 9:40:19 AM CEST Success Kill Pmon Process July 25, 2018 9:40:19 AM CEST July 25, 2018 9:40:19 AM CEST Success Database Files Deletion July 25, 2018 9:40:19 AM CEST July 25, 2018 9:40:19 AM CEST Success Deleting FileSystem July 25, 2018 9:40:21 AM CEST July 25, 2018 9:40:22 AM CEST Failure
I decided to have a look why it would have failed on the file system deletion step, and I was very surprised to see there was no data volume for this database anymore. This can be seen in the below volinfo command output. Not sure what happened, but it is weird : why failing if what you want to delete is no more existing and stopping processing further.
ASMCMD> volinfo --all Diskgroup Name: DATA Volume Name: COMMONSTORE Volume Device: /dev/asm/commonstore-265 State: ENABLED Size (MB): 5120 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: ACFS Mountpath: /opt/oracle/dcs/commonstore Diskgroup Name: RECO Volume Name: RECO Volume Device: /dev/asm/reco-403 State: ENABLED Size (MB): 304128 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: ACFS Mountpath: /u03/app/oracle/
Solution
So why not trying to give the ODA what he is expecting to see? Therefore I tried to create the ACFS volume with exact naming and I was very happy to see that this solved the problem. There was no other relation key than the name of the volume. Let’s look in details the steps I performed.
Let’s create the database expected data volume.
ASMCMD> volcreate -G DATA -s 10G DATTESTTST1 ASMCMD> volinfo -G DATA -a Diskgroup Name: DATA Volume Name: COMMONSTORE Volume Device: /dev/asm/commonstore-265 State: ENABLED Size (MB): 5120 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: ACFS Mountpath: /opt/oracle/dcs/commonstore Volume Name: DATTESTTST1 Volume Device: /dev/asm/dattesttst1-265 State: ENABLED Size (MB): 10240 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: Mountpath:
Let’s create the file system for the newly created volume.
grid@prod1:/home/grid/ [+ASM1] mkfs.acfs /dev/asm/dattesttst1-265 mkfs.acfs: version = 12.2.0.1.0 mkfs.acfs: on-disk version = 46.0 mkfs.acfs: volume = /dev/asm/dattesttst1-265 mkfs.acfs: volume size = 10737418240 ( 10.00 GB ) mkfs.acfs: Format complete.
Let’s check the expected mount points needed for the corresponding database.
[root@prod1 ~]# odacli describe-dbstorage -i 31d852f7-bdd0-40f5-9224-2ca139a2c3db DBStorage details ---------------------------------------------------------------- ID: 31d852f7-bdd0-40f5-9224-2ca139a2c3db DB Name: testtst1 DBUnique Name: testtst1_RZ1 DB Resource ID: ea49c5a8-8747-4459-bb99-cd71c8c87d58 Storage Type: Acfs DATA Location: /u02/app/oracle/oradata/testtst1_RZ1 RECO Location: /u03/app/oracle/fast_recovery_area/ REDO Location: /u03/app/oracle/redo/ FLASH Cache Location: State: ResourceState(status=Configured) Created: July 18, 2018 10:28:39 AM CEST UpdatedTime: July 18, 2018 10:29:01 AM CEST
In order to add and start the appropriate file system.
[root@prod1 testtst1_RZ1]# cd /u01/app/12.2.0.1/grid/bin/ [root@prod1 bin]# ./srvctl add filesystem -volume DATTESTTST1 -diskgroup DATA -path /u02/app/oracle/oradata/testtst1_RZ1 -fstype ACFS -autostart ALWAYS -mountowner oracle [root@prod1 bin]# ./srvctl start filesystem -device /dev/asm/dattesttst1-265
Let’s check the mounted file system.
[root@prod1 bin]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroupSys-LogVolRoot 30G 24G 4.1G 86% / tmpfs 189G 1.3G 187G 1% /dev/shm /dev/md0 477M 40M 412M 9% /boot /dev/sda1 500M 320K 500M 1% /boot/efi /dev/mapper/VolGroupSys-LogVolOpt 59G 13G 44G 22% /opt /dev/mapper/VolGroupSys-LogVolU01 99G 25G 69G 27% /u01 /dev/asm/commonstore-265 5.0G 319M 4.7G 7% /opt/oracle/dcs/commonstore /dev/asm/reco-403 297G 14G 284G 5% /u03/app/oracle /dev/asm/dattesttst1-265 10G 265M 9.8G 3% /u02/app/oracle/oradata/testtst1_RZ1
Let’s now try to delete the database again. Option -fd is mandatory to force deletion.
[root@prod1 bin]# odacli delete-database -i ea49c5a8-8747-4459-bb99-cd71c8c87d58 -fd { "jobId" : "976c8689-a69d-4e0d-a5e0-e40a30a77d29", "status" : "Running", "message" : null, "reports" : [ { "taskId" : "TaskZJsonRpcExt_471", "taskName" : "Validate db ea49c5a8-8747-4459-bb99-cd71c8c87d58 for deletion", "taskResult" : "", "startTime" : "July 25, 2018 10:04:24 AM CEST", "endTime" : "July 25, 2018 10:04:24 AM CEST", "status" : "Success", "taskDescription" : null, "parentTaskId" : "TaskSequential_469", "jobId" : "976c8689-a69d-4e0d-a5e0-e40a30a77d29", "tags" : [ ], "reportLevel" : "Info", "updatedTime" : "July 25, 2018 10:04:24 AM CEST" } ], "createTimestamp" : "July 25, 2018 10:04:23 AM CEST", "resourceList" : [ ], "description" : "Database service deletion with db name: testtst1 with id : ea49c5a8-8747-4459-bb99-cd71c8c87d58", "updatedTime" : "July 25, 2018 10:04:23 AM CEST" }
The database deletion is now successful.
[root@prod1 bin]# odacli describe-job -i 976c8689-a69d-4e0d-a5e0-e40a30a77d29 Job details ---------------------------------------------------------------- ID: 976c8689-a69d-4e0d-a5e0-e40a30a77d29 Description: Database service deletion with db name: testtst1 with id : ea49c5a8-8747-4459-bb99-cd71c8c87d58 Status: Success Created: July 25, 2018 10:04:23 AM CEST Message: Task Name Start Time End Time Status ---------------------------------------- ----------------------------------- ----------------------------------- ---------- Validate db ea49c5a8-8747-4459-bb99-cd71c8c87d58 for deletion July 25, 2018 10:04:24 AM CEST July 25, 2018 10:04:24 AM CEST Success Database Deletion July 25, 2018 10:04:24 AM CEST July 25, 2018 10:04:24 AM CEST Success Unregister Db From Cluster July 25, 2018 10:04:24 AM CEST July 25, 2018 10:04:24 AM CEST Success Kill Pmon Process July 25, 2018 10:04:24 AM CEST July 25, 2018 10:04:24 AM CEST Success Database Files Deletion July 25, 2018 10:04:24 AM CEST July 25, 2018 10:04:25 AM CEST Success Deleting Volume July 25, 2018 10:04:30 AM CEST July 25, 2018 10:04:32 AM CEST Success
Let’s check the volume and file system to make sure they have been removed.
ASMCMD> volinfo --all Diskgroup Name: DATA Volume Name: COMMONSTORE Volume Device: /dev/asm/commonstore-265 State: ENABLED Size (MB): 5120 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: ACFS Mountpath: /opt/oracle/dcs/commonstore Diskgroup Name: RECO Volume Name: RECO Volume Device: /dev/asm/reco-403 State: ENABLED Size (MB): 304128 Resize Unit (MB): 512 Redundancy: MIRROR Stripe Columns: 8 Stripe Width (K): 1024 Usage: ACFS Mountpath: /u03/app/oracle/ grid@prod1:/home/grid/ [+ASM1] df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroupSys-LogVolRoot 30G 24G 4.1G 86% / tmpfs 189G 1.3G 187G 1% /dev/shm /dev/md0 477M 40M 412M 9% /boot /dev/sda1 500M 320K 500M 1% /boot/efi /dev/mapper/VolGroupSys-LogVolOpt 59G 13G 44G 22% /opt /dev/mapper/VolGroupSys-LogVolU01 99G 25G 69G 27% /u01 /dev/asm/commonstore-265 5.0G 319M 4.7G 7% /opt/oracle/dcs/commonstore /dev/asm/reco-403 297G 14G 284G 5% /u03/app/oracle grid@prod1:/home/grid/ [+ASM1]
Listing the database would show that the unique database has now been deleted.
[root@prod1 bin]# odacli list-databases DCS-10032:Resource database is not found.
To complete the test and make sure all is ok, I created a new database, which I expected would be successful.
[root@prod1 bin]# odacli describe-job -i cf896c7f-0675-4980-a63f-a8a2b09b1352 Job details ---------------------------------------------------------------- ID: cf896c7f-0675-4980-a63f-a8a2b09b1352 Description: Database service creation with db name: testtst2 Status: Success Created: July 25, 2018 10:12:24 AM CEST Message: Task Name Start Time End Time Status ---------------------------------------- ----------------------------------- ----------------------------------- ---------- Setting up ssh equivalance July 25, 2018 10:12:25 AM CEST July 25, 2018 10:12:25 AM CEST Success Creating volume dattesttst2 July 25, 2018 10:12:25 AM CEST July 25, 2018 10:12:36 AM CEST Success Creating ACFS filesystem for DATA July 25, 2018 10:12:36 AM CEST July 25, 2018 10:12:44 AM CEST Success Database Service creation July 25, 2018 10:12:44 AM CEST July 25, 2018 10:18:49 AM CEST Success Database Creation July 25, 2018 10:12:44 AM CEST July 25, 2018 10:17:36 AM CEST Success Change permission for xdb wallet files July 25, 2018 10:17:36 AM CEST July 25, 2018 10:17:36 AM CEST Success Place SnapshotCtrlFile in sharedLoc July 25, 2018 10:17:36 AM CEST July 25, 2018 10:17:37 AM CEST Success Running DataPatch July 25, 2018 10:18:34 AM CEST July 25, 2018 10:18:47 AM CEST Success updating the Database version July 25, 2018 10:18:47 AM CEST July 25, 2018 10:18:49 AM CEST Success create Users tablespace July 25, 2018 10:18:49 AM CEST July 25, 2018 10:18:51 AM CEST Success [root@prod1 bin]# odacli list-databases ID DB Name DB Type DB Version CDB Class Shape Storage Status DbHomeID ---------------------------------------- ---------- -------- -------------------- ---------- -------- -------- ---------- ------------ ---------------------------------------- e0e8163d-dcaa-4692-85c5-24fb9fe17291 testtst2 Si 12.1.0.2 false OLTP Odb1s ACFS Configured 80a2e501-31d8-4a5d-83db-e04dad34a7fa