Terminate a Continuous Copy Relationship

Terminate a Continuous Copy Relationship

There are two methods to terminate a continuous copy relationship:

  • Planned Termination is intended for use when a one-time database copy is created using a user controlled termination of the continuous copy. Termination can only be performed on the primary database, after the active secondary has been seeded and data integrity verified. You must ensure that both databases are identical and that no data loss has occurred before performing the termination.
  • Forced Termination is used when the primary database or one of its secondary databases is lost or inaccessible. A forced termination can be performed on either the primary or secondary database. It is likely to result into some loss of data.

A. Perform a Planned Termination of a Continuous Copy Relationship

Typical scenarios of a planned termination include:

  • Redeployment of an application to a different geographical region.
  • Creation of a copy of a database to start up new development.
  • Creation of a temporary copy of a database during application upgrade.

A planned termination ensures that every transaction committed on the primary database is replicated to the online secondary before termination. A planned termination can only be initiated from the primary database. It involves coordination between the primary database and online secondary.

Depending on the amount of committed transactions in the buffer, a planned termination might take significant time.

Before You Begin

Limitations and Restrictions

  • A Planned Termination can only be performed on the primary database after the online secondary has been seeded.

Recommendations

  • If your scenario requires that primary and online secondary databases are identical after termination, make sure to prevent updates on the primary database before initiating a termination. With updates blocked, a planned termination ensures all transactions get copied to the online secondary before the continuous copy relationship is terminated.
  • A simple way to block updates is to set the primary database to read-only by using the following Transact-SQL command.
  • ALTER DATABASE ‘database_name’ SET READ_ONLY

Note
This setting is replicated to the secondary, so you will need to manually change the value for that database after termination. You can check the Updateability property of the database to find out the database is in a read only or read write mode by using the following Transact-SQL command:

SELECT DATABASEPROPERTYEX ('', 'Updateability')

Follow up

Recommendations after termination: The following table contains recommendations for following up after you initiate a termination of a continuous copy relationship.

Task Description and Steps
Verify Update Mode of Both Databases Make sure the primary and online secondary databases each have the appropriate update mode (read-write or read-only).

After termination, the online secondary becomes a stand-alone database that is fully synchronized with the primary database.

It becomes a read-write database unless the primary database is a read-only database. If you set the former primary database to read-only mode in order to block updates, manually change either or both databases to read-write mode, if appropriate.

The Transact-SQL command is the following: ALTER DATABASE 'database_name' SET READ_WRITE

Verify that Active Secondary is Identical to the Primary Database (if necessary) In some cases, after termination, you must ensure that both databases are identical and that no data loss has occurred.

These cases include:

  • Redeployment of an application to a different geographical region.
  • Creation of a copy of a database, for example, to start up new development.
  • Creation of a temporary copy of a database during application upgrade.

B. Perform a Forced Termination of a Continuous Copy Relationship

Typical scenarios of a forced include:

  • Regional service wide or datacenter wide failure that resulted in unavailability of the server containing the secondary database.
  • Regional service wide or datacenter wide failure that resulted in unavailability of the server containing the primary database.
  • DR drill that includes simulation of the primary database failure.

Before You Begin

Limitations and Restrictions

  • Forced Termination can be performed on either the primary or secondary.

Recommendations

  • Every forced termination results in the irreversible loss of connectivity between the primary database and the secondary. Since replication is then stopped, some transactions may not have been copied to the secondary.
  • After forced termination from the primary or secondary database they become stand-alone online databases without protection. To protect it from future failure events the user manually configures a new secondary database using Active Geo-Replication for SQL Server Database.