SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database Size


Database Size

Author
Message
vs.satheesh
vs.satheesh
SSC-Addicted
SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)

Group: General Forum Members
Points: 475 Visits: 652
In My Production server i am facing following problem.

Totally my database size showing 134 GB.But my data size is 10GB and index size is 3 GB.whenever i use this sp_spaceused command.
i am getting following result

database_name database_size unallocated space
-----------------------------------------------------------
XYZ 137353.13 MB 122962.30 MB

reserved data index_size unused
------------------ ------------------ ------------------ -------
14720464 KB 11105104 KB 3625280 KB -9920 KB




How to reduce this MDF file size ? what is unallocated space?
Suresh B.
Suresh B.
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4944 Visits: 5329
Is this database upgraded from SQL 2000 version?
What is the log file size?

Please run this query and post the results here:

use dbname
go

select name, type_desc, size/128 'Size(MB)', FILEPROPERTY(name, 'SpaceUsed') / 128 'SpaceUsed(MB)'
from sys.database_files



You can the reduce the MDF file size by using DBCC SHRINKFILE. But set the file size to appropriate size.

Unallocated space = 'Space in the database that has not been reserved for database objects.' (from BOL)
vs.satheesh
vs.satheesh
SSC-Addicted
SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)

Group: General Forum Members
Points: 475 Visits: 652
whenever i am executing following query i am getting following result.how to reduce the space


select name, type_desc, size/128 'Size(MB)', FILEPROPERTY(name, 'SpaceUsed') / 128 'SpaceUsed(MB)'
from sys.database_files


name type_desc Size(MB) SpaceUsed(MB)

IEDBNew_Data ROWS 137337 14729
IEDBNew_Log LOG 459 19
Suresh B.
Suresh B.
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4944 Visits: 5329
You can use DBCC SHRINKFILE. For example:
use IEDBNew
go

dbcc shrinkfile(IEDBNew_Data, 30720) -- 30GB


vs.satheesh
vs.satheesh
SSC-Addicted
SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)SSC-Addicted (475 reputation)

Group: General Forum Members
Points: 475 Visits: 652
Hi I am getting following result .But Disk space not yet reduced.please help me



DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages
------ ----------- ----------- ----------- ----------- --------------
7 1 17579232 128 1885120 1885088
Suresh B.
Suresh B.
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4944 Visits: 5329
It is because there is used page at the end which needs to be moved to front of the file.
Please run DBCC SHRINKFILE with NOTRUNCATE option as shown in the following example:

use IEDBNew
go
dbcc shrinkfile(IEDBNew_Data, NOTRUNCATE);
go
dbcc shrinkfile(IEDBNew_Data, 30720) -- 30GB
go


Divine Flame
Divine Flame
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4383 Visits: 2816
Just remember that shrinking will cause the indexes to be fragmented. Therefore rebuilding the indexes will be required after shrinking has been done.


Sujeet Singh
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search