Core component of SQL Server for storing, processing, and securing data
Let's try it!
First preparation on server 1:
CREATE DATABASE KiranTest
go
ALTER DATABASE KiranTest SET RECOVERY FULL
go
USE KiranTest
go
SELECT * INTO Objects FROM sys.objects
go
BACKUP DATABASE KiranTest TO DISK = 'C:\temp\KiranTest' WITH INIT, COMPRESSION
go
Copy the back to the secondary. Recall that for log-shipping, database must be in STANDBY:
RESTORE DATABASE KiranTest FROM DISK = 'C:\temp\KiranTest'
WITH STANDBY = 'C:\temp\KiranTest.stb',
MOVE 'KiranTest' TO 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Data\KiranTest.mdf',
MOVE 'KiranTest_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Data\KiranTest.ldf'
go
-- Verify that we can access the table.
SELECT * FROM KiranTest.dbo.Objects
go
-- And now: Will it work?
BACKUP DATABASE KiranTest TO DISK = 'C:\temp\KiranTest2'
Last chance to place your bets!
.
.
.
.
.
Here it comes:
Msg 3036, Level 16, State 4, Line 8 The database "KiranTest" is in warm-standby state (set by executing RESTORE WITH STANDBY) and cannot be backed up until the entire restore sequence is completed. Msg 3013, Level 16, State 1, Line 8 Actually, I'm a little surprised. I kind of expected it to work, since you can take a backup of the secondary in an Availability Group.