Operation is not valid due to the current state of the object

Issue:

The DR environment is offline, couldn’t browse to any of the DR sites. Getting error “Operation is not valid due to the current state of the object”

Background

There were two environment: PROD + DR farm.

All content databases are log shipped from The Production SQL cluster to the DR SQL cluster

What Happened?

  1. SP 2007 SP3 and Dec 2011 CU applied, and the databases were brought out of log shipped mode and Production and DR. At this stage DR was working fine, but log shipping was not working.  The DR continued to function.
  2. On the next day they have migrated SQL server ( From 2005 to 2008). Farm Config Databases were backed up and restored from SQL 2005 to SQL 2008 R2.  The content databases had the log shipping configured again.
  3. After the migration we started facing issues. None of the sites are accessible and we were getting “Unknown” error.

Errors:

  1. Browse site with errors enabled: Operation is not valid due to the current state of the object.
  2. View Content Database from CA: Operation is not valid due to the current state of the object.
  3. stsadm -o deletecontentdb: Operation is not valid due to the current state of the object.

Resolution:

  1. In the SharePoint logs found that the config refresh job has not been running since long time on the farm and the servers were out of sync. (https://technet.microsoft.com/en-us/library/cc424971(v=office.12).aspx)
  2. Cleared the config timer cache by following the below steps on all the servers in Farm :

o Click Start, point to Administrative Tools, and then click Services.

o Right-click Windows SharePoint Services Timer, and then click Stop.

o Close the Services console.

· On the computer that is running Microsoft Office SharePoint Server 2007 and on which the Central Administration site is hosted, click Start, click Run, type explorer, and then press ENTER.

· In Windows Explorer, locate and then double-click the following folder: Drive:\ProgramData\Microsoft\SharePoint\Config\GUID

Notes

· The Drive placeholder specifies the letter of the drive on which Windows is installed. By default, Windows is installed on drive C.

· The GUID placeholder specifies the GUID folder.

· The Application Data folder may be hidden. To view the hidden folder, follow these steps:

· On the Tools menu, click Folder Options.

· Click the View tab.

· In the Advanced settings list, click Show hidden files and folders under Hidden files and folders, and then click OK.

o Back up the Cache.ini file.

o Delete all the XML configuration files in the GUID folder. Do this so that you can verify that the GUID folder is replaced by new XML configuration files when the cache is rebuilt.

· Note When you empty the configuration cache in the GUID folder, make sure that you do not delete the GUID folder and the Cache.ini file that is located in the GUID folder.

o Double-click the Cache.ini file.

o On the Edit menu, click Select All.

o On the Edit menu, click Delete.

o Type 1, and then click Save on the File menu.

o On the File menu, click Exit.

o Start the Timer service. To do this, follow these steps:

· Click Start, point to Administrative Tools, and then click Services.

· Right-click Windows SharePoint Services Timer, and then click Start.

  1. Ran the following command on both servers to execute the pending jobs: stsadm –o execadmsvcjobs (https://technet.microsoft.com/en-us/library/cc262783(v=office.12).aspx)
  1. Ensured the content databases are back online, however the sites were not accessible.
  1. Checked the IIS on each server and found that the Sites are provisioned ( Intranet & Mysite).
  1. Re-provisioned the Web application services on both the servers by running the following command lines:

stsadm -o provisionservice -action start -servicetype spwebservice -servicename ""

stsadm -o provisionservice -action stop -servicetype spwebservice -servicename ""

https://technet.microsoft.com/en-us/library/cc262031(v=office.12).aspx

  1. Ensured that the sites are provisioned on IIS properly and able to browse to them.

Recommendation:

1. In the future If there is any planned SQL maintenance or SharePoint maintenance, lets ensure the services ( services.msc) are stopped & Disabled on SharePoint servers:

· Windows SharePoint Administration Services

· Windows SharePoint Timer service

· Office SharePoint Search service

· Worldwide publishing services.

2. After the maintenance, start all the services and clear the timer cache on all the SharePoint servers ( Refer the step 2 above).

3. Run the following command on all the SharePoint servers: stsadm –o execadmsvcjobs

4. Ensure all the timer jobs are succeeded. ( Central Admin--> Operations --> Timer Job Status)

Hope this helps!

Cheers

Bala