View Single Post
Old 12.04.2006, 12:57   #3
hr
Архивный участник
 
Join Date: Jun 2005
Posts: 285
Default

use backup or (in QA)
(1)
Code:
Use master 
go 
sp_configure 'allow updates', 1 
reconfigure with override 
go
(2) get and write somewhere status of your db:
Code:
select status from sysdatabases where name = 'lin2world'
(3)
Code:
update sysdatabases set status=-32768 where name = 'lin2world'
(4) restart SQL server

(5) ONLY if lin2world's status doesn't change to Emergency, than detach it, backup ldf and mdf files, make new db with the same name, stop sql server, replace newly created .mdf with old one from that backup, start sql server and begin from (1)

(6) if you changed mdf in (5) than:
Code:
 DBCC REBUILD_LOG('lin2world', '<new transaction log file with full path>')
You'll get: Warning: The log for database 'lin2world' has been rebuilt.
(7)
Code:
Use master 
go 
sp_dboption 'lin2world', 'single_user', 'true' 
go 
USE lin2world 
GO 
DBCC CHECKDB('lin2world', REPAIR_ALLOW_DATA_LOSS) 
go
( 8 )
Code:
sp_dboption 'lin2world', 'single_user', 'false' 
go 
Use master 
go 
sp_configure 'allow updates', 0 
go
hr is offline