Events
Microsoft 365 Community Conference
May 6, 2 PM - May 9, 12 AM
Skill up for the era of AI at the ultimate community-led Microsoft 365 event, May 6-8 in Las Vegas.
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
APPLIES TO: 2013
2016
2019
Subscription Edition
SharePoint in Microsoft 365
You can attach and restore a read-only content database in SharePoint Server by using PowerShell.
A SharePoint Server farm in which content databases are set to be read-only can be part of a failure recovery environment that runs against mirrored or log-shipped content databases or part of a highly available maintenance or patching environment that provides user access when another version of the farm is being updated.
Before you begin this operation, review the following information about prerequisites:
When you re-attach the read-only databases, they become read-write.
For more information about how to use read-only databases, see Run a farm that uses read-only databases in SharePoint Server.
You can use only PowerShell to attach and restore a read-only content database.
To attach and restore a read-only content database by using PowerShell
Verify that you have the following memberships:
securityadmin fixed server role on the SQL Server instance.
db_owner fixed database role on all databases that are to be updated.
Administrators group on the server on which you are running the PowerShell cmdlets.
An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server cmdlets.
Note
If you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.
Start the SharePoint Management Shell.
At the PowerShell command prompt, type the following command:
Mount-SPContentDatabase -Name <DatabaseName> -WebApplication <WebApplicationID> [-Verbose]
Where:
<DatabaseName> is name of the read-only database.
<WebApplicationID> is ID assigned to the read-only database.
Note
Attaching a content database by using the Mount-SPContentDatabase
cmdlet differs from attaching a database in SQL Server by using SQL Server tools. Mount-SPContentDatabase
associates the content database with a Web application so that the contents can be read.
For more information, see Mount-SPContentDatabase.
Note
We recommend that you use Microsoft PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.
Events
Microsoft 365 Community Conference
May 6, 2 PM - May 9, 12 AM
Skill up for the era of AI at the ultimate community-led Microsoft 365 event, May 6-8 in Las Vegas.
Learn moreTraining
Module
Manage SharePoint Online by using Windows PowerShell - Training
Manage SharePoint Online by using Windows PowerShell