May 31, 2010 at 2:26 pm
deleted
June 22, 2010 at 7:04 am
I was able to shrink the initial size of the database as follows
Right click database in Management Studio
Choose Tasks, Shrink, Files
Select File Name to shrink, Reorganize pages before releasing unused space and enter size to shrink file to.
October 18, 2010 at 11:50 am
Setting the recovery mode to SIMPLE before the shirnkfile was executed worked for me! I had tried all of the other steps in this post and this was the first one that actually worked
Much Appreicated!!!
October 25, 2010 at 2:54 am
Try setting the recovery model to simple before performing the DBCC Shrinkfile command.
November 23, 2010 at 11:29 am
This worked for me as well......
I was able to shrink the initial size of the database as follows
Right click database in Management Studio
Choose Tasks, Shrink, Files
Select File Name to shrink, Reorganize pages before releasing unused space and enter size to shrink file to.
March 8, 2011 at 11:26 pm
This might answer why the DB size shrinked after you took a Full backup:
March 8, 2011 at 11:28 pm
This would answer why DB size would shrink on taking a full DB backup.
June 13, 2012 at 8:54 am
I have a database where the initial size was larger than required at 1500Mb
I tried this code:
USE master;
GO
ALTER DATABASE [dbname]
MODIFY FILE
(NAME = [logicalfilename],
SIZE = 1000MB);
GO
It failed with the error message
Msg 5039, Level 16, State 1, Line 1
MODIFY FILE failed. Specified size is less than current size.
However, if I right click on the database, select properties, and select Files, it allows me to change the initial size of 1500 to 1000
June 14, 2012 at 3:11 am
I have had success shrinking stubborn log files with this code.
Never used it on a mdf before though. A backup might be in order before trying.
Don't know what your minimum size will be, but probably not 1....
Execute SP_ReplicationDbOption <My_DB>,Publish,true,1
GO
DBCC ShrinkFile(<MyDB_Log>,1)
GO
Execute SP_ReplicationDbOption <My_DB>,Publish,false,1
GO
Maybe loop through all your DB tables using sp_SpaceUsed to find out what the actual datasize is.
This'll show the datafile size according to sql.
select Name, phtsical_name, size from sys.master_files where Type = 0 AND Name = '<DBName>'
July 12, 2012 at 8:17 am
Yes - Simple Mode first, then shrink. Just remember, if you put a database into simple mode to shrink it, and it works, then you may need to switch it back to FULL recovery mode to log transactions again. When you do that you need to do a FULL backup to get those transactions logging. Such an old post to dig up, but I had a brain fart and this jogged my memory. Old information isn't a bad thing to add too 🙂
Viewing 10 posts - 31 through 39 (of 39 total)
You must be logged in to reply to this topic. Login to reply