English 中文(简体)
Backup and Restore from SQL Server 2005 to 2008 express edition?
原标题:

I m having a huge problem with a client.

Their infrastructure blows, and most of the development done end up with mysterious errors(which only happen in their environment).

What I m trying to do is create a separate environment (a VPS) and push the application server and the database into this new environment, so they can actually see the problem lies within their infrastructure.

I ve tried recreating the database manually, but its impossible, too much constraints, indexes etc...

How do I restore a database backup(SQL Serve 2005) into a SQL Server 2008 Express edition (my test environment)?

I used this command to generate the backup...

BACKUP DATABASE [databasename] TO  
    DISK =  c:database_backup_20091228_1500.bak  
    WITH NOFORMAT, NOINIT,  NAME = N Database-Full Backup , 
    SKIP, NOREWIND, NOUNLOAD,  STATS = 10

Which seems to be working (just ran it, server is generating the file)..

Now into my Sql Server 2008 express edition, how do I restore it?

Is it possible?

Any alternatives?

Thx!

问题回答

try this code

 RESTORE DATABASE [databasename]
       FROM DISK =  c:database_backup_20091228_1500.bak 
       WITH NOFORMAT, NOINIT;

You can restore a SQL Server 2005 database to SQL Server 2008 Express edition provided your database is no greater than 4GB in size.

The RESTORE operation iscapable of upgrading the database on the fly from the 2005 format to 2008 one. When you create a new database by means of restore you usually need to options added:

  • REPLACE is needed to disable a normal check that occurs during RESTORE and which prevents you from replacing a database with the content of another database from a backup set. For details see Using the REPLACE Option.
  • MOVE is needed to move logical files in the backup set to new locations. The RESTORE operation will attempt to create the same locations for the MDF, LDF and all NDF files in the database, and this may not work on your particular drive structure. For details see Copying Databases with Backup and Restore.

If your client is using any feature that does not work in Express then you re going to have to upgrade to an edition that supports the features you need. The best option by far is to buy a Developer edition license, that costs around $50 only and gives you all. fully functional. Enterprise features at the restriction that it can only be used for development purposes (which you are).

step1: Backup your database:

query:

BACKUP DATABASE [databasename] TO 
DISK =  c:database_backup_20091228_1500.bak  WITH NOFORMAT, NOINIT, NAME = N Database-Full Backup , SKIP, NOREWIND, NOUNLOAD, STATS = 10

step2: Restore your database:

How to Restore:

  • step1: Open SQL Server Management Studio Express
  • step2: Then Right click the database
  • step3: And select Restore Databse
  • step4: Then select the source for restore
  • step5: Select from device and Browse
  • step6: Add to select the database .bak files
  • step7: Then Give database name and tick to the database
  • step8: That s is the databse will be restored




相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签