Topics In This Module.
- Log Shipping
- Working with Log Shipping
- Terminology
- Pre-requisites to implement Log Shipping
- Different modes of Log Shipping
- Configuring Log Shipping
- Monitoring
- Manually Performing Failover
- Log Shipping Tables
- Some Real Time Scenarios
- Working with Log Shipping
- Terminology
- Pre-requisites to implement Log Shipping
- Different modes of Log Shipping
- Configuring Log Shipping
- Monitoring
- Manually Performing Failover
- Log Shipping Tables
***============================================================================***
Log Shipping
What is Log Shipping?
Log Shipping is a technique where logs or log backups from primary server(database)
are transferred or shipped to secondary server(database).
In this technique the log backup is taken in primary server databases to a network path,
and then the file is copied to the available location where secondary server database is
accessible, and then the backup is restored to secondary server database.
All the above communication is done using jobs; Hence we can say this as Agent based communication (SQL Server Agent)
The log shipping operations/steps are done by jobs which are scheduled accordingly, those jobs are:
- Backup Job – Job is created on primary instance; This job takes the backup of database on primary server to a network path.
- Copy Job – Job is created on secondary instance; This job copies all the backup files present in network path to a path in secondary server
- Restore Job – Job is created on secondary instance; This job restores the database on secondary server with all the backup files present in secondary path.
- Alert Job – If monitor server is configured a alert job is created in monitor server else alert jobs are created in each instances (Primary, Secondary); This job checks and send alerts to Dba if any delay in backup or restore.
Log Shipping Configuration
Check List:
- Three Servers
- Primary Server/Instance
- Secondary Server/Instance.
- Monitor Server/Instance (Optional for alerting)
- Recovery Model:
- Either Full (or)
- Bulk logged.
- Recovery State:
- a. Standby mode – Read only.
- b. Restoring mode.
- Two folders
- a. Primary/Network path
- b. Secondary path
- Account used to run SQL Server agent should have below access
- a. User used for SQL server agent in primary instance need to have write access on primary folder.
- b. User used for SQL server agent in secondary instance need to have read access on primary folder, read and write access on secondary paths.
- Sysadmin privileges for log shipping configuration user.
- Editions, Versions, compatibility, collation needed to be same – recommended.
Note: Lower to higher versions can be configured but higher to lower version log shipping cannot be configured when failover it gets difficult to configure, so recommended to use the same edition, version, compatibility, collation of instances.
- But Log shipping cannot be configured between 2000 and 2005 instances as the log architecture is different between these versions.
Log Shipping Monitoring
- Using Stored procedures.
- Using Job Activity Monitor.
- Using Transactional log Monitor
- Run the below in primary server to get the log shipping details about primary
server.
sp_help_log_shipping_primary_database ‘<Database Name>’ Run the below in secondary server to get the log shipping details about 2nd server. <Database Name>’
sp_help_log_shipping_secondary_database ‘ <Database Name>’Run the below in primary server to get the secondary server details. sp_help_log_shipping_primary_secondary ‘
Right click on instance – navigate to reports – navigate to standard reports – navigate to transactional log monitor and click to open,
Transactional log monitor on primary instance shows the information regarding jobs on primary like the last run backup job status, name, time, file created by job. Transactional log monitor on secondary instance shows the information regarding jobs on secondary server log shipping status and also like the last runned copy job, restore job, name, time, file copied and restored by jobs.
Important Points in Log shipping
This is a Database level HA or DR technique, and minimum requires 2 servers or databases to configure, usually we use 2 servers to configure, only then it gives sense of configuring HA/DR. And we can also use 3 servers in this configuration, these servers are known as Primary Server, Secondary Server, Monitor Server. This technique works only when databases in primary server is in FULL/Bulk Logged recovery model. We can say log sipping as a Disaster Recovery – DR techniques.
o Restoring mode,o stand by (read – only) mode
<DB Name>_<Log>_<Date>_<LSN>.trn --- transaction log backup file name.
. WRK File:
- This is a temporary file, when copy job is initiated the backup file is copied from primary path to secondary path when the copy/transfer is in progress the file will be with wrk extension.
- Once the file is copied successfully to destination then this wrk file is turned into file with extension of trn file.
. TUF File:
When the database in secondary server is kept in read only mode then a tuf file will be created in secondary server where mdf files are present, which contains all the un-committed transaction present in the log backup, Usually, a log backup contains all the logs, which may be committed or un-committed transactions, when this backup file is restored at secondary server database all committed transaction will/can be restored but the uncommitted transaction cannot be restored hence they will be noted in a file called as tuf file, TUF – Transaction undo files - whenever next backup file is about to restore then it will check this tuf file for uncommitted transaction whether they are completed or not, if committed/ completed they will be restored, and any uncommitted transactions in present file then they are noted to tough file again.
- This TUF file is simply performing the operations of undo file, all un-committed transaction is roll forwarded
SqlLogShip.exe:
This file is mandatory to configure the log shipping is present in location. C:\Program Files\Microsoft SQL Server\150\Tools\Binn
Remember Points (Note):
Case Study Points:
Changing Logical name: Changing Physical name: Changing Physical path:
From Standby to restoring and vice versa: From standby to online or restoring to online:
Comments
Post a Comment