Contents

1 2005 伎
2 2000
3


1 2005 伎 #

use master
go

create database test
go

--覈 襦語  ろ
--------------------------------------------------------------------------
觜 譴讌
net stop mssqlserver 

襦蠏誤 
del C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\test_log.LDF 

觜 
net start mssqlserver
--------------------------------------------------------------------------

select 
	name
,	status 
from master.sys.sysdatabases
where name = 'test'

/*
--1073741824 = cleanly shutdown

name  status
----- -----------
test  1073807360
*/ 

alter database test set emergency
alter database test rebuild log on (name=test_log, filename='c:\test_log.ldf')

exec sp_dboption 'test', 'single user', 'true' 
DBCC CHECKDB ('test', REPAIR_ALLOW_DATA_LOSS)
exec sp_dboption 'test', 'single user', 'false' 

--襦蠏誤殊 れ 殊!!
--dir c:\test_log.ldf

alter database test set multi_user

* 襷 覓語螳 DB襯 覿襴る, 螳 企 DB襯 燕 SQL Server 觜るゼ 譬襭 覓語 DB 一危 殊 覦蠖豺螳 讌覃 .

2 2000 #

--Suspect!! 
  
USE master
GO 
EXEC sp_configure 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO 
UPDATE master..sysdatabases SET status = 32768 
WHERE name = 'act'
GO 
UPDATE master..sysdatabases SET status = 32768 
WHERE name = 'etc'
GO 
UPDATE master..sysdatabases SET status = 32768 
WHERE name = 'mat'
GO 
UPDATE master..sysdatabases SET status = 32768 
WHERE name = 'pay'
GO 
UPDATE master..sysdatabases SET status = 32768 
WHERE name = 'sal'
GO 
USE master
GO
DBCC REBUILD_LOG('act','E:\PKFC\act\act_log.LDF')
GO 
DBCC REBUILD_LOG('etc','E:\PKFC\etc\etc_log.LDF')
GO 
DBCC REBUILD_LOG('mat','E:\PKFC\mat\mat_log.LDF')
GO 
DBCC REBUILD_LOG('pay','E:\PKFC\pay\pay_log.LDF')
GO 
DBCC REBUILD_LOG('sal','E:\PKFC\sal\sal_log.LDF')
GO 
exec sp_resetstatus 'act'
GO 
exec sp_resetstatus 'etc'
GO 
exec sp_resetstatus 'mat'
GO 
exec sp_resetstatus 'pay'
GO 
exec sp_resetstatus 'sal'
GO 
EXEC sp_configure 'allow updates', 0
RECONFIGURE WITH OVERRIDE
GO 
  
DBCC CHECKDB('act')
GO
DBCC CHECKDB('etc')
GO
DBCC CHECKDB('mat')
GO
DBCC CHECKDB('pay')
GO
DBCC CHECKDB('sal')
GO 

3 #

  • Microsoft SQL Server 2000
  • Microsoft SQL Server 2005