mssql truncate all log files

Learn in MSSQL how to truncate all log files! This transact-sql statement uses the core truncation method recommended by Microsoft.mssql truncate all log files mssql truncate all log files on a MSSQL 2000, 2005 server DECLARE @db varchar(255) declare @sql varchar(200) DECLARE curName CURSOR LOCAL FAST_FORWARD FOR select name from master.dbo.sysdatabases where dbid > 4... » read more

Howto: check database fragmentation sql server

Howto: check database fragmentation sql server How to find all indexes that have fragmentation over 25%: select * FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL , NULL, 'LIMITED') WHERE avg_fragmentation_in_percent > 25.0 AND index_id > 0 AND page_count > 1000 order by avg_fragmentation_in_percent desc

Howto: Fix an oversized modellog.ldf

modellog.ldf too big? First try to figure out what’s using the log file: use [model] select (sum(size) * (8192/1024)) / 1024 from dbo.sysfiles WHERE (status & 0x40) 0 DBCC SQLPERF(LOGSPACE) select ceiling((sum(size) * (8192.0/1024.0)) / 1024.0) from dbo.sysfiles exec sp_spaceused DBCC SQLPERF(LOGSPACE) It is very unusual that the model database data or log files would... » read more