0% found this document useful (0 votes)
5 views

SQL Logshipping - Eventus (1)

Uploaded by

sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

SQL Logshipping - Eventus (1)

Uploaded by

sultan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Overview

 Objective: Set up SQL log shipping between VWMUTMSQL1 (Primary/Source) and VWCHTMSQL1
(Secondary/Destination) for Apex Central and Apex One.
 Primary Server: PMUTMEXSI01 (Host) -> VWMUTMSQL1 (VM, DC)
 Secondary Server: PCHTMEXSI01 (Host) -> VWCHTMSQL1 (VM, DR)
 Application: Apex Central and Apex One Security Appliances

Components Involved

1. SQL Server Instances


2. Log Shipping Jobs
3. Backup and Restore Jobs
4. Monitoring and Alerts

Requirements

 Primary Server (PMUTMEXSI01 - VWMUTMSQL1): SQL Server 2022 installed and running with the Apex
databases.
 Secondary Server (PCHTMEXSI01 - VWCHTMSQL1): SQL Server 2022 installed and ready to receive log
shipped backups.
 Network Connectivity: Both servers must be able to communicate over the network.
 Storage: Adequate storage on both servers for database backups and logs.
 Permissions: Proper SQL Server permissions for log shipping configuration.

Step-by-Step Configuration on the Primary Server (VWMUTMSQL1)


Step 1: Ensure Full Recovery Model
1. Open SQL Server Management Studio SSMS and Connect to the Primary Server:
 Launch SQL Server Management Studio (SSMS) and connect to the primary server
(VWMUTMSQL1).
2. Ensure Full Recovery Model:
 Right-click on the database (e.g., ApexCentralDB), select Properties.
 Go to the Options page, ensure the Recovery model is set to Full.

USE [master];

ALTER DATABASE [ApexCentralDB] SET RECOVERY FULL;

ALTER DATABASE [ApexOneDB] SET RECOVERY FULL;

Step 2: Configure Log Shipping


1. Open Database Properties:
 Right-click on the database (e.g., ApexCentralDB), select Tasks -> Ship Transaction Logs.
2. Enable Log Shipping:
 In the Transaction Log Shipping page, check Enable this as a primary database in a log shipping
configuration.
3. Configure Backup Settings:
 Click Backup Settings. Specify the network path where transaction log backups will be stored
(e.g., \\NetworkPath\LogShippingBackup).
 Set the Backup schedule. (e.g., every 15 minutes).
Step 3: Add Secondary Server
1. Add Secondary Server:
 Click Add to add a secondary server.
 In the Secondary Database Settings dialog, connect to the secondary server (VWCHTMSQL1).
2. Initialize the Secondary Database:
 Choose Yes, generate a full backup of the primary database and restore it into the secondary
database if the secondary database is not initialized.
 If the secondary database is already restored with NORECOVERY, select "No, the secondary
database is initialized".
3. Copy Files Settings:
 In the Copy Files tab, specify the destination folder on the secondary server (e.g., \\NetworkPath\
LogShippingBackup).
 Set the Copy schedule.
4. Restore Transaction Log Settings:
 In the Restore Transaction Log tab, choose the Standby mode (allows read-only access) or No recovery
mode (keeps the database in restoring state).
 Set the Restore schedule to match the backup schedule.

Step 4: Configure Alerts


1. Configure Alert Settings:
 In the Alert Settings tab, configure alerts to notify on job failures or log shipping issues.
 Set up operators for email notifications.

Step 5: Verify Configuration


1. Save Configuration:
 Click OK to save and configure log shipping.
2. Check Log Shipping Status:
 In SSMS, under the primary database node, right-click on the database, select Reports -> Standard
Reports -> Transaction Log Shipping Status.
3. Verify SQL Server Agent Jobs:
 Under SQL Server Agent -> Jobs, verify that the backup, copy, and restore jobs are created and
scheduled correctly.

Step-by-Step Configuration on the Secondary Server (VWCHTMSQL1)


Step 1: Ensure the Secondary Database is in NORECOVERY Mode
1. Open SSMS and Connect to the Secondary Server:
 Connect to the secondary server (VWCHTMSQL1).
2. Restore the Database in NORECOVERY Mode (if not already done):

RESTORE DATABASE [ApexCentralDB] FROM DISK = 'C:\Backup\ApexCentralDB.bak' WITH NORECOVERY;

RESTORE DATABASE [ApexOneDB] FROM DISK = 'C:\Backup\ApexOneDB.bak' WITH NORECOVERY;

Step 2: Configure Copy and Restore Jobs


1. Copy Job:
 Verify the copy job settings to ensure that transaction logs are being copied to the secondary server.
2. Restore Job:
 Verify the restore job settings to ensure that copied transaction logs are being restored correctly on the
secondary database.

Step 3: Verify Log Shipping Status on the Secondary Server


1. Check the Log Shipping Status:
 In SSMS, connect to the secondary server.
 Right-click on the secondary database (e.g., ApexCentralDB), select Reports -> Standard Reports ->
Transaction Log Shipping Status.
2. Monitor SQL Server Agent Jobs:
 Under SQL Server Agent -> Jobs, ensure that the copy and restore jobs are running successfully.
 Review the job history for any errors. 6. Monitor Log Shipping

Step-by-Step Failover Testing


Step 1: Prepare for Failover
1. Verify the Latest Log Backup:
 Ensure that the latest transaction log backup on the primary server has been taken and copied to the
