Sunday, February 13, 2011

Easiest way to copy an entire SQL server Database from a server to local SQL Express

I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?

EDIT: I have very limited access to my server so I don't think I can access the backup file that I could create so that is out.

  • Back up the database on the server and then restore it locally in SQL Express.

    EDIT: If this is part of your work, surely you can get someone in networks to get you a backup..?

    Collin Estes : Not an option I don't think, because I can't get to the backup file created on the server.
    From Galwegian
  • If you can login to both servers (the Express and the 05 Server) using SQL Server Management Studio then you can do a DB Restore from one database to the other. No need for backup files at all.

    FreshCode : how do you do a restore a database from one server to the other without a backup inbetween? (SQL Server 2008).
    Stephen Wrighton : In instances where neither server is SQL Express, you use sp_detach_db and sp_attach_db or the Import/Export Data Wizard -- http://support.microsoft.com/kb/314546
  • You can use SSIS's database copy wizard, but it's not quick at all. Is there a DBA there that you can ask for the backup file? That will probably turn out to be the fastest way.

  • Depending which versions of SQL Server you are using, you might get some mileage out of the SQL Server Database Publishing Wizard from Microsoft. I've had mixed results with this tool in complex environments, but for most simple database scenarios it is a great tool.

    An example of a scenario where I ran into difficulties was a DB with multiple distinct schemas, each with their own owner and extreme separation between the tables (don't ask...). As I said, though, most other scenarios have been fine.

  • If the database is not too big, you could use the Database Publishing Wizard.

    This is a free tool from Microsoft which creates a complete SQL script of a database for you (not only the tables and stuff, but all data as well).

    You can install the tool on your machine, connect to a remote server and let the tool create the script directly on your machine.

    You can download the Database Publishing Wizard here.

    Mitchel Sellers : NOTE: I have had very bas experience with this....as it has "issues" at times with data relationships.
    Druid : Works great for medium complexity/sized databases! Just wish there was an easier way for the huge, complex ones.
    From haarrrgh
  • Save your database as a sql script

    EMS SQL Manager (for example) allows you to backup your database as a script in a .sql file. It is then possible to run this file against any other SQL server. Just update the first line of the script (CREATE DATABASE ....).

    You can even fully parameter the script in order to include data from complete or filtered tables.

0 comments:

Post a Comment