Groups | Blog | Home
all groups > sql server clients > april 2005 >

sql server clients : DataFile



Joh
4/25/2005 3:40:09 PM
Select * into MedicalHistory_2001 from MedicalHistory where
year(Creationdate) = 2001

Select * into MedicalHistory_2002 from MedicalHistory where
year(Creationdate) = 2002

Select * into MedicalHistory_2003 from MedicalHistory where
year(Creationdate) = 2003

Before using the above three commands my 'Health_Data' DataFile size is 3GB
but now its 8.5GB, can I shrink the datafile ?

I have used the following command but doesn't effect.

backup log Health with truncate_only
dbcc shrinkfile('Health_Log',EmptyFile)
dbcc shrinkfile('Health_Data')

Any guidance?

Thanks in advance.

David Gugick
4/25/2005 4:48:08 PM
[quoted text, click to view]

Did you drop those tables? How large is each table? Run the following
and report back:

exec sp_spaceused -- what's the "unused" portion?
exec sp_spaceused MedicalHistory_2001 -- what's the "unused" portion?
exec sp_spaceused MedicalHistory_2002 -- what's the "unused" portion?
exec sp_spaceused MedicalHistory_2003 -- what's the "unused" portion?


--
David Gugick
Imceda Software
www.imceda.com
Joh
4/25/2005 4:57:36 PM
Year Space Unused
2001 - 190432 KB
2002 - 2592 KB
2003 - 2800 KB
2004 - 1160 KB
2005 - 984 KB


what I do now ?


[quoted text, click to view]

David Gugick
4/25/2005 6:29:38 PM
[quoted text, click to view]

You only have about 200MB of unused space in those tables. You didn't
run the first query which gives you the stats for the entire database.
I'm assuming, though, that the results will not be much different.

If you want to recover the space, it sounds like you'll need to identify
and move or delete objects from the data file. I'm just assuming those
tables are large and responsible for the increase in data file size.
Look at the allocated portion to see how much space each table occupies
on disk.


--
David Gugick
Imceda Software
www.imceda.com
John
4/26/2005 12:00:00 AM
Here is the overall result.. need to do any thing ?


reserved data index_size
unused
------------------ ------------------ ------------------ ------------------
7653328 KB 3488344 KB 3879640 KB 285344 KB

[quoted text, click to view]

David Gugick
4/26/2005 12:00:00 AM
[quoted text, click to view]

You only have 285MB of free space. There is no way to recover the 5.5GB
of used space because if is being used by objects.

As you can see you have 7.6GB reserves and 3.4GB of data and 3.8GB
indexes.


--
David Gugick
Imceda Software
www.imceda.com
AddThis Social Bookmark Button