|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, April 05, 2013 4:43 PM
Points: 1,473,
Visits: 1,314
|
|
In the properties of a user database, we can obtain the database size and the available space. We can shrink the database such that the available space is zero.
However, if we execute sp_spaceused against this database, we can see the unused space is not zero.
How to interprete the unused space in executing the stored procedure? Is there any way in removing the unused space?
Many thanks in advance for any input.
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 7:19 AM
Points: 4,424,
Visits: 7,183
|
|
There's a limit to how small you can shrink a database. I can't remember off the top of my head what it its - I think it's either the size of the model database or the size of the database when it was created?
Why do you want to do this, anyway? If you shrink the database, it will only grow again, unless you're going to set it as read only.
John
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 9:12 AM
Points: 162,
Visits: 660
|
|
| Are you talking about a production db. I would not shrink a production db POINT BLANK.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 9:12 AM
Points: 162,
Visits: 660
|
|
The auto grow setting on the db has been triggered at some point and the file/s have been extended. Allowing data to be written into the free space. If you shrink it the db will grow again anyway. If you lower the setting it will extend the file more frequently at a cost of performance each time.
Make sure the auto grow is set to an appropriate amount of MB and not %. All dbs should have a decent amount of free space to grow into.
See it like this: Its the same as buying clothes for small children. You never buy clothes that just fits today always buy the size up so they can grow into it.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, April 05, 2013 4:43 PM
Points: 1,473,
Visits: 1,314
|
|
John Mitchell-245523 (3/20/2013) There's a limit to how small you can shrink a database. I can't remember off the top of my head what it its - I think it's either the size of the model database or the size of the database when it was created?
Why do you want to do this, anyway? If you shrink the database, it will only grow again, unless you're going to set it as read only.
John Thank you so much for your input promptly.
If your statement is true, then the info on the properties of a database is confusing. The info on the properties of a database confuses people when they refer to the results when executing the sp_spaceused.
The setting in the model system database is used to set the default values. We may change any setting when creating any database, and also, we can change these settings after creating the database.
Shrinking the database such that it has zero available space is requested by our users. They use ithe database for creating reports.
Once again, tons of thanks to you.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, April 05, 2013 4:43 PM
Points: 1,473,
Visits: 1,314
|
|
Bobby Glover (3/20/2013) Are you talking about a production db. I would not shrink a production db POINT BLANK. Thank you for your input. Unfortunately, I am asking a solution not asking why I want to do so.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Friday, April 05, 2013 4:43 PM
Points: 1,473,
Visits: 1,314
|
|
Bobby Glover (3/20/2013) The auto grow setting on the db has been triggered at some point and the file/s have been extended. Allowing data to be written into the free space. If you shrink it the db will grow again anyway. If you lower the setting it will extend the file more frequently at a cost of performance each time.
Make sure the auto grow is set to an appropriate amount of MB and not %. All dbs should have a decent amount of free space to grow into.
See it like this: Its the same as buying clothes for small children. You never buy clothes that just fits today always buy the size up so they can grow into it.
Thank you for your input. After executing the sp_spaceused stored procedure, I checked the properties of the database, the available space is still zero. The database is used for creating reports, no data modification occurs.
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 7:19 AM
Points: 4,424,
Visits: 7,183
|
|
SQL ORACLE (3/20/2013)Shrinking the database such that it has zero available space is requested by our users. They use ithe database for creating reports. You're the database professional - it's OK, indeed expected, for you to tell users that they are making an inappropriate request. Users should only be concerned what data is in the database; management of free space is your job.
Unfortunately, I am asking a solution not asking why I want to do so. Finding out why you want to do something helps us to understand your problem, and perhaps even propose a solution that you hadn't considered.
John
|
|
|
|
|
SSC-Insane
         
Group: General Forum Members
Last Login: Today @ 12:02 AM
Points: 21,596,
Visits: 27,415
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 5:36 PM
Points: 135,
Visits: 410
|
|
Unused space returned by sps_spaceused will almost never be zero. BOL says: Total amount of space reserved for objects in the database, but not yet used.
This is extents or pages that have been allocated to an objects but are not completely full. This is particularly true of extents (8 pages). An extent may be reserved for a given object but may have as many as 7 pages free.
|
|
|
|