create database slktestdb
on primary
(
name = 'slktestdb',
filename = 'C:SQLtestslktestdb.mdf',
size = 10mb,
filegrowth = 1mb,
Maxsize = 20mb
)
log on
(
name = 'slktestdb_log',
filename = 'C:SQLtestslktestdb_log.ldf',
size = 5mb,
filegrowth = 1mb,
Maxsize = 10mb
)
sp_addumpdevice 'disk','slktestdbDevice','C:SQLtestslktestdb.bak'
backup database slktestdb to slktestdbDevice
backup database slktestdb to disk = 'C:SQLtestslktestdb_full.bak'
create table example
(
id int,
name varchar(25)
)
sp_addumpdevice 'disk','slktestdbDiffDevice','C:SQLtestslktestdbDiffDevic.bak'
backup database slktestdb to slktestdbDiffDevice with differential
backup database slktestdb to disk = 'C:SQLtestslktestDB_diff.bak' with differential
insert into example values (1,'Adarsh')
sp_addumpdevice 'disk','slktestdbLogDevice','C:SQLtestslktestdbLogDevic.bak'
backup LOG slktestdb to slktestdbLogDevice
backup LOG slktestdb to disk = 'C:SQLtestslktestDB_Log.bak'
insert into example values (2,'Vonod')
select * from example
sp_addumpdevice 'disk','TailLogDevice','C:SQLtestTailLogDevic.bak'
backup log slktestdb to TailLogDevice with norecovery, no_truncate
backup log slktestdb to disk = 'C:SQLtestslktestDB_tailLog.bak' with norecovery, no_truncate
restore database slktestdb from disk = 'C:SQLtestslktestDB_Log.bak' with norecovery
restore log slktestdb from disk = 'C:SQLtestslktestDB_Log.bak' with norecovery
restore database slktestdb from disk = 'C:SQLtestslktestDB_diff.bak' with norecovery
restore database slktestdb from disk = 'C:SQLtestslktestdb_full.bak' with norecovery
restore database slktestdb with recovery
select getdate()
2010-08-17 16:38:07.750
restore log slktestdb from disk = 'C:SQLtestslktestDB_Log.bak' with stopat = 'Aug 17, 2010 04:38:07.670 PM'
restore log slktestdb from disk = 'C:SQLtestslktestDB_TailLog.bak' with replace
restore log slktestdb from disk = 'C:SQLtestslktestDB_Log.bak' with replace
restore database slktestdb with recovery
backup database employeedb to slktestdbDevice
backup database employeedb to slktestdbDiffDevice with differential
backup LOG employeedb to slktestdbLogDevice
backup log employeedb to TailLogDevice with norecovery, no_truncate
restore database employeedb with recovery
sp_addumpdevice 'disk','FilesDevice','C:SQLtestFilesDevic.bak'
Backup database employeedb
file = 'employeeDB' to FilesDevice
backup log employeedb to slktestdbLogDevice
alter database slktestdb
add filegroup Secondary
alter database slktestdb
add file
(
name = SeC4,
filename = 'C:SQLtestSec4_log.ldf',
size = 1mb
) to filegroup secondary
alter database slktestdb
add filegroup Secondary
backup database slktestdb read_write_filegroups TO FilesDevice with init
restore database slktestdb from FilesDevice with recovery
SELECT * from sys.sysfilegroups
SELECT * from sys.sysprocesses
restore filelistonly from FilesDevice
restore headeronly from FilesDevice
backup log slktestdb to TailLogDevice with norecovery, no_truncate
restore database slktestdb from slktestdbDevice with norecovery
restore database slktestdb from slktestdbDiffDevice with norecovery
restore database slktestdb from disk = 'C:SQLtestslktestDB_diff.bak' with norecovery
restore database slktestdb from slktestdbLogDevice with recovery
select getdate()
select * from sys.sysprocesses.
select * from fn_dblog(1,100)
select * from fn_dblog(null,null)
select * from backupset where database_name like 'slktestdb'
Msg 3117
The log in this backup set terminates at LSN 23000000017500001, which is too early to apply to the database.
A more recent log backup that includes LSN 23000000019300001 can be restored.

