![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
At 8:00 am Wed, we started a Shrink Database command (though the SSMS GUI) on a very large and very active database. The activity monitor usually show the process is "suspended" (what does that mean?) although sometimes when I click "Refresh" it says "runnable". |
|
It is now 3:30 pm Thurs, and the Shrink Database is still going on. Should I be worried about this? As I said, it is a large database, with a fair amount of activity, and we recently added a good amount of data, and deleted some unnecessary tables. |
#3
| |||
| |||
|
|
At 8:00 am Wed, we started a Shrink Database command (though the SSMS GUI) on a very large and very active database. The activity monitor usually show the process is "suspended" (what does that mean?) although sometimes when I click "Refresh" it says "runnable". It is now 3:30 pm Thurs, and the Shrink Database is still going on. Should I be worried about this? As I said, it is a large database, with a fair amount of activity, and we recently added a good amount of data, and deleted some unnecessary tables. |
#4
| |||
| |||
|
|
( { index_or_statistics_name } [ ,...n ] ) } |
|
SAMPLE number { PERCENT | ROWS } ] RESAMPLE update_stats_stream_option> [ ,...n ] ] |
#5
| |||
| |||
|
|
If the state is in suspended, you need to identify on what is the spid orsession waiting on. You can do that by running the dmv select * from sys.dm_os_wait_stats order by wait_time_ms desc. select * from sys.dm_os_waiting_tasks where session_id ='user session no' Once have the information you can compare the session waits with server waits. To check how much of shrink of database is complete, you can use the query Select percent_complete from sys.dm_exec_requests where session_id= 'your session id' The shrinking of database causes fragemtation , you need to update the statistics of the database once the shrink is complete. the following command calls sp_updatestats to update all statistics for the database. *EXEC sp_updatestats for table or index UPDATE STATISTICS table_or_indexed_view_name * * [ * * * * { * * * * * * { index_or_statistics__name } * * * * * | ( { index_or_statistics_name } [ ,...n ] ) * * * * * * * * } * * ] * * [ * *WITH * * * * [ * * * * * * [ FULLSCAN ] * * * * * * | SAMPLE number { PERCENT | ROWS } ] * * * * * * | RESAMPLE * * * * * * | <update_stats_stream_option> [ ,...n ] * * * * ] * * * * [ [ , ] [ ALL | COLUMNS | INDEX ] * * * * [ [ , ] NORECOMPUTE ] |
![]() |
| Thread Tools | |
| Display Modes | |
| |