Here’s how to go about migrating your FogBugz database from one Microsoft SQL Server instance to another (see this post for moving the FogBugz site).

Restore the New Database

Whatever the source of your database, the easiest way to get it to the new location is to make an MS SQL database backup and then restore that backup to the new location.

Ensure Correct Database Configuration

In order for FogBugz to access this new database, we must make sure that it has the appropriate permissions. At the the server level, navigate to Security -> Logins and look for the user that fogbugz will use to authenticate (this is usually the user that the IIS Application Pool is running as):

 

ssms_logins

If you see the user then right click on it and choose Properties and skip the rest of this paragraph. If you don’t see the user then right click on Logins, choose “New Login…”, define the user’s login name (assuming you are using SQL Auth, then it will be either “HOST/username” or “DOMAIN/username”).

Now, on the properties window, go to User Mapping. Check the box to map the FogBugz user to the FogBugz database and then check the “db_owner” box for the role membership:

2

If you move from SQL 2005 to SQL 2008, you will want to change the compatibility mode for the database so it runs natively as SQL 2008 if you have installed or will install Kiln.

Tell FogBugz Where To Find the New Database

When you move your database, you need to tell FogBugz where it is by updating the sConnectionString key in the Windows Registry:

HKEY_LOCAL_MACHINESOFTWARE\Fog Creek Software\FogBugz\[your FogBugz install directory]

or if you are running FogBugz in 32-bit mode on a 64-bit machine:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Fog Creek Software\FogBugz\[your FogBugz install directory]

The sConnectionString key will have a value like this, you will just need to change the Server and the Initial Catalog to refer to your new database location:

Server=SQL_SERVER;Initial Catalog=fogbugz;Integrated Security=SSPI;MultipleActiveResultSets=true;

Test it Out!

Now you should be able to load FogBugz again in your browser! Just drop us a line if you run into any trouble.