【转帖】如何做 rebuild log
注意:这个过程可能会引起数据的不一致性。<BLOCKQUOTE>
<DIV align=left>
<P><FONT color=#006633>(1)赋予sa用户sybase_ts_role的角色</FONT>
isql -Usa -P
1>sp_role "grant","sybase_ts_role",sa
2>go
1>quit</P></DIV>
<DIV align=left>
<P><FONT color=#006633>(2)将数据库置为"bypass recovery"状态</FONT>
isql -Usa -P
1>sp_configure "allow updates",1
2>go
1>use master
2>go
1>update sysdatabases set status=-32768
2>where name="database_name"
3>go
1>shutdown with nowait
2>go</P></DIV>
<DIV align=left>
<P><FONT color=#006633>(3)rebuild数据库日志</FONT>
重启Server
isql -Usa -P
1>use master
2>go
1>dbcc rebuild_log(database_name,1,1)
2>go
1>shutdown with nowait
2>go</P></DIV>
<DIV align=left>
<P><FONT color=#006633>(4)重启SQL server</FONT>
1>use master
2>go
1>update sysdatabases set status=0 where name="database_name"
2>go
1>sp_configure "allow updates",0
2>go
1>shutdown with nowait
2>go</P></DIV>
<DIV align=left><FONT color=#006633>(5)在重启SQL server之后,如果数据库恢复正常,rebuild log工作将会成功完成,否则要恢复数据库备份,使用dump database或bcp命令。</FONT></DIV></BLOCKQUOTE> 这样之后数据会变??
页:
[1]