SharePoint 2007 Quotas, Locks Control DB size How to Tips etc

From here, more here

Jim added this on March 19, 2010 as his own observations.

This is interesting, for a given web app, you configure default quota’s for all new Site Collections, do this under general settings, you just pick a template from the list or add one if you do not like those limits. It gets interesting when you want to apply a template to a My Site web app, the rules are different. There is an oob Quota template called Personal Sites, even if this is not set as default in the Web App it will use this template anyway and if you try to set the My Site web app default template to other than “Person Site” it will ignore it and always use Personal Site.

It is interesting to note that “non my sites” and My Sites web apps that changing the template to a different one or changing its values do not adjust the values on existing sites, this has to be done by hand or by code or PowerShell.

To set locks in PowerShell is also interesting because if you set a lock and try to change later to unlocked it is locked and script errors. The work around this you need to change the order of executing the locks or change the values to false for all and re-run the script to set your desired lock.

$sites = $WebApp.Sites
foreach ($site in $Sites)
{
   $Site.ReadLocked = $false     #Blocks access completely
   $Site.WriteLocked = $true    #Blocks adding data, but can delete data
   $Site.ReadOnly = $false       #Blocks additions, deletions etc if true
   $Site.LockIssue = "Write Locked = True" 

Another bizarre thing is if you set the quota in PowerShell not using a template, an “Individual quota” is set behind the scenes but the template shown to the user in Central Admin (CA) remains as the original one and it does not read Individual Quota. You can change it manually in CA to Individual Quota from the pick list under quotas and locks then it will show the behind the scenes manual setting you made in PowerShell. This confused me big time, it seemed like a bug but may be not if you set the Individual Quota Template in code your self.

 

This is original article

Because Windows SharePoint Services is meant for users to store data and documents, it can take up more space than expected very quickly. The three main ways to prevent site collections from consuming too much storage space: quotas, locks and content db warnings. Quotas and Locks can be configured on a per-site collection basis, so you can have different quotas for different site collections, and you can lock specific site collections when limit is reached without locking others. The Locking can be set to disable site or to allow site to function with various limitations that will be explained later. The Content db has settings for warning the admins when quantity of site collections is reaching its limit but the physical limit size is set at the dba level.

You can create Quota templates to allow for standards and defaults. It’s a good idea to create site quota templates rather than manually entering the quota on each site collection. To create a new Quota template, go to Central Administration’s Application Management page, and in the SharePoint Site Management category, click Quota Templates. This will take you to the page in Figure 8.8.

Figure 8.8 Create a Quota template
Create a Quota template

Using this page, you can create a new template or edit an existing one. Each template needs a name and a storage size limit. You can also set the server to email the site administrators when the site collection reaches a certain size, to warn them that they are approaching that limit.

Dd576268.note(en-us,office.12).gifNote:

LIMITED INVITATION

If you had Active Directory Account Creation mode enabled, it is also here that you would set the limit on the number of users that can be invited to a site collection. It is not applicable otherwise.

For my example I am going to create a quota for site collections meant to contain blogs. Later in the chapter, I will provide a web application for blogging site collections, and it would be nice to have a storage quota for them. Name the quota by entering it in the New template name field, mine uses Blog Quota. For the quota limits, set the limit to 200MB, with a warning at 150MB.

You can edit existing quota templates on this page, delete a template, as well as create a new template based on an existing one. Quota templates, despite being meant to be applied to site collections, are a farm-wide setting.

Dd576268.Tip(en-us,office.12).gifTip:

EDIT AND DELETE ARE MISSING

Don’t be alarmed if you notice (as you can see in Figure 8.6) that there doesn’t seem to be any settings for editing or deleting a quota template. If there are any existing templates in the farm, the options to edit a template, as well as the delete button, will become available.

Site Quotas and Locks

To assign a quota to an existing site collection, check the current storage used, or to lock the site collection, click Site Collection Quotas and Locks on the Application Management page. This will take you to the page in Figure 8.9.

Figure 8.9 Site Collections Quotas and Locks page
Site Collections Quotas and Locks page

Check the Site Collection section to make sure you’re editing the correct site collection before you apply a quota or lock (and change it if necessary).

To apply a quota or quota template to the selected site collection, go to the Site Quota Information section at the bottom of the page. You have the option to either select a quota template that you’ve previously created on the Quota Template page, or you can choose the Individual Quota option. The individual quota option lets you set the storage quota limits on this individual site collection (as I have for http://sp2). This is useful if the site collection requires quota settings that don’t fit with current quota templates.

On this page, you can also set a site lock on the site collection (or check its lock status).

Dd576268.note(en-us,office.12).gifNote:

“HE CAN SEE HIS SITE COLLECTION, WHY CAN’T I SEE MINE?”

When troubleshooting why a site collection cannot be accessed when others can, always check here to eliminate the chance that the site collection has gone over quota or has been manually locked.

Site locks are quick ways to prevent access to a site collection without having to go into the Site Settings for that site collection and edit everyone’s permission level. By default, site collections are unlocked. Access to the site collection, in that case, is determined by the permission level the user has in the Site Settings for that site. Other Site Lock settings are:

  • Adding Content Prevented The site collection can still be viewed, and existing content can be updated or deleted. No new content (even a new field for a list item) can be added to the site collection. This is the Lock setting that is automatically triggered when a Site Quota limit is reached.
  • Read Only The site collection can be viewed, but no editions, edits, or deletions are permitted.
  • No Access The site is completely locked and cannot even be viewed.

When you change a site lock to any of these three options (anything but Unlocked), the Additional Lock Information text box will appear on the page, shown in Figure 8.10. This box is required for any lock to be placed on a site collection. The text in this box is shown to your users when they try and access the locked site (or perform a locked action). Always enter some information explaining to your users why you’ve locked the site.

Figure 8.10 The Additional Lock Information Box
Additional Lock Information Box

Site Quota Tips

Let’s say you create a quota template for a particular type of site collection (for example, personal blogging sites for users) and set it to 300MB. Then you create a bunch of site collections using that quota. Later you decide to upgrade everyone’s disk space to 500MB, so you edit the template to reflect the change. Any new site collections created with this template will be set to 500MB. This will not, however, change the settings for any existing site collection that has already had the template applied. Those collections will stay at a 300MB limit until you manually reapply the quota to the site collections. It is possible (but not easy) to update quotas on a large number of existing site collections by using the Windows SharePoint Services 3.0 Software Development Kit (SDK).

A site collection’s quota is for everything in that site collection, including the End User Recycle Bin. Therefore, having people delete stuff won’t free up any space unless they the deleted items are also emptied from of the Recycle Bin. The second-stage Recycle Bin, which only Administrators can see, does not count toward the quota; instead it’s limited to a configurable percentage of the quota (above and beyond the collection’s quota). The exact percentage is configured at the web-application level, as discussed later in the chapter.

If you add a quota limit to a site collection that is already bigger than the quota limit allows, the site collection will immediately be locked. Therefore, if you’re not sure, check the size of an existing site collection before applying a quota.

Notes from here

The server administrator can use locks to stop sites from exceeding the storage quota limits, and to block all users from accessing a site if necessary.

A site can be locked automatically when the site exceeds the maximum storage quota. The server administrator can also lock a site manually if, for example, it is in violation of site use policies. Depending on the type of lock, the result of a locked site is different:

  • When a site is locked for exceeding a storage quota limit, users who attempt to upload new content see a disk full error.
  • When a site is locked manually, users who attempt to view the site will see an access denied message.

Site administrators can unlock sites by themselves if the sites are locked for exceeding quota limits. Only a server administrator can clear a manual lock.

 

Editing Content Database Settings

To manage content databases, go to Central Administration’s Application Management page and click Content databases. This will take you to the Manage Content Databases page, shown in Figure 8.31.

Figure 8.31 The Manage Content Database page
Manage Content Database page

On this page, you can see the content databases for a particular web application. As always, clicking on the web application’s name will let you change to a different one. Clicking on a content database’s name will let you edit its settings (see Figure 8.32).

Figure 8.32 The Manage Content Database settings
Manage Content Database settings

Database Information A content database can be in two states: Ready and Offline.

The default setting is Ready, which allows new sites to be created in the content database. Obviously, you’ll want this if you plan to add site collections to the web application and this is the only content database for that web application.

The other setting is Offline. This setting prevents any new site collections from being created in the content database. Existing site collections can still be used, including creating new subsites within that collection, but the limit has been reached and no more new ones can be added.

When a database is placed Offline and someone attempts to create a new site collection (either via Central Administration or through Self-Service Site Creation), the error message in Figure 8.33 will appear.

Figure 8.33 Database offline error
Database offline error

Database Capacity Settings To prevent a database from growing too much and getting out of hand, you can limit the number of site collections that are created in a single content database. The default number is 15,000, but it can be set to whatever you like. There is also an option to send out a notification if a certain number of site collections are reached. You obviously want this to be lower than the actual limit, and the default is 9,000.

Note that on this page, the word “site’’ is used when describing the limit and warning level. This is a misnomer; the settings apply to site collections, not to individual sites. When a database reaches the warning level, an event is generated in the log file, as shown in Figure 8.34.

Figure 8.34 Site capacity warning event
Site capacity warning event

When the database hits its capacity, it will behave in the same manner as an Offline database—no new site collections are permitted. The error message generated is different and clearly shows the issue is capacity (see Figure 8.35).

Figure 8.35 Site capacity error generated during creation
Site capacity error