Syed Muhammad Yasir
Syed Muhammad Yasir

Reputation: 105

How to restore sql 2000 database backup in sql 2005?

I am trying to restore backup of a database which was created in SQL 2000 in SQL 2005 and getting this error

Index was outside the bounds of the array.(Microsoft.SqlServer.Express.Smo)

How can I restore ?

Upvotes: 0

Views: 1015

Answers (1)

Dan Guzman
Dan Guzman

Reputation: 46415

Try executing a T-SQL RESTORE command. This can be scripted from the SSMS Restore Database dialog or you can use the script examples below.

To restore a database to the same file locations as the original database files, run this command from an SSMS query window, substituting you backup file path:

RESTORE DATABASE YourDatabaseName
FROM DISK='C:\Backups\YourDatabaseName.bak'
WITH STATS = 10;

If the file locations on the target server differ, specify the MOVE option with the logical file names and new file paths:

RESTORE DATABASE YourDatabaseName
FROM DISK='C:\Backups\YourDatabaseName.bak'
WITH
      MOVE 'YourDatabaseName' TO 'D:\DataFiles\YourDatabaseName.mdf'
    , MOVE 'YourDatabaseName_Log' TO 'L:\DataFiles\YourDatabaseName_Log.ldf'
    , STATS = 10;

The logical file names needed for the above command can be obtained using RESTORE FILELISTONLY:

RESTORE FILELISTONLY
FROM DISK='C:\Backups\YourDatabaseName.bak';

Be sure to update stats for all tables after the restore. This can be done with sp_updatestats:

EXEC sp_updatestats;

Upvotes: 1

Related Questions