Applying Microsoft SQL Server patches

The following is the procedure for applying Microsoft SQL Server patches.

StepsApplying Microsoft SQL Server patches

  1. Before applying a patch, be sure that all data has been replicated to the replicate site.

    NoteAll activities must stop before this step, and all users except the pds_username should log off from the primary database.

    For each existing Replication Agent for Microsoft SQL Server instance, verify that it is in Replicating state and allow replication to finish. To verify that replication has finished, quiesce the Replication Agent instance by issuing the quiesce command.

    NoteIt may take a while for the command to return because Replication Agent reads all data from the log file and sends it to the Replication Server.

  2. Before applying the service patch disable the database triggers.

    If the pdb_automark_tables configuration parameter is set to true, log on to the primary database and disable the automark trigger by issuing:

    DISABLE TRIGGER ra_createtable_trig_ ON DATABASE
    

    where ra_createtable_trig_ is the name of the automark trigger created by Replication Agent.

  3. Apply the service patch using the instructions in the Microsoft documentation.

  4. Regenerate the objects in the Microsoft SQL Server system resource database.

    • Restart Microsoft SQL Server in single-user mode by opening a new command window and executing the following command:

      "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe" -m 
      -sserverName\instanceName
      

      where instanceName is the name of the Microsoft SQL Server instance.

    • Log in to the Replication Agent instance:

      isql -U username -P password -S instanceName 
      
    • Reinitialize Microsoft SQL Server :

      server_xlog remove, force
      
      go
      
      server_xlog init
      
      go
      
    • Restart Microsoft SQL Server in multi-user mode.

  5. If the pdb_automark_tables configuration parameter is set to true before applying the patch:

    • Log on to the primary database, and enable the automark trigger by issuing the following command:

      ENABLE TRIGGER ra_createtable_trig_ ON DATABASE
      

      where ra_createtable_trig_ is the name of the automark trigger created by Replication Agent.

    • Log on to the primary database, and enable the DDL trigger by issuing the following command:

      ENABLE TRIGGER ra_ddl_trig_ ON DATABASE
      

      where ra_ddl_trig_ is the name of the DDL trigger created by Replication Agent.

  6. Zero the LTM locator, and move the truncation point to the end of the log:

    • Zero the LTM locator by logging in to RSSD and issuing the following command:

      rs_zeroltm < ra_instance > , < pdb_name > "
      
    • Move the truncation point to the end of log by logging in to Replication Agent and issuing the following command:

      pdb_init move_truncpt
      
  7. Resume replication or other operations in Replication Agent. The primary database will be accessible to users.