It is data base level high availability feature and its one method
to keep entire database in different server, from this Transactional log backup
will copied and applied on schedule basis.
Pre Requisites
1.
Primary and secondary database instance should
running on domain accounts
2.
Both servers must have same collation setting
3.
Primary Database must be in either FULL or Bulk-Logged recovery model
4.
All SQL edition are support (Ent, Std,)
5.
Two folders need to create BACKUPS Folder (R/W
to Primary site and Read permission for secondary site and COPY/RESTORE (R/W
permission for secondary site)
Advantages of Log Shipping
Configuration
1.
Database High Availability – But manually we
have to make it availability (15 min Downtime )
2.
Offloading Report Activities
3.
Database version upgrade very easy
Log Shipping Architecture
Log shipping
consists of three main operations:
- Back up the transaction log at the
primary server instance. (BACKUP JOB)
- Copy the transaction log file to the
secondary server instance. (COPY JOB)
- Restore the log backup on the
secondary server instance. (RESTORE JOB)
The log can be
shipped to multiple secondary server instances. In such cases, operations 2 and
3 are duplicated for each secondary server instance.
A log shipping
configuration does not automatically fail over from the primary server to the
secondary server. If the primary database becomes unavailable, any of the
secondary databases can be brought online manually.
Configuring Log Shipping
1.
Create folders and grant permission
2.
Take full backup and restore in secondary server
(
Manually or from wizard it can do
Restore Transaction log
3.
Secondary server database you can keep Standby
mode or restore mode. (From Restoring mode – no reading and no writing access
will apply
Standby Mode with Disconnect users when restoring backups
No Recovery Mode (Restoring Mode)
4.
Configure log shipping (Enable Log Shipping)
Configure Jobs
Configure Alerts
Configure
linked servers
To configure
log shipping
- Right click the database you want to
use as your primary database in the log shipping configuration, and then
click Properties.
- Under Select a page, click Transaction
Log Shipping.
- Select the Enable this as a primary database in a log shipping configuration
check box.
- Under Transaction log backups, click Backup Settings.
- In the Network path to the backup folder box, type the network path
to the share you created for the transaction log backup folder.
- If the backup folder is located on
the primary server, type the local path to the backup folder in the If the
backup folder is located on the primary server, type a local path to the
folder box. (If the backup folder is not on the primary server, you can
leave this box empty.)
Important
|
If the SQL Server service account on your primary server
runs under the local system account, you must create your backup folder on
the primary server and specify a local path to that folder.
|
- Configure the Delete files older than and Alert if no backup occurs within parameters.
- Note the backup schedule listed in
the Schedule box under Backup job. If you want to
customize the schedule for your installation, then click Schedule and adjust the SQL Server
Agent schedule as needed.
- Microsoft SQL Server 2012 Enterprise
supports backup
compression. When creating a log shipping configuration, you can
control the backup compression behavior of log backups by choosing one of
the following options: Use the
default server setting, Compress backup, or Do not compress backup. For more information, see Log
Shipping Transaction Log Backup Settings.
- Click OK.
- Under Secondary server instances and databases, click Add.
- Click Connect and connect to the instance of SQL Server that you
want to use as your secondary server.
- In the Secondary Database box, choose a database from the list or
type the name of the database you want to create.
- On the Initialize Secondary database tab, choose the option that you
want to use to initialize the secondary database.
Note
|
If you choose to have Management Studio initialize the
secondary database from a database backup, the data and log files of the
secondary database are placed in the same location as the data and log files
of the master database. This location is likely to be different than
the location of the data and log files of the primary database. (Default
Database Location)
|
- On the Copy Files tab, in the Destination
folder for copied files box, type the path of the folder into which
the transaction logs backups should be copied. This folder is often
located on the secondary server.
- Note the copy schedule listed in the Schedule box under Copy job. If you want to customize the schedule for your
installation, click Schedule
and then adjust the SQL Server Agent schedule as needed. This schedule
should approximate the backup schedule.
- On the Restore tab, under Database
state when restoring backups, choose the No recovery mode or Standby
mode option.
- If you chose the Standby mode option, choose if you want to disconnect users
from the secondary database while the restore operation is underway.
- If you want to delay the restore
process on the secondary server, choose a delay time under Delay restoring backups at least.
- Choose an alert threshold under Alert if no restore occurs within.
- Note the restore schedule listed in
the Schedule box under Restore job. If you want to
customize the schedule for your installation, click Schedule and then adjust the SQL Server Agent schedule as
needed. This schedule should approximate the backup schedule.
- Click OK.
- Under Monitor server instance, select the Use a monitor server instance check box, and then click Settings.
Important
|
To monitor this log shipping configuration, you must add
the monitor server now. To add the monitor server later, you would need to
remove this log shipping configuration and then replace it with a new configuration
that includes a monitor server.
|
- Click Connect and connect to the instance of SQL Server that you
want to use as your monitor server.
- Under Monitor connections, choose the connection method to be used
by the backup, copy, and restore jobs to connect to the monitor server.
- Under History retention, choose the length of time you want to
retain a record of your log shipping history.
- Click OK.
- On the Database Properties dialog box, click OK to begin the configuration process.