Question : Reduce the size of my database

I deleted a few tables from my SQL server database who's initial size was about 32gb.  I expected to see it go down substantially and it simply didn't change.  I removed aout 2 million records.  I did compact database, and I think I ran the maintenance plan but it simply didn't change.

Can anyone give me some advice on how to do this correctly?

thanks!

Answer : Reduce the size of my database

Exec the attached script in SQL Management Studio
It will reduce the size of all databases in your server
Regards
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
DECLARE dbNames_cursor CURSOR
--
--  Run this script routinely to control the growth of LDF log files.
--
 
FOR
   SELECT NAME FROM dbo.sysdatabases where not name in ('master', 'model', 'msdb', 'tempdb')
OPEN dbNames_cursor
DECLARE @dbName nvarchar(50)
 
FETCH NEXT FROM dbNames_cursor INTO @dbName
WHILE (@@FETCH_STATUS <> -1)
BEGIN
   IF (@@FETCH_STATUS <> -2)
   BEGIN
      declare @logName nvarchar(50)
      exec(' use [' + @dbName + '] ' + 'backup log [' + @dbName + '] with truncate_only')
      set @logName = @dbName + '_log'
      exec(' use [' + @dbName + '] ' + 'declare @logName nvarchar(50) select @logName = name from sysfiles where fileid = 2 set @logName = rtrim(@logName) dbcc shrinkfile (@logName)')
      dbcc Shrinkdatabase (@dbName, 0)
 
   END
   FETCH NEXT FROM dbNames_cursor INTO @dbName
END
CLOSE dbNames_cursor
DEALLOCATE dbNames_cursor
 
 
--  Script by Shawn Camner, CCCI
Open in New Window Select All
Random Solutions  
 
programming4us programming4us