SQL Server: Importing data from FogBugz On Demand or trial into SQL Server - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com2013-05-27T02:53:51Zhttp://fogbugz.stackexchange.com/feeds/question/230http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://fogbugz.stackexchange.com/questions/230/sql-server-importing-data-from-fogbugz-on-demand-or-trial-into-sql-serverSQL Server: Importing data from FogBugz On Demand or trial into SQL ServerFogBugz KB2009-10-13T21:24:26Z2013-04-16T19:09:30Z
<p>How do I import data from my Fogbugz On Demand trial to SQL Server 2005 and 2008?</p>
<p><strong>NB</strong>: FogBugz 7 does run on SQL Server 2000, but with limited functionality. We recommend 2005 or above.</p>
http://fogbugz.stackexchange.com/questions/230/sql-server-importing-data-from-fogbugz-on-demand-or-trial-into-sql-server/231#231Answer by FogBugz KB for SQL Server: Importing data from FogBugz On Demand or trial into SQL ServerFogBugz KB2009-10-13T21:27:35Z2013-04-16T19:09:30Z<p><strong>Step 1</strong></p>
<p>Run FogBugz Setup. Choose SQL Server as the database option.
When Setup has finished, it launches a web page and
asks you to install licenses. Don't install the licenses yet - it's okay if you already did, but you just don't need to. Just minimize this browser, we'll come back to it later. </p>
<p> <img src="http://www.fogcreek.com/FogBugz/kb/dbsetup/images/1.gif" /></p>
<p><strong>Don't install licenses yet! (it's ok if you already did)</strong></p>
<p><strong>Step 2</strong></p>
<p>In another browser window, log into your FogBugz On Demand account as a Site Administrator. Click Admin at the top right, then "Your On Demand Account", and click the download link for "SQL Server 2005". FogBugz will warn you that during the database copy, the site will be down. Make sure nobody needs to use FogBugz and then click "Begin Copy"</p>
<p><em>The download may take many hours if you have a large database. If it takes too long or fails, please <a href="http://www.fogcreek.com/contact.html" rel="nofollow">contact us</a> for other options.</em></p>
<p>After the copy is complete, click the Download button that appears to download your MDF data file (it will be named something like fogbugz72040459_copy.MDF), and save it to the folder that MS SQL Server likes to keep data files, which is normally:</p>
<p><p><pre>C:\Program Files\Microsoft SQL Server\MSSQL\Data</pre><p></p></p>
<p><em>Make sure this
file is not read-only and that the user SQL Server runs as has full control for it and the directory it is in.</em></p>
<p>At this point, your FogBugz On Demand account is still locked for the download. On the page you downloaded from, either enter a URL for a new site to link to, or click the link next to "Go back" to reactivate the site if you need to keep using it.</p>
<p><strong>Step 3</strong></p>
<p>Run SQL Server Management Studio and connect to your database server. Drill down to the empty database named
<strong>FogBugz</strong> that was created by Setup. Select it and
press the <strong>Delete</strong> key to delete it.</p>
<p> <img src="http://our.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=78717&sFileName=deletedb.png" alt="" /></p>
<p><strong>Step 4</strong></p>
<p>Right click the <strong>Databases</strong> item and choose
<strong>Attach...</strong></p>
<p> <img src="http://our.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=78718&sFileName=attach.png" alt="" /></p>
<p>
In the dialog which appears, click the
<strong>"Add..."</strong> button and select the MDF file you just
downloaded. The dialog will now look like this. Click the second entry in the bottom pane, which has File Type "Log" and click the Remove button:</p>
<p> <img src="http://our.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=78720&sFileName=attach2.png" alt="" /></p>
<p>If the Data row has an incorrect path for "Current File Path", change it to the path of the mdf where you just moved it.</p>
<p>In the top pane, click on the Owner field, then click again to bring up the menu. Select the same user you told setup to run FogBugz as. If you told Setup to use Windows/Mixed Mode authentication to connect to the database, this user is the same one you see for Anonymous Authentication in the FogBugz virtual directory. If you told Setup to connect to the database using a SQL Server login (name and password), then specify that login here. Click <strong>OK</strong>. </p>
<p> <img src="http://our.fogbugz.com/default.asp?pg=pgDownload&pgType=pgWikiAttachment&ixAttachment=78719&sFileName=attach3.png" alt="" /></p>
<p><strong>Step 5</strong></p>
<p>Bring up FogBugz in your web browser and refresh the page. If at this point you get an error message, please re-read the above steps and verify that you didn't do something ever so slightly differently.</p>
<ol>
<li>Install your licenses</li>
<li>Set your options in Admin -> Site Configuration
<ul>
<li>The FogBugz Maintenance URL</li>
<li>Notification URL</li>
<li>Your outgoing SMTP server information</li>
</ul></li>
</ol>
<p>Users will lot in with the same credentials from your hosted account. Presto magicko, you should see all the data you created on our server like so many eggs in a basket!</p>
<p><strong>Step 6</strong></p>
<p>Remove the On Demand only cases@ mailbox:</p>
<pre><code>DELETE FROM Mailbox WHERE sEmail like 'cases@%.fogbugz.com';
</code></pre>
<p><strong>Step 7</strong></p>
<p>Re-install your plugins per <a href="http://fogbugz.stackexchange.com/questions/1121/my-plugins-are-broken-after-importing-my-on-demand-database-locally" rel="nofollow">this question</a>.</p>