This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --from http://sqlblog.com/blogs/john_paul_cook/archive/2009/08/24/using-the-processes-query-outside-of-activity-monitor.aspx | |
| /* ACTIVITY MONITOR */ | |
| /* Processes */ | |
| SELECT | |
| [Session ID] = s.session_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT creation_time | |
| ,last_execution_time | |
| ,total_physical_reads | |
| ,total_logical_reads | |
| ,total_logical_writes | |
| , execution_count | |
| , total_worker_time | |
| , total_elapsed_time | |
| , total_elapsed_time / execution_count avg_elapsed_time | |
| ,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET NOCOUNT ON; | |
| DECLARE @tablename varchar(255); | |
| DECLARE @execstr varchar(400); | |
| DECLARE @objectid int; | |
| DECLARE @indexid int; | |
| DECLARE @frag decimal; | |
| DECLARE @maxfrag decimal; | |
| -- Decide on the maximum fragmentation to allow for. | |
| SELECT @maxfrag = 30.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exec sp_configure | |
| SELECT | |
| ( CASE WHEN ( [is_modified] = 1 ) THEN 'Dirty' ELSE 'Clean' END ) AS 'Page State' , | |
| ( CASE WHEN ( [database_id] = 32767 ) THEN 'Resource Database' ELSE DB_NAME ( database_id ) END ) AS 'Database Name' , | |
| COUNT (*) AS 'Page Count' | |
| FROM sys . dm_os_buffer_descriptors | |
| GROUP BY [database_id] , [is_modified] | |
| ORDER BY [database_id] , [is_modified] ; | |
| GO |
NewerOlder