Sunday, May 17, 2009

How to move a SharePoint Content Database

Here are step by step instructions for moving your MOSS content database to a new server, followed by the things to watch out for.


You have two initial options, doing a backup and restore within MOSS to move the data, or doing it at the SQL/STSADM level. I prefer the latter, as it isn't nearly as inclined to fail and leaves you with more flexibility.

1) Find the content Database,
These are listed under Central Admin->Application Management->Site Collection List
2) Backup the content database,
You could alternatively detach it, and copy it. Just doing a backup in SQL Server Management studio is easier.

3) Restore content database to new server
Copy the BAK file to new server. Create an empty DB in Management Studio, restore from backup, you may need to change an option in the "options" tab of the restore dialog to get it to work. (Overwrite db).
4) Create Web App on new Server
Central Admin->Application Management->Create or extend Web App->Create New Web App.
5) Associate restored DB with new Web App
Central Admin->Application Management->
SharePoint Web Application Management->Content Databases->
Remove Content Database from your new web app.
Now use STSADM to add restored DB to this web app
c:\program files\common files\microsoft shared\web server extentions\12\bin on new server is where you can find the STSADM.
run this command from there.
stsadm -o addcontentdb -url http://yourwebapp:port -databasename yourcontentdb -databaseserver yoursqlserver
6) Run ISSRESET from command prompt

Important :

  • Make sure your running the same service pack level on both source and destination sharepoint if possible.
  • Make sure you install all webparts, solutions, features, etc on new server before you restore the content database, so that it can find all the features it's looking for
  • Make sure you copy any files that may be living in the file system that you need, sometimes people have css/javascript here. (This refers to files in the hive)
  • Leave your old site and contentDB intact until you get the backup running on the new server, this way your ok if there is a problem
  • DON'T try this with your config database! It won't work

6 comments:

  1. What about the same app in the same server.
    Hi,
    This is a good article about Sharepoint content DB. I'm working on a project has similar situation, but what I need is just change the content DB to a new upgraded DB and don't want to change anything on the app. So, my question is
    how can I change the content DB on the same application?

    Thanks.

    ReplyDelete
  2. Do you know a systematic way to deal with sharepoint permissions, after using your above procedure, when moving content databases between domains?

    ReplyDelete
  3. I'm having the same permission issues...

    ReplyDelete
  4. Hi Ahmed,
    i have a medium farm sharepoint portal with 2 front end and 2 backend, I am trying to restore the backup to a test environment with one backend and one front end. The test server is on the same network.
    I am using the central adim for this job and have chosen new configuration as I don’t want conflict with production server.
    I am new to this would very much Appreciate help in filling the fields as i am getting to much errors.
    New web application name:
    New database server name:
    New directory name:
    New database name:

    Thanks in advance
    Ali

    ReplyDelete
  5. tried this but the url is still down

    ReplyDelete
  6. Kentico 12 migration I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here.

    ReplyDelete

Posting is provided "AS IS" with no warranties, and confers no rights.