Yay!! My first blog post here and I will start pushing hard!!
I will talk about VMWare, a problem I have seen twice already. I won’t be suprised if you get desperate, looks awful, but can be very easy to fix.
Have you opened your vCenter and found that all your servers are orphaned and your esx hosts with a red mark?
Well, if you are on this situation stay with me, I will go through the possible solution for your problem.
I’m assuming you have your vCenter server on a Microsoft Windows machine.
Connect to the vCenter server using Remote Desktop Connection. Now open Application event log in Event Viewer. You are now finding why vCenter is that way. Don’t panic.
Event ID 1827 and Event ID 1805
It is a SQL Server error, vCenter database has reached its size limit.
Could not allocate space for object ‘dbo.VPX_HOST_VM_CONFIG_OPTION’.’PK_VPX_HOST_VM_CONFIG_OPTION’ in database ‘VIM_VCDB’ because the ‘PRIMARY’ filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
Now open SQL Server Management Studio as admin. If you don’t have it installed here are the links:
SSMS 2012 –https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms
SSMS 2008 – http://www.microsoft.com/en-us/download/details.aspx?id=7593
Connect to your instance (localhost\vim_sqlexp), expand Databases and click on VIM_VCDB.
Here you have three things to do:
1. Purge old tasks and event tables
2. Truncate the Event and Tasks table
Let’s first purge old entries.
Expand VIM_VCDB > Tables
Right-click the dbo.VPX_PARAMETER table and click Open.
Note: If you are using SQL Server 2008, right-click the dbo.VPX_PARAMETER table and click Edit Top 200 Rows.
Modify event.maxAge to 30 and the event.maxAgeEnabled value to true.
Modify task.maxAge to 30 and the task.maxAgeEnabled value to true.
After you modified now we’ll run a stored procedure to purge entries older than 30 days. Default is 180, so you would have a good amount of data to be deleted and this can take a while.
Go to VIM_VCDB > Programmability > Stored Procedures.
Right-click dbo.cleanup_events_tasks_proc and select Execute Stored Procedure.
The operation may fail due to the transaction logs being filled up at multiple intervals based on the data to be purged. You must shrink the Transaction logs when required and run dbo.cleanup_events_tasks_proc again
At this stage you have freed up some space, but is still required to truncate the event and tasks table. This can also take a while to finish, be patient.
Be careful now, you are responsible for anything wrong that happens.
Click on the database VIM_VCDB and click “New Query”. Copy and paste the following script:
alter table VPX_EVENT_ARG drop constraint FK_VPX_EVENT_ARG_REF_EVENT, FK_VPX_EVENT_ARG_REF_ENTITY
alter table VPX_ENTITY_LAST_EVENT drop constraint FK_VPX_LAST_EVENT_EVENT
truncate table VPX_TASK
truncate table VPX_ENTITY_LAST_EVENT
truncate table VPX_EVENT
truncate table VPX_EVENT_ARG
alter table VPX_EVENT_ARG add constraint FK_VPX_EVENT_ARG_REF_EVENT foreign key(EVENT_ID) references VPX_EVENT (EVENT_ID) on delete cascade,
constraint FK_VPX_EVENT_ARG_REF_ENTITY foreign key (OBJ_TYPE) references VPX_OBJECT_TYPE (ID)
alter table VPX_ENTITY_LAST_EVENT add constraint FK_VPX_LAST_EVENT_EVENT foreign key(LAST_EVENT_ID)
references VPX_EVENT (EVENT_ID) on delete cascade
At this stage you should be seeing less red in your application event viewer and some informational events, now restart your VMWare VirtualCenter service from Services console.
Now you can open your vcenter and also your virtual machines will be all green.
Note: If you found a disconnected ESX host, connect via CLI (Putty) to the disconnected host using root credentials, run the following commands and then right click the host in vCenter and click “Reconnect”.
Thats it folks!!
See ya later…
Thiago Di Giorgio