Solved

Migrate SQL Sever 2000 bak file to SQL server 2005

Posted on 2009-06-29
11
575 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:Data-Man
  • 5
  • 4
  • 2
11 Comments
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24737322
What error do you get while trying to restore the .BAK file?
0
 
LVL 15

Expert Comment

by:mohan_sekar
ID: 24737337
0
 
LVL 18

Author Comment

by:Data-Man
ID: 24737346
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
0
 
LVL 23

Accepted Solution

by:
Racim BOUDJAKDJI earned 250 total points
ID: 24737356
<<  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.  >>
There are usually no issues restoring a SQL2000 backup on q SQL2005 engine.
Looks like you simply need to restore with a different name and different location.

Simply run this in command line

restore filelistonly from disk = '<put the complete backup  file path here>'

this will return the logical file names of the source database ...Note the logical file names and their complete pathes..Once you are done, simply run

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

That should do the trick...

HTH
0
 
LVL 18

Author Comment

by:Data-Man
ID: 24737458
Running the script now....no errors and 2 minutes into it.  wooohoo!!!!!!!

Will let you know if it works.

Thanks,
Mike
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 18

Author Comment

by:Data-Man
ID: 24737489
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
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 24737577
<< 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

0
 
LVL 18

Author Comment

by:Data-Man
ID: 24737647
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
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 24737780
<<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...
0
 
LVL 18

Author Comment

by:Data-Man
ID: 24737816
Thanks for you help.  Have a wonderful day.

Kind Regards,
Mike
0
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 24737924
<<Thanks for you help.  Have a wonderful day.>>
Glad I could help...
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now