Groups | Blog | Home
all groups > sql server (alternate) > may 2004 >

sql server (alternate) : TSQL to run DBCC rebuild_repair on an MSDE 2000-hosted DB



Laphan
5/13/2004 7:10:06 PM
Hi All

Bit of confirmation needed really, as I've just come home and found that my
PC is only running SQL 7.0, when I know the below code only works in SQL
2000 (I think!!!).

What I want to do is put a particular DB in single user mode, do a DBCC
repair_rebuild then put it back to how it was all from a text file that is
executed via osql (MSDE's isql equivalent). Will the below do it?

alter database AccountsData
set single_user
with rollback immediate
go

dbcc checkdb('AccountsData',repair_rebuild)
go

alter database AccountsData
set multi_user
go

Do I need anything else, like use Master or something bearing in mind the
text file/osql method that I have to use?

Thanks

Laphan



Andrea Montanari
5/14/2004 8:57:30 AM
hi Laphan,
"Laphan" <news@DoNotEmailMe.co.uk> ha scritto nel messaggio
news:40a3b62a_3@127.0.0.1...
[quoted text, click to view]

on SQL Server 7.0 that syntax si not supported... you have to execute
EXEC sp_dboption 'dbnam', 'single user' , 'TRUE'
to put the database in single user mode
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.7.0 - DbaMgr ver 0.53.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply
Laphan
5/14/2004 8:00:18 PM
Many thanks Andrea


[quoted text, click to view]
hi Laphan,
"Laphan" <news@DoNotEmailMe.co.uk> ha scritto nel messaggio
news:40a3b62a_3@127.0.0.1...
[quoted text, click to view]

on SQL Server 7.0 that syntax si not supported... you have to execute
EXEC sp_dboption 'dbnam', 'single user' , 'TRUE'
to put the database in single user mode
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.7.0 - DbaMgr ver 0.53.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply


AddThis Social Bookmark Button