Rolling Upgrade To SQL Server Database Mirroring
Rolling Upgrade To SQL Server Database Mirroring
mirroring_witness_name
FROM sys.database_mirroring
GO
GO
GO
4. Remove Witness from mirroring session - Disable the Witness when you are using Automatic Failovers.
ALTER DATABASE DatabaseName
GO
GO
7. Run DBCC CHECKDB on all databases on Server 2 (upgraded Mirror new Principal).
DBCC CHECKDB -- Check the current database.
GO
8. Perform upgrade / Install the Service Pack on Server 1 (original Principal new Mirror).
9. Failover all database to Server 1 (new Mirror upgraded Principal).
ALTER DATABASE DatabaseName
GO
GO
GO
13. Perform upgrade / Install the Service Pack on Server 3 (Witness - actually you can do it any time).
14. Add Witness back to mirroring session. ALTER DATABASE <資料庫名稱> SET WITNESS =<伺服器網路位址>
ALTER DATABASE DatabaseName
GO
GO
Example Demonstrations
3. Fail over the principal database to the new SQL Server 2008 instance. SQL Server will now suspend mirroring
because the servers are at two different build levels. You will be able to resume mirroring once you have
completed the upgrade on the original principal server. To fail over to the database to the mirror server, issue
the following command from the master database on the principal server.
ALTER DATABASE [DatabaseName]
4. Change the operating mode back to high-performance. You can change the database to high-performance mode
by running the following command from the master database on the principal server.
ALTER DATABASE [DatabaseName]
5. Run the SQL Server 2008 installation to upgrade the original principal server (now acting as the mirror).
6. Resume the database mirroring session. To resume database mirroring run the following command on either
partner.
ALTER DATABASE [DatabaseName]
2. Run the SQL Server 2008 installation to upgrade the mirror server.
3. Change the operating mode back to high-safety mode without a witness and wait for the mirror database to
synchronize. You will only need to do this if you changed the operating mode in step 1. You can change the
database to high-safety mode by running the following command from the master database on the principal
server.
ALTER DATABASE [DatabaseName]
4. Fail over the principal database to the new SQL Server 2008 instance. SQL Server will now suspend mirroring
because the servers are at two different build levels. You will be able to resume mirroring once you have
completed the upgrade on the original principal server. To fail over to the database to the mirror server, issue
the following command from the master database on the principal server.
ALTER DATABASE [DatabaseName]
5. Run the SQL Server 2008 installation to upgrade the original principal server (now acting as the mirror).
6. Resume the database mirroring session. To resume database mirroring run the following command on either
partner.
ALTER DATABASE [DatabaseName]
FROM sys.database_mirroring
2. Remove the witness server to disable automatic failover. To remove the witness issue the following command
on either partner.
ALTER DATABASE [DatabaseName]
3. Change the operating mode to high-performance mode. This is only applicable if you are running SQL Server
Enterprise Edition. You can change the database to high-performance mode by running the following command
from the master database on the principal server.
ALTER DATABASE [DatabaseName]
4. Run the SQL Server 2008 installation to upgrade the mirror server.
5. Change the operating mode back to high-safety mode without a witness and wait for the mirror database to
synchronize. You will only need to do this if you changed the operating mode in step 3. You can change the
database to high-safety mode by running the following command from the master database on the principal
server.
ALTER DATABASE [DatabaseName]
6. Fail over the principal database to the new SQL Server 2008 instance. SQL Server will now suspend mirroring
because the servers are at two different build levels. You will be able to resume mirroring once you have
completed the upgrade on the original principal server. To fail over to the database to the mirror server, issue
the following command from the master database on the principal server.
ALTER DATABASE [DatabaseName]
7. Run the SQL Server 2008 installation to upgrade the original principal server (now acting as the mirror).
8. Resume the database mirroring session. To resume database mirroring run the following command on either
partner.
ALTER DATABASE [DatabaseName]
9. Run the SQL Server 2008 installation to upgrade the witness server. You can do this step at any time after you
have removed the witness server from the mirroring session in step 2.
10. Add the witness server back to database mirroring session to enable automatic failover. To add the witness
server back issue the following command on the principal server with the appropriate network address for the
witness server.
ALTER DATABASE [DatabaseName]