Upgrade SQL Server

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

| Technical document

>> SQL Server DBMS Upgrade eds.com

Upgrading Instances and Databases to SQL


Server 2005
Version 1.0

EDS INTERNAL DOCUMENT


Table of Content

1 Document Control............................................................................................................3

1.1 Distribution List...............................................................................................3

1.2 Amendment Record........................................................................................3

1.3 References.....................................................................................................3

2 Introduction.......................................................................................................................3

3 Summary............................................................................................................................4

4 Relationship to Other Documents....................................................................................4

5 Pre-Upgrade for Instance Upgrade..................................................................................4

5.1 Pre-upgrade steps..........................................................................................4

5.1.1 Backup System and User databases..................................................4

5.1.2 Run DBCC commands........................................................................4

5.1.3 Disk Space...........................................................................................4

5.1.4 System Databases...............................................................................5

5.1.5 Startup procedures..............................................................................5

5.1.6 Replication...........................................................................................5

5.1.7 Associated Applications.......................................................................5

6 Upgrade Database Engine.................................................................................................6

Page 1 of 1613
EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


7 Post-Upgrade......................................................................................................................7

8 Migrating Databases to SQL 2005...................................................................................8

8.1 Copy database Wizard...................................................................................8

8.2 Detach and Attach Database.........................................................................9

8.3 Backup and Restore Database....................................................................10

8.3.1 Moving Database Files......................................................................10

8.3.2 Change the Database Name.............................................................11

8.3.3 Database Ownership.........................................................................11

8.4 Post Database Upgrade Tasks....................................................................11

9 Appendices.......................................................................................................................12

9.1 Appendix A: DTS Packages and Integration Services.................................12

9.2 Appendix B: SQL Server Management Studio............................................12

Page 2 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


Document Control

1.1 Distribution List

Name Role Representing

Rodolfo Vargas SQL Server DBA DAT

David Kreidler SQL Server DBA DAT

1.2 Amendment Record

Version Date Status Comment

1.0 10/26/2005 Draft

1.1 7/28/2006 Final – added NNAM standard

Contact Production Engineering Software Services, Database Architecture Team, Technology


Planning Initiative with questions and change requests.

1.3 References
Online SQL Server Support home page

http://www.microsoft.com/sql/default.mspx

SQL 2005 documentation can be found at:

http://www.microsoft.com/sql/2005/default.mspx

SQL 2005 TechNet page:

http://www.microsoft.com/technet/prodtechnol/sql/default.mspx

2 Introduction
This document is written for the experienced SQL Server DBA. It is assumed that the DBA
knows T-SQL, Enterprise Manager, SQL Server 2005 Management Studio, and general SQL
Server database administration. This is not a Step-by-Step document for a novice DBA.

Page 3 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


The SQL Server DBA should review the more detailed documentation before using this
upgrade guideline.

This guide contains two components: Upgrading an existing instance of SQL Server to SQL
Server 2005 and migrating databases to SQL 2005. To read only about migrating
databases, skip to Section 8.

A direct upgrade to SQL Server 2005 is supported for SQL Server 7.0 SP4 and SQL Server
2000 SP3a. There is no direct instance upgrade from SQL Server 6.5 to 2005. The DBA
must first upgrade the 6.5 instance to 7.0 SP4, then to SQL Server 2005.

After an upgrade, SQL Server 2005 automatically sets the database compatibility level to
the level of the previous version of SQL Server. Therefore, if you upgrade from SQL Server
7.0 through SQL Server 2000 and then to SQL Server 2005, the compatibility level will be
set to SQL Server 2000.

3 Summary
This document provides a general checklist for upgrading SQL Server 7.0 or SQL Server
2000 instance to SQL Server 2005. It does not replace the SQL Server 2005 installation and
configuration documentation. It is a subset of information that can be used as a general
checklist. The information in this document is derived from the more detailed SQL Server
upgrade documents. It has been tested several times to ensure accuracy of the upgrade
instructions.

4 Relationship to Other Documents

5 Pre-Upgrade for Instance Upgrade


The actions in this section should be performed before initiating the instance upgrade.
5.1 Pre-upgrade steps
The following steps are designed to ensure to a successful migration of the database engine.
Failure to complete all of these steps may impact the ability to upgrade to SQL Server 2005.
Before beginning these steps, be sure to compare your hardware and software to the
requirements detailed here:

http://msdn2.microsoft.com/en-us/library/ms143506

