• Quickly Restore a SQL Server Database




    If you frequently need to restore other peoples DB’s for testing here is a quick way to do so in Microsoft Sql Server.

    1. Open your Sql Server manager
    2. Create a new database (note the names and locations of the created files)
    3. Select the newly created DB and select Restore.
    4. Select from Device and choose the backup file to restore.
    5. Make sure you are overwriting the new database you created, usually quite apparent, look at the path.
    6. Check the log file and database name, modify where needed to the new database and log files (usually under logical name)
    7. Hopefully once set, you can restore the database, proceed hopefully, if not check the error and modify accordingly.
    8. Now you likely need to take ownership of the DB, run the following on the newly restored database to give it sa ownership:
      exec sp_changedbowner 'sa','true'

    Read the rest of this entry »

    Share
  • Rails and Microsoft Sql Server

    So you want to connect your rails application to Microsoft SQL Server. The following instructions will take you through setting this up quite simply. This setup is on a a Ubuntu 8.04 server connecting to SQL Server 2000 (we will use the Northwind sample database). The first thing you need to do is install the following gems:

    
    $ gem install dbi --version 0.4.0
    $ gem install dbd-odbc --version 0.2.4
    $ gem install rails-sqlserver-2000-2005-adapter -s https://gems.github.com
    

    More info can be found on the sqlserver adapter gem development page. This is just the first step. Read the rest of this entry »

    Share
  • Costs Using Amazon EC2 & S3

    Figuring out all the costs when hosting on EC2 using S3 storage can be tricky. This is break down of what you can approximately expect to pay using a few basic scenarios, such as a lamp server and S3 backups, with Amazon services. This will also compare the costs to what you would expect to pay if you want to do the hosting yourself.

    To fully understand EC2 charges, you need to know the difference between the instance types and what they cost to best meet your requirements. For the purpose of this post I will summarize – I have converted the Amazon Compute Units into basic CPU power and will then detail the costs based upon each of these instances.
    Read the rest of this entry »

    Share
  • Installing the Mysql Gem

    This is just a self reminder. I always seem to forget the dev package that is required to build the mysql gem. Failure to install this results in all kinds of headaches:

    sudo apt-get install libmysqlclient15-dev

    Then install the gem and you are all set:

    sudo gem install mysql




    Share
  • Shrinking a Sql Server Transaction Log

    Here is a good post that has detailed how to shrink the Microsoft SQL Server tranasaction log using DBCC Shrinkfile. Having had to do this many times, it is nice to see it detailed so simply. For perpetuity I have copied the directions below, but full credit goes to David for posting this.

    Read the rest of this entry »

    Share