web analytics

MS SQL & Sybase: recreate master database

Sybase: before 12.5: buildmaster (bldmatr for NT)

buildmaster -d master_device -s size_in_2k_pages

12.5 and later: dataserver with some options (sqlsvr for NT)

dataserver -d master_device -b size -forcebuild -z page_size -Z size_of_master_db


before MS 2005: rebuildm utility (GUI)

MS SQL 2005:

Start server in single-user mode (sqlserver.exe -m) setup.exe /qn INSTANCENAME=instance_name REINSTALL=SQL_Engine REBUILDDATABASE=1 […]

MS SQL: long running queries

select spid,cmd,status,loginame,open_tran,   datediff (s,last_batch,getdate()) as [Waittime (s)] from master..sysprocesses p where open_tran > 0            and spid > 50           and datediff (s,last_batch,getdate()) > 30           and exists ( select * from master..syslockinfo                            where req_spid=p.spid and rsc_type <>2)