Tuesday, 15 June 2010

Moving a site collection to a new database

Problem: IT department created my development machine using a base image with a 20GB C:\ drive. The company insists I use SQL Server 2010 express for development. I installed SQL Express onto the C:\ drive. The databases are all stored on the same c drive along with the Windows footprint of 13GB. Very quickly I ran out of space.
Initial Hypothesis: When creating content databases thru Central Administration (CA), SharePoint will use the SQL default file location for *.mdf and *.ldf files. Therefore I need to change the location where the data and log files will be setup thru the UI.
I have a large D:\ drive so I should move the data and log files to the D:\ drive. I need to:
  • Change the default location of the files to the D:\ drive for data\log files;
  • Create a new content database to host the existing site collections; and
  • Move the existing data (site collections) to the newly created content database.
The base image is causing issues, this couple with me putting the default location on my C drive and the inability of this environment to resize virtual machine drives I had had to use the resolution below.

1.> Change the default location using T-SQL (I'm sure there is a better solution using Power Shell for Windows using SMO);
SQL Server Management Studio

2.> Open Power Shell (PS) for SharePoint

PS> Move-SPSite -Identity http://mysharepointsite.com.au/sites/user -destinationdatabase WSS-Content-NewUserDB

Your should work, I will solve the SQL permissions issue in my next post.

More Info:
SQL default location info

Moving site collections using PowerShell or move the entire Content DB


Post a Comment