次の方法で共有


SharePoint 2010 Databases and Windows PowerShell

There are several ways to maintain and configure, and backup and restore SharePoint 2010 databases. The obvious way is with SharePoint Central Administration, however, the easiest and perhaps best way is to use Windows PowerShell cmdlets. There are many cmdlets available to use with SharePoint databases.

In an earlier blog I showed how to find active databases in a SharePoint 2010 farm. In this blog I’ll show more things you can do to SharePoint databases using Windows PowerShell.

The following list is a mere sample of the SharePoint database tasks you can do by using Windows PowerShell:

  • Disconnect a local server computer from a farm — Disconnect-SPConfigurationDatabase
  • Connect a local server computer to a farm — Connect-SPConfigurationDatabase
  • Create a new configuration database — New-SPConfigurationDatabase
  • Remove a configuration database — Remove-SPConfigurationDatabase
  • Dismount a content database — Dismount-SPContentDatabase
  • Mount a content database — Mount-SPContentDatabase
  • Backup a SharePoint farm’s configuration — Backup-SPConfigurationDatabase -Directory <BackupFolder> -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> -DatabaseCredentials <WindowsPowerShellCredentialObject> [-Verbose]
  • Backup a complete SharePoint farm— Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} [-Verbose]
  • Backup a SharePoint service application — Backup-SPFarm | -Directory <BackupFolder> -BackupMethod {Full | Differential} -Item <ServiceApplicationName> [-Verbose]
  • Restore a SharePoint farm’s configuration — Restore-SPFarm –Directory <RestoreShare> -RestoreMethod Overwrite –ConfigurationOnly
  • Restore a complete SharePoint farm — Restore-SPFarm –Directory <BackupFolder> -RestoreMethod Overwrite [–BackupId <GUID>]
  • Restore a SharePoint service application — Restore-SPFarm –Directory <BackupFolder> -Item “<ServiceApplicationName>” –RecoveryMethod Overwrite –BackupId <GUID> [-Verbose]

This list merely shows a small sample of what you can accomplish using Windows PowerShell when working with SharePoint 2010 databases.  For more details see the following topics:

 For help building and using Windows PowerShell cmdlets, see Bill Baer’s Windows PowerShell Command Builder available here,

 https://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html

 Thanks for reading,

Steve Hord, Technical Writer, SharePoint Content Publishing