Migrating from SQL Server 2000 to SQL Server 2008 R2

I am using SQL Server 2000, including 77 databases, and I want to migrate them to the new SQL Server 2008 R2.

I can perform this operation individually with the attach or restore commands. Is there a script to transfer 77 databases to a new server installed on SQL Server 2008 R2.

thanks

+4
source share
3 answers

You can write a script to backup in a loop and restore to another server

So far, backup files are visible to both servers. This will allow the WITH MOVE option to allow the use of different drives / folders.

Backups smaller than MDF / LDF to reduce the number of copies

+2
source

You will need to create your own script, as you really want to do more than backup and restore. Other things you could do is run DBCC UpdateUsage, set the compatibility level, update statistics, run DBCC CheckDB using Data_Purity, change the page check parameter to a checksum. You may also have replications and full-text directories. All of these things would probably have to go into your script.

You will need to set up a script that does all / some / more of the things mentioned earlier in the database and then extends your script to iterate over all your databases. This can be done using a combination of batch files or powershell files and using sqlcmd.

For example, this is one script that I run after restoring the backups to a new server. This is called from the windows batch file via sqlcmd.

USE [master] 

GO

ALTER DATABASE [$ (DATABASENAME)] SET COMPATIBILITY_LEVEL = 100

ALTER DATABASE [$ (DATABASENAME)] SET PAGE_VERIFY CHECKSUM WITH NO_WAIT GO

Use [$ (DATABASENAME)]

Go Announcement @DBO sysname

- who is user sa

Select @DBO = name from sys.server_principals Where main_id = 1

- assign sa to database owner

exec ('sp_changedbowner' '' + @DBO + '' '') go

- fix calculations

dbcc updateusage (0) go -check the db enable column value integrity

dbcc checkdb (0) With Data_Purity, ALL_ERRORMSGS, NO_INFOMSGS go

- make sure the statistics are updated

exec sp_updatestats

Go

+2
source

You can use a software tool like Sql Compare .

Otherwise, I would script them individually.

You can run the sysobjects internal table and create a unified script, but I would not.

0
source

All Articles