5.1.1 Backup System and User databases


Either through Maintenance Plans or T-SQL, backup all databases on the instance being
upgraded.

5.1.2 Run DBCC commands


To ensure database consistency before upgrading, run DBCC CHECKDB on each database.

Page 4 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


5.1.3 Disk Space
Ensure there is enough disk space on both the System partition and database data and log
partitions.

Disk space
Feature
requirement

Database Engine and data files, Replication, and Full-Text Search 150 MB

Analysis Services and data files 35 KB

Reporting Services and Report Manager 40 MB

Notification Services engine components, client components, and rules


5 MB
components

Integration Services 9 MB

Client Components 12 MB

Management Tools 70 MB

Development Tools 20 MB

SQL Server Books Online and SQL Server Mobile Books Online 15 MB

Samples and sample databases 390 MB

5.1.4 System Databases


Set system databases to Autogrow and ensure there is adequate disk space for their growth.
This includes master, msdb, model, and tempdb.

5.1.5 Startup procedures


Disable all stored procedures marked for startup. Since SQL Server services will be stopped
and started during the upgrade, these procedures may block the upgrade.

5.1.6 Replication
Stop any Replication and clear out the replication log.

Page 5 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


5.1.7 Associated Applications
Quit all applications on the system, including services with SQL Server dependencies. This
includes CA Unicenter. Application connections may prevent the instance from being
upgraded.

6 Upgrade Database Engine


This section assumes that you have completed all the pre-upgrade steps in the previous
section. Once the CD/DVD is inserted, the Autorun should begin. If not, double-click on the
setup.exe file on the root of the installation CD/DVD. Once initiated, the following steps
apply:

1. On the SQL Server Component Update page, Setup installs software required for
SQL Server 2005. For more information about component requirements, click the
Help button at the bottom of the page. To begin the component update process,
click Install. To continue after the update completes, click Finish.

2. On the System Configuration Check (SCC) page, the installation computer is


scanned for conditions that may block Setup. To interrupt the scan, click Stop. To
display a list of check items grouped by result, click Filter and then select a category
from the drop-down list. To view a report of SCC results, click Report and then
select an option from the drop-down list. Options include viewing the report, saving
the report to a file, copying the report to the Clipboard, and sending the report as e-
mail. To proceed with Setup after the SCC scan completes, click Continue.

3. On the Components to Install page, select the components for your installation. A
description for each component group appears in the Components to be Installed
pane when you select it. You can select any combination of check boxes. When you
select SQL Server or Analysis Services, if Setup detects that you are installing to a
virtual server, the Install as a Failover Cluster check box is enabled. You must
select this option to install a failover cluster.

To install individual components, click Advanced. Otherwise, click Next to continue.

4. If you clicked Advanced on the previous page, the Feature Selection page is
displayed. On the Feature Selection page, select the program features to install
using the drop-down boxes. To install components to a custom directory, select the
feature and then click Browse. To continue, click Next when your feature selections
are complete.

5. On the Instance Name page, select a default or named instance to upgrade. If a


default or named instance is already installed, and you select an existing instance
for your installation, Setup upgrades it and provides the option to install additional
components. To upgrade a SQL Server default instance already installed on your
computer, click Default Instance, and then click Next to continue.

Page 6 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


Try to follow EDS NNAM standards if creating a named instance, such as
USPLSAPP001, comprising of Country Code, City Code, Device Type, Application
Name, and Server Number. NNAM can be found here:

http://www.nnam.eds.com/

6. To upgrade a SQL Server named instance already installed on your computer, click
Named Instance and then type the instance name in the space provided, or click
Installed Instances on the Instance Name page, select an instance from the
Installed Instances list and click OK to populate the instance name field. After you
have selected the instance to upgrade, click Next to continue.

7. To upgrade a default instance, there must be a default instance already on the


computer. To upgrade a named instance, there must be a named instance already
on the computer.

8. On the Existing Components page, Setup lists the SQL Server components
installed on your computer. Components that can be upgraded to SQL Server 2005
have their check boxes enabled. If a component has a check box that is unavailable,
the component does not qualify for upgrade to SQL Server 2005. To view a report of
available options and alternatives, click Details. To upgrade a component listed on
the Existing Components page, select its check box and click Next.

9. If you are adding new components, on the Service Account page, specify the user
name, password, and domain name for the non-SQL Server accounts. For this
release, SQL Server 2005 Setup uses the service account information of the existing
SQL Server service being upgraded. You can use the same account for all of the
services.

