Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #148
| From | ravi p <zygonr@airtel.blackberry.com> |
|---|---|
| Subject | Re: Shrink Database problem!!! |
| Newsgroups | comp.databases.ms-sqlserver |
| References | <326ccf75-9f52-4e98-8b88-deb9f63fd7d8@s9g2000yqm.googlegroups.com> |
| Message-ID | <20114824351usenet@terrranews.com> (permalink) |
| Organization | TeraNews.com |
| Date | 2011-04-08 06:44 +0000 |
If the state is in suspended, you need to identify on what is the spid or session 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 ]
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Shrink Database problem!!! Dom <dolivastro@gmail.com> - 2011-04-07 12:23 -0700
Re: Shrink Database problem!!! Gene Wirchenko <genew@ocis.net> - 2011-04-07 14:07 -0700
Re: Shrink Database problem!!! Erland Sommarskog <esquel@sommarskog.se> - 2011-04-07 23:32 +0200
Re: Shrink Database problem!!! ravi p <zygonr@airtel.blackberry.com> - 2011-04-08 06:44 +0000
Re: Shrink Database problem!!! Dom <dolivastro@gmail.com> - 2011-04-08 07:26 -0700
csiph-web