Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I do have a SharePoint (2013) site collection that is stuck in read only mode due to a backup that was either interrupted or didn't terminated properly.

I'm unable to unlock from :

  • Site Quotas and Lock in Central Administration (option is greyed-out)
  • Stsadm : operation completes successfully but no change
  • Using PowerShell : same behavior as stsadm

I reviewed the associated content database to ensure it was not in single user mode neither in read-only which was not the case. Disk space is not an issue neither.

Anyone knows how SharePoint is persisting that information in the content database so that I could have a sneak peek ? Any other way to unlock this state ?

If anyone wants to reproduce this, you can break a backup operation (stsadm / powershell CTRL+C) while the site is being backed up. The ReadOnlyMode Property (and the associated MaintenanceMode property) will be left to "True" preventing any update.

share|improve this question
    
Shame on me because I don't have a backup, the only back up I have was made from the actual read-only site and when I restored it on a new farm it was still on read only mode and impossible to change the setting to unlock it !!! If you have any info how to remove this read-only flag, we will appreciate. Thanks, Phil –  user16745 May 1 '13 at 16:33
    
Actually, the flag can be changed in your backup file, if you create a backup (without it being locked) and then the same backup with the site collection locked, and you do a comparison of both files (content wise), you'll see only the timestamp and the lock state is stored. I successfully unlock a small backup by editing the offending two lines (one at the beginning and one later on) but never on the production backup that gave my customer issues (10gb+...) Good luck Phil –  Francois Verbeeck May 1 '13 at 19:38
    
Thank you Francois, but unfortunately the only backup I have is when the site collection was in read-only mode. I also try to do another backup –  user16745 May 1 '13 at 20:59

5 Answers 5

up vote 6 down vote accepted

This is a nightmare situation to be in! Got it escalated in Microsoft who indeed know and have already fixed the source (so terminated backups don't trigger this) in the April CU http://blogs.technet.com/b/stefan_gossner/archive/2013/04/27/april-2013-cu-for-sharepoint-2013-has-been-released.aspx - you have to install March CU first.

However, it does not yet fix the fact that you can't switch the Site Collection back out of read-only, so is still a killer situation to be in, especially with a big site. Worse, it's no good restoring a new completed backup of the locked site coll (even though you know there's nothing actually wrong with it other than the read-only/maintenance-mode flag!) - as after all that, it remains locked! Fortunately though, the flag is at Site Coll level, not Farm, so even if it was your first backup (we had just migrated all the docs into it and go-live went pear-shaped thanks to this!) or you don't want to lose data with a recent backup, we found you can safely use Export-SPWeb to get everything out of that locked Site Coll, delete the Site Coll (painful but necessary!), create new and use Import-SPWeb to bring it all back again.

Tip - Import-SPWeb can just use the original filename of the Export and it will automatically chain together all those multiple .cmp files it split any large site into so you don't have to do them individually.

We've run it a day now and to our relief everything including the item-level permissions mapped to FBA accounts (you'll use -IncludeUserSecurity on the Export-SPWeb of course) is all running fine again. Heart attack over for now!


UPDATE :

Microsoft called me back and gave me the solution!

PS C:\Users\root> $Admin =  new-object Microsoft.SharePoint.Administration.SPS
iteAdministration('http://root.toto.com')
PS C:\Users\root> $Admin.ClearMaintenanceMode()
PS C:\Users\root> $site.MaintenanceMode
True

After that, my site collection is not read-only any more!

share|improve this answer
    
Fantastic, thanks for the follow-up ! –  Francois Verbeeck May 21 '13 at 12:58
    
yes, thank you for the update. Had the same issue and fortunately the last powershell commands solved it. –  Shihan Jun 7 '13 at 12:02
    
Thanks a lot for this. You save me today... –  Sudhir Kesharwani Nov 25 '13 at 22:02
    
Is there a similar definitive and easy solution for SP2010 too? 'cause the method "ClearMaintenanceMode()" doesn't exist for SP 2010 :( Thanks, Anthony –  user21098 Nov 28 '13 at 12:25
    
@user21098 I'm afraid this method was def only brought into the SP2013 CU (not the original base 2013 RTM), so doubt if it exists at all in SP2010 (which you've just confirmed really - if you've applied all Service Packs). Am surprised a 2010 install has the same problem otherwise they'd be postings all over the place about the nightmare (but nothing surprises anymore!) - open up another case tagged 2010 with exact scenario to get responses and see if folk have. Best of luck! –  Europhile Nov 28 '13 at 16:06

it's seems to be a SharePoint issue. Here is a post which can maybe help you.

EDITED:

Indeed this is a known issue from Microsoft. The only way to fix this is to restore backup of your site overriding locked site collection. This way the flag that is set to read only will be free by restore process and the site collection will be available again

Andrew

share|improve this answer
    
Thanks for the feedback Andrew –  Francois Verbeeck Apr 4 '13 at 12:24

Just to make this clear for others who read this. You cannot fix this on SharePoint RTM with the above commands. You must first Upgrade RTM to March and then April. Once complete, run the following two commands on the site in question.

PS C:\Users\root> $Admin =  new-object Microsoft.SharePoint.Administration.SPSiteAdministration('http://root.toto.com')
PS C:\Users\root> $Admin.ClearMaintenanceMode()

That's it.

This is absolute madness that SharePOint 2013 needs two CU upgrades before you can reach the property through Powershell. Atleast there is a solution I suppose.

share|improve this answer

An alternate solution to the problem of not having upgraded to April 2013 CU is a simple powershell script that uses reflection to set the value of the internal 'MaintenanceMode' property:-

$site = Get-SPSite http://urltofreakinlockedsite/
$site.GetType().GetProperty("MaintenanceMode").GetSetMethod($true).Invoke($site, @($false))

This approach has the advantage of not needing to touch the database. Having used .NET Reflector on the April 2013 CU version of Microsoft.SharePoint.dll, this is in fact what SPSiteAdministration.ClearMaintenanceMode() does!

You will need to run this on the server, and as a farm administrator with write access to the content db.

This will work on pre- and post-April 2013 CU versions of SharePoint 2013

share|improve this answer

While not the best solution, if you're unable to upgrade to the April 2013 CU, directly editing the LifeCycleFlags in the content database will unlock the site.

  • Connect to the SQL Server, and browse to the Content Database
  • Take a backup for good measure
  • Run the query select * from allsites
  • Take note of the URL and ID of the site you're after
  • Run the query Update allsites set LifeCycleFlags = 1 where Id = ''
  • No iisreset is required, change will appear instantly, ensure you test the environment to ensure there are no related issues

Please note, this solution will unlock the site collection and as always direct editing of SQL should only take place as a last resort.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.