10. You can optionally specify an individual account for each service. Select the
Customize for each service account check box, select a service name from the list
box, and then provide login credentials for each of the services in the list. To
proceed, click Next.

The domain name cannot be a full Domain Name Service (DNS) name. For example,
if your DNS name is my-domain-name.com, enter "my-domain-name" in the Domain
text box. SQL Server Setup does not accept "my-domain-name.com" in the Domain
text box.

11. The Upgrade Logon Information page is displayed if the SQL Server instance to
be upgraded is configured to use Mixed Mode (Windows Authentication or SQL
Server Authentication). Credentials supplied on this page are used to connect to the
existing SQL Server instance so that upgrade scripts can be run. If the existing SQL
Server instance is configured to use Windows Authentication, this page is not
displayed. To proceed, click Next.

When possible, use Windows Authentication.

Page 7 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


For this release, SQL Server Setup may not enforce the strong password
requirement on some default configurations of Microsoft Windows Server 2003
where the computer is not a member of a domain. Setting strong passwords is
essential to the security of your system. Always use strong passwords.

12. On the Ready to Install page, review the summary of features and components for
your SQL Server installation. For an upgrade scenario, all components and features
of the existing instance are selected for the upgrade. To proceed, click Install.

13. On the Completing the Microsoft SQL Server Installation Wizard page, you
can view the Setup summary log by clicking the link provided on this page. To exit
the SQL Server Installation Wizard, click Finish.

14. If you are instructed to restart the computer, do so now. It is important to read the
message from the Setup program when you are done with installation. Failure to
restart the computer may cause failures when you run the Setup program in the
future.

7 Post-Upgrade
After upgrading the Database Engine to SQL Server 2005, complete the following tasks:

 Register your servers – Upgrade removes registry settings for the previous SQL
Server instance. After upgrading, you must reregister your servers.

 Repopulate full-text catalogs – The upgrade process marks your databases as


full-text disabled. Catalogs must be repopulated, but this operation is not run
automatically by Setup because it can be time-consuming. As this operation
enhances the performance of your SQL Server 2005 installation, administrators
should plan to repopulate full-text catalogs at a convenient time.

 Update statistics - To help optimize query performance, we recommend that you


update statistics on all databases following upgrade. Use the sp_updatestats
stored procedure to update statistics in user-defined tables in SQL Server 2005
databases.

 Update usage counters - In earlier versions of SQL Server, the values for the
table and index row counts and page counts can become incorrect. To correct any
invalid row or page counts, we recommend that you run DBCC UPDATEUSAGE on all
databases following upgrade.

 Configure your new SQL Server installation - To reduce the attackable surface
area of a system, SQL Server 2005 selectively installs and activates key services
and features. For more information on how to activate SQL Server 2005 features,
see SQL Server Surface Area Configuration.

Also, be sure to apply the latest Service Pack and Hotfixes for SQL Server 2005
Components. Those can be found here:

Page 8 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


SP1: http://support.microsoft.com/kb/913089

Hofixes: http://support.microsoft.com/kb/918222/

Lastly, be sure to change the Autogrowth setting on the ‘model’ database. By default, in
SQL Server 2005, it is set to 1MB. Change it to a more appropriate value, such as 500MB.

8 Migrating Databases to SQL 2005


If the DBA simply wants to migrate pre-SQL Server 2005 database to a new SQL Server
2005 instance, there are three main methods:

 Copy Database Wizard

 Detach/Attach database

 Backup/Restore database

It must be noted that these upgrade paths are available for SQL Server 7.0 SP4 and SQL
Server 2000 SP3a databases only. Your source databases must be upgraded to either of
these versions before moving to SQL Server 2005. For instance, SQL Server 6.5 database
can be upgraded to SQL Server 7.0 SP4 in order to be moved to SQL Server 2005.

If a database that was created by using SQL Server 6.5 or earlier has not been upgraded to
SQL Server 2005, you can convert it to SQL Server 2005 by using one of the following
methods. Remember, the schema must exist in the SQL 2005 database in order to directly
import data. Also, remember Referential Integrity when considering your order of copying
objects:

 Use the Integration Services (SSIS) Import and Export Wizard to copy data between
multiple instances of SQL Server.

 Migrate data from a SQL Server 6.0 or SQL Server 6.5 database by using bcp out to
