Monday, August 24, 2009

Finding a SharePoint Database GUID / Restoration Tips

I needed to run the stsadm command preparetomove with the oldcontentdb switch (at least I thought I did) for a database that I wanted to restore in our testing environment. Running this command is supposed to fix sync issues when moving databases around.

Although there probably is a more efficient way to query the database (maybe a config database?) to get the database GUID, there is an ID parameter on some URL's. So I added the content database in Central Admin. After that you can take the ID from the URL for that database like so:

http://qapt03ms:8800/_admin/oldcntdb.aspx?DatabaseId=%7BF6FD3F98%2D1044%2D4728%2D8C6D%2D2A22140FFC13%7D
    %7BF6FD3F98%2D1044%2D4728%2D8C6D%2D2A22140FFC13%7D
      F6FD3F98 - 1044 - 4728 - 8C6D - 2A22140FFC13

      Then you can run the command:

      C:\>stsadm -o preparetomove -contentdb servername:databasename -oldcontentdb F6FD3F98-1044-4728-8C6D-2A22140FFC13

      Operation completed successfully.

      You can see that a couple characters get stripped from the beginning and end (%7B and %7D) and the "%2D" are the dashes.

      I've done restores without cleaning it up this way but I figured it's time to start doing it the right way.

      No comments:

      Post a Comment