Jaa


Moving SharePoint content DB files to a different location on same server

As every one of us know, when a database is created in Microsoft SQL server MDF file and LDF file will be created automatically. Generally these files will be located at c:\ (or the driver where MSSQL is installed)->Program files -> MSSQL.1 -> MSSQL -> Data.

For example: Whenever we create a Database in SQL server ‘A’, in the above mentioned data folder 2 files will be created as, A.mdf and A_log.ldf.

MDF file is the main database file to store the data in MSSQL and each MDF file will be associated with an LDF file. The LDF file contains the Transaction log by MSSQL. It is recommended to keep LDF along with MDF so that recovering of data will be easier when needed.

The situation is not different when we create databases though SharePoint commands/UI .There are circumstances where we start with a small infrastructure where very few number of web applications and later on it keeps increasing to a medium or large infrastructure. Its quite natural that the Database server may run out disc space in a later point of time.

This article will help you to move the content DB from a physical location to another on the same SQL server itself. Please make sure that we have all backups in place note that the site will not be accessible till we finish the steps.

1. Login to Central administration site and click on “Application management”

2. Click on Content databases (under SharePoint web application management)

3. Select the web application from the drop down list and click on the database name listed

4. click on Remove Content database then click OK

clip_image001

1. Login to the SQL server with Admin privilege

2. Open the SQL management studio and find out the database

3. Right click the Database and click on Task->Backup; provide the path and compete the backup

clip_image002

4. Once the backup is completed successfully right click on the database again and click on Task->Detach

clip_image003

5. Access the location of MDF file and LDF file

clip_image004

6. Move the corresponding MDF file and LDF file to a new location

clip_image005

7. Come back to SQL server management studio Right click on “Databases” and click on “Attach”

clip_image006

8. Click on Add and point the MDF file at new location

clip_image007

9. Click on OK and make sure you have the Database back in Management studio

10. Now login to SharePoint server    Run the command stsadm –o addcontentdb with appropriate attributes.

clip_image008

11. Perform an IISRESET and you can access the site.

Comments

  • Anonymous
    January 01, 2003
    SharePoint recovery software that has the capability to repair affected MDF file database and smoothly perform the task of recovering documents from SharePoint.

    Visit:- http://www.pcrecoverytools.com/sharepoint-database-recovery.html
  • Anonymous
    January 01, 2003
    You can restore your SharePoint database instantly and recover all your data from your corrupt or damaged SharePoint database by using this third party toolhttp://www.undeletepcfiles.com/sharepoint-database-recovery.html to know more about the product and download the utility.
  • Anonymous
    January 01, 2003
    Honestly that's too much work, i found easier way to move your database else where than previous and even dump massive LOG file if you don't need it. open command prompt or shell work fine in both use this commands step by step:
  1. iisreset
  2. net stop MSSQLSERVER "change (MSSQLSERVER ) it to whatever is your instance named"
  3. net start MSSQLSERVER /f /m "same thing" part 2 & 3 is for to make sure there is no leftover connection to database now you can detach and move your database anywhere you like, after you moved it and attach your database in SQL Management Studio just run this command (IISRESET) once more and wait like minute or 2 and everything works like a charm.
  • Anonymous
    January 01, 2003
    I would like to recommend SharePoint Server Recovery software is one of the best application at this time in online. With the help of this effective tool one can very readily repair their corrupt or damaged SharePoint Server all MDF database and recover its objects with Raw and Live SQL Instance mode. For more info, click here: http://www.undeletepcfiles.com/sharepoint-database-recovery.html

  • Anonymous
    June 11, 2012
    I am getting this error <databasename>  on  <SQL server> contains user-defined schema. Databases must be empty before they can be used. Delete all of the tables, stored proceture and other objects or use a different database

  • Anonymous
    September 11, 2014
    The comment has been removed

  • Anonymous
    September 12, 2014
    Restore your corrupt SharePoint databases.This utility is also supported by all versions of MS SharePoint Server and compatible with MS SQL Server.

    Try:- http://www.filesrecoverytool.com/sharepoint-database-repair.html

  • Anonymous
    July 28, 2015
    Microsoft Office SharePoint Server (MOSS) is also called as SharePoint is server software which is associated with intranet, document management and with content management. But it becomes corrupt due to several reasons and therefore use Sharepoint Recovery Tool software which can easily repair the corrupt SharePoint file.

    Available at: http://www.softmagnat.com/sharepoint-recovery.html

  • Anonymous
    November 02, 2015
    The comment has been removed

  • Anonymous
    November 02, 2015
    haha.......here's the link > http://www.idevelopment.info/cgi/SQLServer_dba_tips.cgi