SharePoint 数据库管理-PowerShell

1. 显示所有SharePoint数据库

Get-SPDatabase –ServerInstance "SP2010SQLSharePoint"

2. 获取指定的数据库

$database = Get-SPDatabase
-Identity 47036154-7a05-44be-9137-9be09f43ccb5

3. 创建一个新的内容数据库

New-SPContentDatabase –Name NewContentDB –WebApplication "PSWebApp"

4. 显示一个Web应用程序下所有的数据库

Get-SPContentDatabase –WebApplication "PSWebApp"

5. 从一个Web应用程序移除一个数据库

$database = Get-SPContentDatabase
-Identity 025b1239-cd62-451e-943d-dff2e0d52ec8
Dismount-SPContentDatabase $database

6. 附加一个数据库到Web应用程序

Mount-SPContentDatabase –Name "NewContentDB"
–WebApplication "PSWebApp"

7. 删除一个内容数据库

$database = Get-SPContentDatabase
-Identity 025b1239-cd62-451e-943d-dff2e0d52ec8
Remove-SPContentDatabase $database

8. 创建配置数据库

New-SPConfigurationDatabase –DatabaseName NewConfigurationDB
–DatabaseServer "SP2010SQLSharePoint"

9. 删除配置数据库

Remove-SPConfigurationDatabase

10. 备份配置数据库

Backup-SPConfigurationDatabase –Directory F:Backups

Backup-SPFarm –BackupMethod Full –Directory F:Backups
-ConfigurationOnly

Full为完全备份,也可以使用Differential增量备份

11. 恢复配置数据库

Restore-SPFarm –Directory F:Backups –ConfigurationOnly
–RestoreMethod Overwrite

12. 备份SharePoint场

Backup-SPFarm –BackupMethod Full –Directory F:Backups

使用-ShowTree参数显示场中所有可备份的项目;使用-Item参数备份指定的项目

13. 恢复SharePoint场

Restore-SPFarm –Directory F:Backups –RestoreMethod Overwrite

使用-Item参数恢复指定的项目

14. 备份网站集

Backup-SPSite –Identity "http://sp2010/sites/BICenter"
–Path F:BackupsBICenter.bak

15. 还原网站集

Restore-SPSite –Identity "http://sp2010/sites/BICenter"
–Path F:BackupsBICenter.bak –Force
原文地址:https://www.cnblogs.com/justinliu/p/5961724.html