用sql语句dbcc log 查看SQL Server 数据库的事务日志
1)用系统函数
SELECT
allocunitname,operation,
[
RowLog Contents 0
]
as
r0,
[
RowLog Contents 1
]
as
r1
FROM ::Fn_dblog( null , null )
where allocunitname like ' dbo.TArea% '
and operation in ( ' LOP_INSERT_ROWS ' , ' LOP_DELETE_ROWS ' )
FROM ::Fn_dblog( null , null )
where allocunitname like ' dbo.TArea% '
and operation in ( ' LOP_INSERT_ROWS ' , ' LOP_DELETE_ROWS ' )
2)用DBCC
DBCC
log
(
'
hrdb
'
, TYPE
=
2
)
dbcc log(dbname,4) --(n=0,1,2,3,4)
1 - 更多信息plus flags, tags, row length
2 - 非常详细的信息plus object name, index name,page id, slot id
3 - 每种操作的全部信息
4 - 每种操作的全部信息加上该事务的16进制信息
默认 type = 0