March 9, 2010 at 1:53 pm
Hey everyone,
So I realize that shrinking a database is generally bad. However, the database I am shrink is on a test server, and I need the room.
I have run both the following sets of statements
dbcc shrinkdatabase ('dbname', 10, notruncate)
dbcc shrinkdatabase ('dbname', 10, truncateonly)
I have done the same thing with shrinkfile on the MDF file name.
Neither of these have reduced the size of the database.
sp_spaceused shows the following.
database_namedatabase_sizeunallocated space
DBNAME233262.25 MB144133.43 MB
reserveddataindex_sizeunused
88930888 KB53314544 KB35440696 KB175648 KB
If I am reading this correctly, I have 144GB of free space that I should be able to release. Now, I really only care about 100GB of it as that is roughly the size of the other database that I need to move onto the test server.
Anyone have any thoughts on why this is not shrinking?
Note I am using SS2005, SP3, 64Bit.
Thanks,
Fraggle
March 9, 2010 at 1:56 pm
Shrink DB File by Increment to Target Free Space
March 9, 2010 at 1:59 pm
What is the intial size of the database? What is the unused space on mdf and Ldf files?
March 9, 2010 at 2:11 pm
Michael Valentine Jones (3/9/2010)
Shrink DB File by Increment to Target Free Space
Thanks for the link. I will give it a try this evening an let you know.
Fraggle
March 9, 2010 at 2:13 pm
GTR (3/9/2010)
What is the intial size of the database? What is the unused space on mdf and Ldf files?
FileSizeMBUsedSpaceMBUnusedSpaceMBDBFileName
230980.0086836.75 144143.19Data
3032.25 2920.71 111.54Log
Initial size is 230GB....which makes complete sense. I cannot shrink below this. DUH.
Thanks,
Fraggle
:ermm:
March 9, 2010 at 7:56 pm
Fraggle-805517 (3/9/2010)
GTR (3/9/2010)
What is the intial size of the database? What is the unused space on mdf and Ldf files?FileSizeMBUsedSpaceMBUnusedSpaceMBDBFileName
230980.0086836.75 144143.19Data
3032.25 2920.71 111.54Log
Initial size is 230GB....which makes complete sense. I cannot shrink below this. DUH.
Thanks,
Fraggle
:ermm:
There you go, that is why i asked you that question, you know now:cool:
March 9, 2010 at 9:21 pm
OK, now I am a bit lost. Apparently, altering the database to modify the file to a smaller size throws an error stating that the size I am trying to modify to is smaller than the current size which isn't allowed
Thoughts?
Fraggle
March 9, 2010 at 9:46 pm
Is this in production?
March 9, 2010 at 9:48 pm
Thankfully no. Just on a test server
Fraggle
March 9, 2010 at 9:54 pm
Then create new database with small initial size, and restore the database, then shrink the new database it should work. I don't remember on top of my head what we did to change initial size.
March 9, 2010 at 10:02 pm
My preference has always been to use dbcc shrinkfile in SQL 2005. This allows one to shrink below the initial database size. This could also be a time saver.
Here is another thread here at ssc with supporting documentation:
http://www.sqlservercentral.com/Forums/Topic508106-149-1.aspx
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
March 9, 2010 at 10:09 pm
Jason,
Are you sure DBCC shrinkfile will shrink below initial size of the mdf or ldf file size?
March 10, 2010 at 12:12 pm
GTR (3/9/2010)
Jason,Are you sure DBCC shrinkfile will shrink below initial size of the mdf or ldf file size?
Yes, I have done it hundreds of times. I use it to defrag log files for instance. I also use it if a process has gone haywire in a development database. Of course we find the process that caused the growth first, fix it and then reduce our file sizes.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
March 10, 2010 at 4:39 pm
It also works from SSMS when you shrink at the file level and tell it to reorganize before shrinking.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 11, 2010 at 12:31 am
GTR (3/9/2010)
Are you sure DBCC shrinkfile will shrink below initial size of the mdf or ldf file size?
If you are unsure, you should test it. It's the best way to learn.
(The answer is yes, of course.)
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 15 posts - 1 through 15 (of 23 total)
You must be logged in to reply to this topic. Login to reply