實現一個SiteCollection一個ContentDatabase

來源:互聯網
上載者:User
在Sharepoint中,一個WebApplication可以有一個到多個ContentDatabase,而一個SiteCollection只能在一個ContentDatabase中(不能跨ContentDB)。 如果Farm Administrator不手動添加,可能就會一直用一個ContentDB,其結果就是多個SiteCollection共用一個ContentDB,這本身沒有大的問題,因為一個ContentDB即使大到100G,據說Sharepoint也可以管理得很好。 但是作為Best Practice,推薦是為每一個SiteCollection使用獨立的ContentDB,這樣便於管理,便於備份恢複...N多好處。新發現:如果建立WebApplication時手動添加了多個ContentDatabase,當你在該WebApp中建立新的SC時,Sharepoint會自動使用空的ContentDB而不是在預設的那個ContentDB中加入新SC,以此看來,Sharepoint預設會follow一個SC一個ContentDB的最佳實務。 但是如何能實現這一點呢?很簡單,既可以用Central Administration來實現也可以用Powershell來實現:1. Central Administrationhttp://blog.arjanfraaij.com/2011/01/sharepoint-2010-add-site-collection-to.html思路是將WebApplication中現有的ContentDatabase的容量最大值設定成當前已有的SiteCollection數,然後再建立新的ContentDatabase,並且設定成最多隻能放一個SiteCollection。這樣當建立新的SiteCollection時,系統就會自動選擇建立的那個ContentDatabase了。 這篇Blog的作者做了更多的實驗,比如把一個空的ContentDatabase的WarningSiteCount和MaxSiteCount都設定成0,Central Admin會給出錯誤提示,而實際上設定是有作用的。有趣的是,當再一次更改其他ContentDatabase的屬性時,那個0-0設定會自動回復成系統預設值9000-15000。在Central Admin裡面建立SiteCollection時無法指定ContentDatabase,而用Powershell可以做到(New-SPSite的-ContentDatabase參數)2. Powershellhttp://sharepointadam.com/2010/11/12/create-site-collection-in-new-content-database-script/function Create-SC-OwnCDB($dbserver, $ncdbname, $webapp, $site, $owner1, $owner2)

{  Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue   New-SPContentDatabase -Name $ncdbname -DatabaseServer $dbserver -WebApplication $webapp | out-null  New-SPSite -URL $site -OwnerAlias $owner1 -SecondaryOwnerAlias $owner2 -ContentDatabase $ncdbname | out-null  Get-SPContentDatabase -Site $site | Set-SPContentDatabase -MaxSiteCount 1 -WarningSiteCount 0  Write-Host " "  Write-Host "Site Collection at " $site " has been created in the " $ncdbname " content database" -ForegroundColor Yellow

}

 Create-SC-OwnCDB -dbserver xxx -ncdbname WSS_Content_Abc -webapp http://aserver:6666/ -site http://aserver:6666/sites/Abc -owner1 domain\user1 -owner2 domain\user2 此外,還有一個有用的Powershell命令可以用來將一個SiteCollection遷移到其它ContentDB:Move-SPSite: http://technet.microsoft.com/en-us/library/ff607915.aspx

通過 Wiz 發布

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.