Link to home
Start Free TrialLog in
Avatar of Data-Man
Data-ManFlag for United States of America

asked on

Migrate SQL Sever 2000 bak file to SQL server 2005

Hi all,
    I have been busy getting my new servers up and running and ran into a small problem.
    My current databases are in SQL Server 2000 and on servers in Virginia that I access remotely.  They are fully functional and backed up every night.
    My new database servers are in Texas and running SQL Server 2005 that I access remotely.  
    Here is the problem.  The databases are about 1G apiece and I tried scripting the entire database in SQL Server 2000 and running in the 2005 but there were some errors in some of the scripts.  
    So next I ftped the bak file from the 2000 machine to the 2005 machine.  

    I tried to restore, but I get an error as soon as I try, The backup set holds a backup of a database other than the existing database name here database.

    I also tried restore files or file groups and got the same error.  

   How can I take the bak file from 2000 and get it running under 2005?  Is there a better way to go about this?

    I already copied the logins from 2000 to 2005.  I found a white paper from Microsoft that helped migrate all the user names.

    If I create a script in 2000 for each type of database objects, that seems to work, but it iis very slow and doesn't get the data from 2000 to 2005.  Thoughts?

    I have been googling for solutions and they say to use the bak fille, but it doesn't seem to work for me.  I am at a loss and am turning to EE.

Thanks,
Mike
Avatar of mohan_sekar
mohan_sekar
Flag of United States of America image

What error do you get while trying to restore the .BAK file?
Avatar of Data-Man

ASKER

It says,

The backup set holds a backup of a database other than the existing database name here database.

Makes me think that since the bak file came from a SS 2000 database and I'm trying to restore it to SS 2005 it doesn't like it.

Mike
ASKER CERTIFIED SOLUTION
Avatar of Racim BOUDJAKDJI
Racim BOUDJAKDJI
Flag of Algeria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Running the script now....no errors and 2 minutes into it.  wooohoo!!!!!!!

Will let you know if it works.

Thanks,
Mike
Racimo,
    Worked perfectly.  I should have know to fall back to T-SQL instead of relying on the wizard.

    May I ask one other question?  I need to make some changes to the procedures to use DB_Mail, etc and when I have completed the testing of the database on the new server,  need to bring over JUST the data from the 2000 database.  Is there an easy way to do just that?

Thanks,
Mike
<< Is there an easy way to do just that?>>
What you can is the following

> Make a full backup of your work database before you start working
> Restore the above full backup on your target environment by leaving the database in NORECOVERY mode.  You do that by
running

restore database <put the new name here> from disk = '<put the complete backup file path here>'
with
move '<put the logical data file name here you did get from the previous execution>' to '<put the complete file path where you want to store the data file>',
move '<put the logical log file name here you did get from the previous execution>' to '<put the complete file path where you want to store the log file>', replace, norecovery

> Finish your modifications(data)..
> Make a differential backup of your database.  You do that by running
backup database <old name> to disk = '<complete path>' with differential
> Restore the differential on the top of the currently restored database in the target server by running
restore database <put the new name here> from disk = '<put the differential complete backup file path here>'
with
move '<put the logical data file name here you did get from the previous execution>' to '<put the complete file path where you want to store the data file>',
move '<put the logical log file name here you did get from the previous execution>' to '<put the complete, recovery  

That way you won't have to do a complete restore just the difference data between the two backups...

HTH

Racimo,
   Just so I understand this....

   1.  Take the BAK file and do what I did to restore it but this time add the 'norecovery' option.
   2.  Make the changes I need to the database (really just changes to about 50 procs)
   3.  Make a differential backup of the live 2000 database.  (right now I do a full backup every night.  If it takes me a couple of days to make the changes and test, how do I create a differential backup?)
   4.  Restore the differential backup onto the 2005 database.

   It all sounds easy enough except for step 3.

Thanks for the help,
Mike
<<1.  Take the BAK file and do what I did to restore it but this time add the 'norecovery' option.>>
Yes

<<2.  Make the changes I need to the database (really just changes to about 50 procs)>>
 Yes
 
 <<3.  Make a differential backup of the live 2000 database.  (right now I do a full backup every night.  If it takes me a couple of days to make the changes and test, >>
Make differential backup whenever you feel you reached a milestone.


<<how do I create a differential backup?)>>
As you'd do a regular backup except that you need to add WITH DIFFERENTIAL to the backup instruction.
as

backup database <name of the db> to disk='<complete file path for differential backup>' WITH DIFFERENTIAL

Note: a DIFFERENTIAL backup always refers to the last executed FULL backup.  So make sure you don't have a FULL backup running between your initial FULL backup and the *milestone* DIFFERENTIAL backup...What you can do is eventually do a FULL backup in the beginning of the week and a daily DIFFERENTIAL backup...
 
<< 4.  Restore the differential backup onto the 2005 database.>>
Yes

<<It all sounds easy enough except for step 3.>>
It really is.  Once you start using differential backups, you can't stop saying "how could I live without them until now"

Anyway good luck...
Thanks for you help.  Have a wonderful day.

Kind Regards,
Mike
<<Thanks for you help.  Have a wonderful day.>>
Glad I could help...