Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Database Size Expand / Collapse
Author
Message
Posted Saturday, August 25, 2012 4:20 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 12:25 AM
Points: 62, Visits: 412
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?







Post #1350030
Posted Saturday, August 25, 2012 7:38 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
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)

Post #1350040
Posted Sunday, August 26, 2012 11:06 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 12:25 AM
Points: 62, Visits: 412
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
Post #1350194
Posted Sunday, August 26, 2012 11:54 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
You can use DBCC SHRINKFILE. For example:
use IEDBNew
go

dbcc shrinkfile(IEDBNew_Data, 30720) -- 30GB

Post #1350206
Posted Monday, August 27, 2012 1:22 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, November 4, 2014 12:25 AM
Points: 62, Visits: 412
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
Post #1350226
Posted Monday, August 27, 2012 4:50 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
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

Post #1350309
Posted Monday, August 27, 2012 8:44 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 9:15 AM
Points: 1,329, Visits: 2,615
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
Post #1350436
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse