Friday 30 December 2011

Attach DBA Created Database to Web Application

The organization where there are tight control over databases you often come across challenge to use DBAs created databases in SharePoint Configuration. The purpose of this post is to demonstrate how pre-created blank database can be attached to SharePoint Web Application. 

The starting point is to create a blank database(ask your DBA to perform this task) or on sandbox for testing purposes you can do it yourself. When blank database is being created, make sure the Collation settings are 'Latin1_General_CI_AS_KS_WS'. Otherwise the scripts won't work. 

Log on to SharePoint front end using account that has 'Shell_Admin' rights
 
Copy and paste scripts into notepad and save it as ps1 file.  Note: "web url" is web application url that requires new content database. "pre-created db" is name of newly created db. The scripts assume new database is on default server. Use -DatabaseServer switch if database is on a different server.

Powershell reference can be found here: 

http://technet.microsoft.com/en-us/library/ff607581.aspx
 
Scripts:
Add-PSSnapIn "Microsoft.SharePoint.Powershell" 
$app = Get-SPWebApplication "web url"
Mount-SPContentDatabase -Name "pre-created db" -webapplication $app



Hope this helps !


Majid
 

No comments:

Iconise ‘Add Picture’ control in PowerApps

Default look you get for ‘Add Picture’ control is not very appealing for end user and there is no OTB way of specifying icon for this con...