i lost storage array and we rebuilt the datastores from scratch and restored my vms but as a result i have all the inactive datastores which are not connected to any ESXi and there is no file/VM inside those datastores.
How I can delete them from vcenter when delete option is grayed-out.
esxi rebooted but no affect.
There could be 2 reason
Still some of vm have orphaned entry of previous data store , just check 2-3 vm ( edit setting --disk)
Or May be SIOC was enabled on previous DS
Run the below query to identify the datastore ID in the vCenter Server database:
select ID from VPX_ENTITY where name ='datastore_name';
Where datastore_name is the datastore to be removed. The query returns the ID of the datastore.
To remove the datastore from the vCenter Server database:
Run the below queries to delete the datastore. Where ID is the output from the first step above.
delete from VPX_DS_ASSIGNMENT where DS_ID=ID;
delete from VPX_VM_DS_SPACE where DS_ID=ID;
delete from VPX_DATASTORE where ID=ID;
delete from VPX_ENTITY where ID=ID;