secondary server.
 In SSMS, on the primary server, check the log shipping status to confirm the latest log backup
timestamp.
2. Suspend Log Shipping Jobs:
 On the primary server, suspend the log shipping backup job.
 On the secondary server, suspend the log shipping copy and restore jobs.

-- On Primary Server

EXEC msdb.dbo.sp_update_job @job_name='LSBackup_ApexCentralDB', @enabled=0;

-- On Secondary Server

EXEC msdb.dbo.sp_update_job @job_name='LSCopy_ApexCentralDB', @enabled=0;

EXEC msdb.dbo.sp_update_job @job_name='LSRestore_ApexCentralDB', @enabled=0;

Step 2: Apply the Last Log Backup


1. Copy the Latest Transaction Log Backup:
 Manually copy the latest transaction log backup from the primary server to the secondary server if it
hasn't been copied yet.
2. Restore the Latest Transaction Log Backup:
 On the secondary server, restore the latest transaction log backup in NORECOVERY mode to ensure the
database is up-to-date.

RESTORE LOG [ApexCentralDB]

FROM DISK = 'C:\Path\To\LatestLogBackup.trn'

WITH NORECOVERY;
Step 3: Bring the Secondary Database Online
1. Restore Database with RECOVERY:
 On the secondary server, bring the secondary database online by restoring it with the RECOVERY
option.

RESTORE DATABASE [ApexCentralDB] WITH RECOVERY;

2. Verify the Database:


 Verify that the database on the secondary server is now online and accessible. Check the data and log
file status to ensure everything is functioning correctly.

USE [ApexCentralDB];

GO

SELECT * FROM sys.databases WHERE name = 'ApexCentralDB';

Step 4: Redirect Applications


1. Update Connection Strings:
 Redirect any applications or services to connect to the secondary server (VWCHTMSQL1) instead of the
primary server.
2. Test Application Connectivity:
 Verify that applications are connecting successfully to the secondary server and that the data is
accurate and up-to-date.

Step 5: Reconfigure Log Shipping (Optional)


1. Reverse the Log Shipping Configuration:
 If the primary server is to remain down for an extended period or permanently, reconfigure log
shipping with the secondary server as the new primary server.
 Set up log shipping in the reverse direction if required.

Documentation and Maintenance


Configuration Documentation
1. System Overview:
1) Primary Server Details:
 Hostname: PMUTMEXSI01
 VM: VWMUTMSQL1
 SQL Server Version: [Specify version]
 Databases: ApexCentralDB, ApexOneDB

2) Secondary Server Details:


 Hostname: PCHTMEXSI01
 VM: VWCHTMSQL1
 SQL Server Version: [Specify version]
 Databases: ApexCentralDB, ApexOneDB
2. Log Shipping Configuration:
1) Backup Settings:
 Backup Folder: [Specify folder path]
 Backup Schedule: [Specify frequency, e.g., every 15 minutes]
2) Copy Settings:
 Destination Folder: [Specify network path]
 Copy Schedule: [Specify frequency]
3) Restore Settings:
 Restore Mode: [Standby mode or No recovery mode]
 Restore Schedule: [Specify frequency]

3. Job Details:
1) Primary Server Jobs:
 Backup Job: [Specify job name, schedule]
2) Secondary Server Jobs:
 Copy Job: [Specify job name, schedule]
 Restore Job: [Specify job name, schedule]

4. Alert Configuration:
 Alerts set up for backup job failures, copy job failures, and restore job failures.
 Notification method (e.g., email, SMS) and recipients.

Maintenance Documentation
1. Routine Checks:
 Daily checks of the log shipping status using SQL Server Management Studio (SSMS).
 Verification of SQL Server Agent jobs on both primary and secondary servers.
2. Backup Verification:
 Ensure that backups are being created as per the schedule.
 Check for any failed backup jobs and rectify issues immediately.
3. Log File Management:
 Regularly clean up old log backup files to manage disk space.
 Implement a retention policy for transaction log backups.
4. Test Failover and Failback Procedures:
 Schedule regular (e.g., quarterly) failover tests to ensure the secondary server can be brought
online.
 Document each failover test with steps taken, issues encountered, and resolutions.
 Test failback procedures to ensure the primary server can resume its role after an outage.
5. Performance Monitoring:
 Monitor the performance impact of log shipping on both primary and secondary servers.
 Adjust schedules and configurations as needed to optimize performance.
6. Update Documentation:
 Keep all configuration and maintenance documents up to date.
 Document any changes made to the log shipping configuration or schedules.

Maintenance and Regular Tasks:


1. Daily Tasks:
 Check the status of log shipping jobs.
 Ensure backups are being taken and copied successfully.
 Verify the restore job on the secondary server.
2. Weekly Tasks:
 Review SQL Server Agent job history for any failures or issues.
 Monitor disk space usage for backup storage locations.
3. Monthly Tasks:
 Review the overall health of the log shipping configuration.
 Verify that all alerts and notifications are working correctly.
 Check for any SQL Server updates or patches and apply them if necessary.
4. Quarterly Tasks:
 Perform a test failover to the secondary server.
 Document the failover process and any issues encountered.
 Conduct a failback test to ensure the primary server can resume its role.
 Review and update documentation based on the tests and any configuration changes.
5. Annual Tasks:
 Conduct a comprehensive review of the log shipping setup.
 Evaluate the current configuration against business continuity and disaster recovery plans.
 Update policies and procedures as needed based on the review decisions.

You might also like