-
Notifications
You must be signed in to change notification settings - Fork 0
/
bak -recover.sql
64 lines (43 loc) · 1.1 KB
/
bak -recover.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use master
go
select * into hd from hardware_register
select * from hardware_register order by ast_id
delete from hardware_register where ast_id =1
SELECT
[Current LSN],
[Transaction ID],
Operation,
Context,
AllocUnitName
FROM
fn_dblog(NULL, NULL)
WHERE
Operation = 'LOP_DELETE_ROWS'
-- 0000:00001945
SELECT
[Current LSN],
Operation,
[Transaction ID],
[Begin Time],
[Transaction Name],
[Transaction SID]
FROM
fn_dblog(NULL, NULL)
WHERE
[Transaction ID] = '0000:00001945'
AND
[Operation] = 'LOP_BEGIN_XACT'
--
RESTORE DATABASE CapitalBankv9New
FROM DISK = 'C:\ReadingDBLog_FULL_15JAN2014.bak'
WITH
MOVE 'ReadingDBlog' TO 'C:\ReadingDBLog.mdf',
MOVE 'ReadingDBlog_log' TO 'C:\ReadingDBLog_log.ldf',
REPLACE, NORECOVERY;
GO
--Restore Log backup with STOPBEFOREMARK option to recover exact LSN.
RESTORE LOG ReadingDBLog_COPY
FROM
DISK = N'C:\ReadingDBlog_tlogbackup_15thJan610.trn'
WITH
STOPBEFOREMARK = 'lsn:22000000042100001'