Thursday, June 5, 2008

Create site collection to use different database.

By default any site you create occupies the same content database.This would create problems like content database is big to maintain and performance degradation and unorganized site collections.

Today i will show you on how to create a site collection which uses a different content database for itself.

Note: Make sure that the account you are using has full privileges on the Web front end as well on the SQL Server as it needs have permissions to create a site as well as create a Database.

Step-1: Create managed path using central admin UI

  1. Open Central Administration -> Goto Application Management Tab -> click on Define Managed Paths under Sharepoint Web Application Management section.
  2. Change the “web application” to the correct web application (usually the port 80 app).Eg. http://swaraj/
  3. Under “Add a new path”(s) type the name. eg. Sales or marketing or IT or Accounts.
  4. Select type as “Explicit Inclusion” and click OK.
  5. Step-2: Create the new Sales site collection in a new database [SWARAJ__ContentDB] i.e SWARAJ_Sales_ContentDB (Better follow a good naming convension to avoid confusion)
  6. Open a new command prompt in the Web front end box and browse to the below path where the stsadm.exe utility resides.
    c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
  7. Below is the original syntax of the stsadm command for createsiteinnewdb syntax.

Syntax
stsadm -o createsiteinnewdb
-url
-owneremail
[-ownerlogin]
[-ownername]
[-secondaryemail]
[-secondarylogin]
[-secondaryname]
[-lcid]
[-sitetemplate]
[-title]
[-description]
[-hostheaderwebapplicationurl]
[-quota]
[-databaseuser]
[-databasepassword]
[-databaseserver]
[-databasename]

Don't panic seeing the command and just include those essentials as given below

stsadm.exe -o createsiteinnewdb -url http://swaraj/sales -owneremail swaraj@example.com -ownerlogin swarajdomainname\kanna -title Sales -databasename SWARAJ_Sales_ContentDB

8. On successfull execution an "Operation completed successfully" appears.
9. Now open browser and type http://swaraj/sales and since you have not given a site template in the site creation time, here comes the prompt for it. Just choose Team site and click ok.
10. From the next step is a prompt to say ok for the default security groups like members and owners which resemble the site name. By default the site owner name is already a member of the group.