Tuesday, March 3, 2009

Sharepoint - Backing up and Restoring your site

Back up a Web site

Backing up a Web site creates a content migration package, or .cmp file. When you back up a Web site, you can choose to back up either the top-level Web site or the top-level Web site and any subsites. The backup file that you create includes list or library content, security settings, user information, navigation, customizations, and personalizations (such as views, site templates, and content types). The backup file does not include workflows, alerts, and properties stored at the site collection level.

To back up a site, you must have administrator permissions for that site, but you do not require administrative access to the server that is running Windows SharePoint Services 3.0.

  1. On the File menu, click Open Site.
  2. In the Open Site dialog box, browse to and click the Web site that you want to back up, and then click Open.
  3. On the Site menu, point to Administration, and then click Backup Web Site.
  4. In the Backup Web Site dialog box, to include all subsites of the current Web site in the backup, select the Include subsites in archive check box.
  5. If the current Web site is low on available storage space, click Advanced, enter a new location, and then click OK.

    Backing up a Web site requires a location to store temporary backup files. By default, Office SharePoint Designer 2007 uses the current Web site. You can use another site on the same server or a location on another server on the same network — for example, \\Server name\Share name.

  6. In the Backup Web Site dialog box, click OK.
  7. In the File Save dialog box, select the location where you want to store the .cmp file.
  8. In the File name box, type the name for the file, and then click Save.

    If the site that you are backing up or restoring is large, the process can take quite a while.

Tip To determine if there were errors during the backup process, you can check the .log file. The .log file is stored in the Temp folder for your user account. If a log file already exists from a previous backup or restore, a new log file is created with a different file name — for example, smigrate_1.log, smigrate_2.log, and so on. Search the log entries for the following error messages: cannot, could not, failure, server error, timed out, unable to, and the server sent a response.


Restore a Web site

Step 1: Create a new empty Web site as a destination

  1. On the File menu, click New.
  2. In the New dialog box, click the Web Site tab, click General, and then click Empty Web Site.
  3. In the Specify the location of the new Web site box, enter the location where you want to restore the backup site.

    You can restore the site to a different server, and you can restore it as either a new top-level site or a subsite under an existing top-level site.

  4. Click OK.

Tip You can also create an empty Web site through the browser by using the Site Settings or Create pages. For example, when viewing the site in the browser, click Site Actions, and then click Create. On the Create page, under Web Pages, click Sites and Workspaces. Complete the first four sections, but when you get to the Template Selection section, close the browser without making a selection. Do not apply any template — including the Blank Site template — or the restore operation will fail.


Step 2: Restore the backup file to the destination

  1. With the destination site open, on the Site menu, point to Administration, and then click Restore Web Site.
  2. In the File Open dialog box, browse to and click the .cmp file that you want to restore, and then click Open.
  3. If the current Web site is low on available storage space, click Advanced, and then do any of the following:
    • To store the archive files in another temporary location, enter a new location in the Temporary location for archive files box.

      Backing up a Web site requires a location to store temporary backup files. By default, Office SharePoint Designer 2007 uses the current Web site. You can use another site on the same server or a location on another server on the same network — for example, \\Server name\Share name.

    • To store the .log file in another location, enter a new location in the Location for import log file box.

      You might need to choose another location for the .log file if the server cannot write to the default location. By default, Office SharePoint Designer 2007 creates an import .log file in the current Web site. You can check this file to determine if there were errors during the restore process.

  4. In the Restore Web Site dialog box, click OK to confirm that you want to restore the .cmp file to the current empty Web site.

    If the site that you are backing up or restoring is large, the process can take quite a while.

SharePoint 2007. sharepoint change site collection content database

In SharePoint 2007 when you create an application you specify the name the database to use. Most people, therefore, conclude that an application will use one database. This is not necessarily a very scalable idea. But then you will often hear that an application can have more than one database. The more commonly heard statement is that a Site Collection can have its own database.

True, very true. Each site collection under an application can be made to have its own database. But how? When you create a site collection you are never asked which database to use or if a new database needs to be created.

Well our friends at Microsoft have made this in a very confusing process. But here goes:

* Let's start with creating a new application. When we create the application we tell it to use the following database: WSS_CONTENT_1
* Now create a site collection (SC1) under this application and a few sites under the site collection. All the sites will use the WSS_CONTENT_1 database.
* Now go to Central Administration, Applications, Content Databases. Select WSS_CONTENT_1 and change its status to "Offline".
* Now under Central Administration, Applications, Content Databases create a new content database WSS_CONTENT_2. Make sure its status is "Ready".
* Now create a new site collection SC2 and create a few sites for SC2. They will use WSS_CONTENT_2.
* Now create yet another site under SC1. It will use WSS_CONTENT_1. This is despite the fact that WSS_CONTENT_1 is "Offline."

So what we have achieved through this roundabout way is a content database for each of our site collections SC1 and SC2. It would have been a lot better if when creating a site collection in Central Admin one was asked if a new database is to be created or if one wants to use an existing database.

In the Central Administration, Application Management, Content Database module setting a database offline means that from this point on no new site collection will be created in this database. However this database is still usable and new sub-sites under an existing site collection can be created. One has to be very careful to take each content database offline once a site collection has been created to prevent any other site collection from being created to use it. This way you can make sure that each site collection has its own database.

BTW, the same can be achieved via an stsadm command:

stsadm -o createsiteinnewdb -url http://your.application.com/SiteCollection -owneremail owner@application.com -ownerlogin Application\Owner -sitetemplate sts -title “Title” -databaseserver servername -databasename WSS_Content_Somename

Why would you want a site collection to have its own database? Well that depends on what you are building and is a subject that is best handled in another post.