开发者社区> justinliu927> 正文

SharePoint 数据库管理-PowerShell

简介: 1. 显示所有SharePoint数据库 Get-SPDatabase –ServerInstance "SP2010\SQLSharePoint" 2.
+关注继续查看

1. 显示所有SharePoint数据库

Get-SPDatabase –ServerInstance "SP2010\SQLSharePoint"

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 "SP2010\SQLSharePoint"

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:\Backups\BICenter.bak

15. 还原网站集

Restore-SPSite –Identity "http://sp2010/sites/BICenter"
–Path F:\Backups\BICenter.bak –Force

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
+关注
justinliu927
专注开发技术、SharePoint、云平台。Microsoft MVP。
文章
问答
视频
文章排行榜
最热
最新
相关电子书
更多
Infecting-The-Enterprise-Abusing-Office365-Powershell-For-Covert-C2
立即下载
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载