export the data into a data file in character mode Then, use bcp in with the -V
option to import the data into a SQL Server 2005 database.

8.1 Copy database Wizard

This topic describes how to use the Copy Database Wizard to upgrade a SQL Server 2000
database to a SQL Server 2005 database.

When using the Copy Database Wizard to upgrade a database, there are three
requirements. Firstly, before upgrading, place the database in single user mode, and make
sure that no applications or services are trying to access the database. Secondly, do not use

Page 9 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


read-only mode, as this will result in an error. Lastly, you cannot rename the database
during this operation.

Connect to any instance of SQL Server Database Engine using Object Explorer in SQL Server
Management Studio.

Expand Databases, right-click a database, point to Tasks, and then click Copy Database.

Complete the steps in the wizard.

8.2 Detach and Attach Database

In SQL Server 2005, you can use detach and attach to upgrade a user database from SQL
Server version 7.0 or SQL Server 2000. However, some restrictions apply:

1. Backups of the master, model or msdb database created using SQL Server 7.0 or
2000 cannot be attached in SQL Server 2005.

2. SQL Server 7.0 log files containing create-index operations cannot be attached in


SQL Server 2000 or 2005. Database backups created using SQL Server 6.5 or
earlier are in an incompatible format and cannot be attached in SQL Server 2005.

3. If you attach a replicated database that was copied rather than detached:

 If you attach the database to an upgraded version of the same server instance,
you must execute sp_vupgrade_replication to upgrade replication after
attaching is complete.

 If you attach the database to a different server instance (regardless of version),


you must execute sp_removedbreplication to remove replication after
attaching complete.

When using the APPLY, PIVOT, TABLESAMPLE, or UNPIVOT keywords against databases that
are upgraded to SQL Server 2005, the database's compatibility level must be set to 90.

In SQL Server 2000 Service Pack 3 (SP3) and later versions of SQL Server, attach and
detach disable cross-database ownership chaining for the database.

To upgrade a database using detach and attach

 Detach the database from the SQL Server 7.0 or 2000 server instance using the
sp_detach_db stored procedure.

 Optionally, move the detached database file(s) and the log file(s).

Page 10 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


You should move the log files as well as data files, even if you intend to create new log
files. In some cases, reattaching a database requires its existing log files. Therefore,
always keep all the detached log files until the database has been successfully attached
without them.

If you try to attach the database without specifying the log file, the attach operation will
look for the log file in its original location. If the original copy of the log still exists there,
that copy is attached. To avoid using the original log file, either specify the path of the
new log file or remove the original copy of the log file (after copying it to the new
location).

1. Attach the copied files to the SQL Server 2005 server instance, using the CREATE
DATABASE Transact-SQL statement with the FOR ATTACH or FOR
ATTACH_REBUILD_LOG option. For more information, see CREATE DATABASE
(Transact-SQL).

2. Optionally, if you are making a copy of the database (rather than moving it), you
can reattach the original database on the SQL Server 7.0 or 2000 server using the
sp_attach_db or sp_attach_single_file_db stored procedure

8.3 Backup and Restore Database

When you use backup and restore to copy a database to another instance of SQL Server, the
source and destination computers can be any platform on which SQL Server runs.

The general steps are:

1. Back up the source database, residing on an instance of SQL Server 7.0, SQL
Server 2000, or SQL Server 2005. The computer on which this instance of SQL
Server is running is the source computer.

2. On the computer to which you want to copy the database (the destination
computer), connect to the instance of SQL Server on which you plan to restore the
database. If needed, on the destination server instance, create the same backup
devices as used to the backup of the source databases.

3. Restore the backup of the source database on the destination computer. Restoring
the database automatically creates all of the database files.

The following topics address additional considerations that may affect this process.

8.3.1 Moving Database Files

If the files within the database backup cannot be restored onto the destination computer
because of the reasons mentioned earlier, it is necessary to move the files to a new location
while they are being restored. For example:

Page 11 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


If the files within the database backup cannot be restored onto the destination computer, it
may be necessary to move the files to a new location while they are being restored. For
example:

 You want to restore a database from backups created in the default location of either
SQL Server 7.0 or SQL Server 2000.

 It may be necessary to restore some of the database files in the backup to a


different drive because of capacity considerations. This is likely to be a common
occurrence because most computers within an organization do not have the same
number and size of disk drives or identical software configurations.

 It may be necessary to create a copy of an existing database on the same computer


