Read-Only Lock



  • Avatar
    Per Svedenbring

    We are going with AlwaysOn High Availability Groups and are having a problem. When the first SQL-server is primary it works. When we failover to the second we get this error in SharePoint:

    We apologize for any inconvenience, but we've made the site read only while we're making some improvements.

    It seems locked somehow. The database properties says Read-Only = False.

    I try some coding:

    $SiteURL = "https://siteXXX"
    $Admin = new-object Microsoft.SharePoint.Administration.SPSiteAdministration($SiteURL)


    Set-SPSite -Identity "https://siteXXX" -LockState "Unlock"


    $site = get-spsite https://siteXXX

    $site.GetType().GetProperty("MaintenanceMode").GetSetMethod($true).Invoke($site, @($false));

    but Always get this error: "Failed to update database "SP_ContentDB_XXX" because the database is read-only.

    What is happening and any suggestion how to solve it? SharePoint 2016.

    Comment actions Permalink
  • Avatar

    Hello Per,

    Thank you for your comment. I'm going to go ahead and open a ticket with Support for you, they'll be better aligned to help you with this issue!


    Comment actions Permalink
  • Avatar

    The Microsoft article mentioned in this post is only for SharePoint Server. You can make a SPO site ReadOnly by the following script. You must be a SharePoint Online Admin and a Site Collection Admin. 


    Set-SPOSite -Identity https://<yourtenant><yoursite> -LockState ReadOnly
    Set-SPOSite -Identity https://<yourtenant><yoursite> -LockState Unlock
    To view the status of the site you can access the site or check it using powershell. 
    Get-SPOSite -Identity https://<yourtenant><yoursite> | fl
    LastContentModifiedDate : 12/17/2019 4:10:14 PM

    Status : Active

    ResourceUsageCurrent : 0

    ResourceUsageAverage : 0

    StorageUsageCurrent : 2192

    LockIssue :

    WebsCount : 1

    CompatibilityLevel : 15

    DisableSharingForNonOwnersStatus :

    HubSiteId : 00000000-0000-0000-0000-000000000000

    IsHubSite : False

    RelatedGroupId : 00000000-0000-0000-0000-000000000000

    GroupId : 00000000-0000-0000-0000-000000000000

    Url : https://<yourtenant><yoursite

    LocaleId : 1033

    LockState : ReadOnly

    Owner : <your site owner UPN>

    StorageQuota : 512000

    StorageQuotaWarningLevel : 460800

    ResourceQuota : 300

    ResourceQuotaWarningLevel : 0

    Template : STS#0

    Title : <Your site>
    Comment actions Permalink

Please sign in to leave a comment.