Sunday, February 26, 2012

Free unused space in database

Hello,
I need to free unused space in one database, but neither
the "dbcc shrinkdatabase" nor the "dbcc shrinkfile"
commands shows the desired results.
Inside my database i've two tables:
t1 - is the original table
t2 - was created with a select into...from t1
when i use the sp_spaceused in these tables:
t1 unused space = 1822968 KB
t2 unused space = 39992 KB
for me its obvious that when the table t2 was created the
unused space(physical space) its not allocated in the new
table.
The question is that i want to free unused space but cant
see results w/ dbcc shrink...
Best regards
Did you try
DBCC SHRINKDATABASE(DBName, 'TruncateOnly')
However, be very aware that if your database grew to this size once, it will
likely do so again... so don't expect this to be permanent disk space
relief.
http://www.aspfaq.com/
(Reverse address to reply.)
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:1a5d201c44e43$fd195e10$a101280a@.phx.gbl...
> Hello,
> I need to free unused space in one database, but neither
> the "dbcc shrinkdatabase" nor the "dbcc shrinkfile"
> commands shows the desired results.
> Inside my database i've two tables:
> t1 - is the original table
> t2 - was created with a select into...from t1
> when i use the sp_spaceused in these tables:
> t1 unused space = 1822968 KB
> t2 unused space = 39992 KB
> for me its obvious that when the table t2 was created the
> unused space(physical space) its not allocated in the new
> table.
> The question is that i want to free unused space but cant
> see results w/ dbcc shrink...
> Best regards
>
|||try to update statistics. Look in BOL.
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:1a5d201c44e43$fd195e10$a101280a@.phx.gbl...
> Hello,
> I need to free unused space in one database, but neither
> the "dbcc shrinkdatabase" nor the "dbcc shrinkfile"
> commands shows the desired results.
> Inside my database i've two tables:
> t1 - is the original table
> t2 - was created with a select into...from t1
> when i use the sp_spaceused in these tables:
> t1 unused space = 1822968 KB
> t2 unused space = 39992 KB
> for me its obvious that when the table t2 was created the
> unused space(physical space) its not allocated in the new
> table.
> The question is that i want to free unused space but cant
> see results w/ dbcc shrink...
> Best regards
>
|||Perhaps the sp_spaceused results are inaccurate? Try running DBCC
UPDATEUSAGE to get the latest stats.
Peter Yeoh
http://www.yohz.com
Need smaller backups? Try MiniSQLBackup
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:1a5d201c44e43$fd195e10$a101280a@.phx.gbl...
> Hello,
> I need to free unused space in one database, but neither
> the "dbcc shrinkdatabase" nor the "dbcc shrinkfile"
> commands shows the desired results.
> Inside my database i've two tables:
> t1 - is the original table
> t2 - was created with a select into...from t1
> when i use the sp_spaceused in these tables:
> t1 unused space = 1822968 KB
> t2 unused space = 39992 KB
> for me its obvious that when the table t2 was created the
> unused space(physical space) its not allocated in the new
> table.
> The question is that i want to free unused space but cant
> see results w/ dbcc shrink...
> Best regards
>
|||Perhaps some index is occupying space - try reindexing (DBCC DBREINDEX).
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:1a5d201c44e43$fd195e10$a101280a@.phx.gbl...
> Hello,
> I need to free unused space in one database, but neither
> the "dbcc shrinkdatabase" nor the "dbcc shrinkfile"
> commands shows the desired results.
> Inside my database i've two tables:
> t1 - is the original table
> t2 - was created with a select into...from t1
> when i use the sp_spaceused in these tables:
> t1 unused space = 1822968 KB
> t2 unused space = 39992 KB
> for me its obvious that when the table t2 was created the
> unused space(physical space) its not allocated in the new
> table.
> The question is that i want to free unused space but cant
> see results w/ dbcc shrink...
> Best regards
>
|||Or do a showcontig to get more information on any kind of fragmentation.
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

No comments:

Post a Comment