You are on page 1of 3

Primary Database Configuration :-

Connect to Primary instance

Create a Database “Mani”

Select “New Query” and enter the following.

Use Mani

Backup database Mani to disk = ‘c:\backup\mani.bak’

Backup log Mani to disk = ‘c:\backup\mani.trn’

Click on Execute Button

In this case, we have only one physical server and two SQL Servers Instances installed,
hence there is no need to copy, but if two SQL Server instances are in different physical
server, we need to copy the following two files to any location of the secondary server where
'DEVINSTANCE' instance is installed.

Secondary Database Configuration :-

Connect to second instance

Right Click on “Database” and select Restore Database

In General Page setting select “Device” and click on Add in next page

Select the backup up mani.bak from the back up and click on OK

In Files page select the check box “Relocate all files to folder” and click OK.

In Options page change the Recovery state selection box to “RESTORE WITH
STANDBY” and click OK.

Database status changed to MANI (Standby / Read-Only) after performing the above steps.

For File Sharing configuration:-

Inside backup folder create two folders “Primary” and “Standby”.

Right click on “Primary” folder and click on Sharing Tab

Select “Everyone” and click on Add and change permission level to “read/write”.

Click on share. Click on Yes.

Copy the network path and click on Apply. \\LAPTOP-FBURF41I\Primary


Right click on “Standby” folder and click on Sharing Tab

Select “Everyone” and click on Add and change permission level to “read/write”.

Click on share. Click on Yes.

Copy the network path and click on Apply. \\LAPTOP-FBURF41I\Standby

Primary Database Configuration :-

Right Click on Database “Mani” and select properties.

Select “Transaction Log Shipping” page and click on “Enable this as a primary database in
a log shipping configuration”.

Click on Backup Settings and in the network path enter \\LAPTOP-FBURF41I\Primary.

Click on Schedule button and change the “occurs every” daily frequency option from
default 15 minutes to 5 minutes. Click Ok.

Click Ok.

Under Secondary server instances and databases click on “Add” button.

Click on “Connect” button to connect to secondary server instance so that instance


and database fields got filled.

Select “No, the secondary database is initialized in the “Initialize Secondary


Database” tab.

Click on “Copy Files” tab and in the “Destination folder for copies files” enter
\\LAPTOP-FBURF41I\Standby

Click on Schedule button and change the “occurs every” daily frequency option from
default 15 minutes to 5 minutes. Click Ok.

Click ok.

Click on “Restore Transaction Log” tab change the “Database state when restoring
backups” to Standby mode.
Select “Disconnect users in the database when restoring backups” option.

Click on Schedule button and change the “occurs every” daily frequency option from
default 15 minutes to 5 minutes. Click Ok.

Click ok.

Click Ok button which restores backup to secondary database.

Create a Table “Employee” and create two columns.

Right click on “Employee” table name and “Edit top 200 rows” and insert some records.

https://www.tutorialspoint.com/ms_sql_server/ms_sql_server_ha_technologies.htm

You might also like