for testing purposes. In this case, the database files for the original database already
exist, so different file names need to be specified when the database copy is created
during the restore operation.

8.3.2 Change the Database Name

The name of the database can be changed as it is restored to the destination computer,
without having to restore the database first and then change the name manually. For
example, it may be necessary to change the database name from Sales to SalesCopy to
indicate that this is a copy of a database.

The database name that is explicitly supplied when you restore a database is used
automatically as the new database name. Because the database name does not already
exist, a new one is created by using the files in the backup.

8.3.3 Database Ownership

When a database is restored on another computer, the SQL Server login or Microsoft
Windows user who initiates the restore operation becomes the owner of the new database
automatically. When the database is restored, the system administrator or the new database
owner can change database ownership. To prevent unauthorized restoration of a database,
use media or backup set passwords.

To ensure there are no orphaned users in the new database, be sure to synchronize the
database users with newly created SQL Server Logins or Windows Users/Groups, if Windows
Authentication is used. The DBA can accomplish this through the use of the
sp_change_users_login procedure in the master database.

8.4 Post Database Upgrade Tasks

In earlier versions of SQL Server, the values for the table and index row counts and page
counts can become incorrect. Therefore, databases that were created on versions prior to
SQL Server 2005 may contain incorrect counts. After you upgrade a database to SQL Server

Page 12 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


2005, we recommend that you run DBCC UPDATEUSAGE to correct any invalid counts. This
DBCC statement corrects the rows, used pages, reserved pages, leaf pages and data page
counts for each partition in a table or index. For more information, see DBCC UPDATEUSAGE
(Transact-SQL).

Run sp_updatestats on every user database that was migrated.

Backup every user database that was migrated.

9 Appendices

9.1 Appendix A: DTS Packages and Integration Services


You are not required to migrate SQL Server 2000 Data Transformation Services (DTS)
packages to the SQL Server 2005 Integration Services (SSIS) package format. DTS
packages can continue to run alongside Integration Services packages.

If you want to migrate your DTS packages, SQL Server 2005 provides the Package Migration
Wizard to help in this process. Because the wizard leaves your original packages intact, you
can always continue to use the original packages if you experience migration difficulties.
The Package Migration Wizard is installed when Integration Services is installed.

1. Optionally, run the Upgrade Advisor to analyze your existing packages and obtain a report of
potential migration issues.

2. Run the Package Migration Wizard to migrate your packages.

3. Reconfigure the package items that must be manually reconfigured as reported by the
Upgrade Advisor or the wizard.

4. Test and troubleshoot the migrated packages as needed.

Known package migration issues can be found here: http://msdn2.microsoft.com/en-


us/library/ms143462

9.2 Appendix B: SQL Server Management Studio


Since SQL 2000 Enterprise Manager cannot be used to manage SQL 2005 instances, users
and DBAs must install SQL 2005 Management Studio and its associated components. Please

Page 13 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005


review SQL Books Online to learn all of the new functionalities of SQL 2005 MS since it’s new
to the common user.
9.3 Appendix C:
Deprecated Database Engine Features in SQL Server 2005

Deprecated features include features that will not be supported in the next version of SQL
Server and features that will not be supported in a future version of SQL Server. Check
here for details:

http://msdn2.microsoft.com/en-us/library/ms143729.aspx

Breaking Changes to Database Engine Features in SQL Server 2005

This topic describes the changes made to the Database Engine in Microsoft SQL Server 2005
that could cause applications based on earlier versions of SQL Server to break. Check here
for details:

http://msdn2.microsoft.com/en-us/library/ms143179.aspx

Behavior Changes to Database Engine Features in SQL Server 2005


This topic describes the changes in behavior of some Database Engine features in Microsoft
SQL Server 2005 from their behavior in earlier versions of SQL Server. Check here for
details:

http://msdn2.microsoft.com/en-us/library/ms143359.aspx

Discontinued Database Engine Functionality in SQL Server 2005

There are many Database Engine features from earlier versions of SQL Server are not
supported in SQL Server 2005. Check here for details:

http://msdn2.microsoft.com/en-us/library/ms144262.aspx

Page 14 of 1613

EDS and the EDS logo are registered trademarks of Electronic Data Systems Corporation. © 2005 EDS. All rights reserved. 07/2005

Upgrading to SQL Server 2005

EDS INTERNAL DOCUMENT/Revised September 21, 2005

You might also like