Database | Proc | Application | Created | Links |
sybsystemprocs | sp_monitor_help ![]() | ![]() | 31 Aug 14 | Defects Dependencies |
1 2 /* 3 ** This stored procedure is a subordinate stored procedure that is invoked by 4 ** the parent stored procedure sp_monitor when "help" is passed as the 5 ** argument. This stored procedure provides help related information pertaining 6 ** to all the parameters to sp_monitor. 7 ** The procedure provides Usage and Example information for each of the options 8 ** supported by sp_monitor. If "help" is sought without any additional parameter 9 ** then all the options are listed with examples. 10 ** 11 ** User can invoke the 'help' facility in one of two ways: 12 ** 13 ** sp_monitor 'help' 14 ** 15 ** This will produce 1st level of help information for each type of 16 ** entity that can be monitored. 17 ** 18 ** sp_monitor 'help', 'deadlock' ['deadlock' is only an example.] 19 ** 20 ** This produces a bit more detailed help information for the entity 21 ** being monitored. Currently, only few commands have extensive 22 ** help information built-in, which is produced under this usage. 23 ** 24 ** Parameters: 25 ** @cmdtype - The specific command for which help is required. 26 ** @listall - Indicate if help is required for all commands. 27 ** 0 : Brief info on each command 28 ** 1 : Verbose info on specific command 29 ** 2 : Verbose info on all commands 30 ** 31 ** Returns: 32 ** 0 - upon sucessful completion 33 { 34 */ 35 create procedure sp_monitor_help( 36 @cmdtype varchar(30) = NULL 37 , @listall int 38 ) as 39 begin 40 declare @sqlmsg varchar(255) -- varchar so as to truncate trailing blanks 41 , @monprocname varchar(256) 42 , @validcmd_names varchar(256) 43 44 -- Reuse variable to build list of monitoring types allowed. 45 -- 46 select @validcmd_names = "'enable' | 'disable' | 'connection' | 'procedure' | 'statement' | 'event' | 'deadlock' | 'procstack' | 'archive' | 'report'" 47 48 exec sp_getmessage 19263, @sqlmsg output 49 50 -- Fix this when @msg_19263 is updated in a major release. 51 select @sqlmsg = "Usage: %1! %2!" 52 53 if (@listall != 0) 54 begin 55 -- Show the possible optional arguments in help info. 56 select @monprocname = "[ " + @validcmd_names + " [, ...] ] " 57 print @sqlmsg, "sp_monitor", @monprocname 58 end 59 60 -- Show the syntax for the basic help command. 61 -- 62 if (@cmdtype = "HELP" OR @listall != 0) 63 begin 64 select @monprocname = "help " + "[, " + @validcmd_names + "]" 65 print @sqlmsg, "sp_monitor", @monprocname 66 print @sqlmsg, "sp_monitor", "help, 'all'" 67 end 68 69 if (@cmdtype = "CONNECTION" OR @listall != 0) 70 begin 71 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 72 , @monprocname = "sybsystemprocs.dbo.sp_monitor_connection_usage" 73 exec @monprocname @sqlmsg 74 end 75 if (@cmdtype = "EVENT" OR @listall != 0) 76 begin 77 print " " 78 exec sp_getmessage 19266, @sqlmsg output 79 print @sqlmsg 80 exec sp_getmessage 19267, @sqlmsg output 81 print @sqlmsg 82 end 83 84 if (@cmdtype = "PROCEDURE" OR @listall != 0) 85 begin 86 print " " 87 exec sp_getmessage 19268, @sqlmsg output 88 print @sqlmsg 89 exec sp_getmessage 19269, @sqlmsg output 90 print @sqlmsg 91 exec sp_getmessage 19280, @sqlmsg output 92 print @sqlmsg 93 exec sp_getmessage 19281, @sqlmsg output 94 print @sqlmsg 95 exec sp_getmessage 19282, @sqlmsg output 96 print @sqlmsg 97 end 98 99 if (@cmdtype = "ENABLE" OR @listall != 0) 100 begin 101 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 102 , @monprocname = "sybsystemprocs.dbo.sp_monitor_enable_usage" 103 exec @monprocname @sqlmsg, @validcmd_names 104 end 105 106 if (@cmdtype = "DISABLE" OR @listall != 0) 107 begin 108 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 109 , @monprocname = "sybsystemprocs.dbo.sp_monitor_disable_usage" 110 exec @monprocname @sqlmsg, @validcmd_names 111 end 112 113 if (@cmdtype = "STATEMENT" OR @listall != 0) 114 begin 115 print " " 116 exec sp_getmessage 19274, @sqlmsg output 117 print @sqlmsg 118 exec sp_getmessage 19275, @sqlmsg output 119 print @sqlmsg 120 end 121 122 select @sqlmsg = case @listall when 1 then 'terse' else 'verbose' end 123 124 if (@cmdtype = "DEADLOCK" OR @listall != 0) 125 begin 126 select @monprocname = "sybsystemprocs.dbo.sp_monitor_deadlock" 127 exec @monprocname 'help', @sqlmsg 128 end 129 130 if (@cmdtype = "PROCSTACK" OR @listall != 0) 131 begin 132 select @monprocname = "sybsystemprocs.dbo.sp_monitor_procstack_usage" 133 exec @monprocname @sqlmsg 134 end 135 136 if (@cmdtype = "ARCHIVE" OR @listall != 0) 137 begin 138 select @monprocname = "sybsystemprocs.dbo.sp_monitor_archive_usage" 139 exec @monprocname @sqlmsg 140 end 141 142 if (@cmdtype = "REPORT" OR @listall != 0) 143 begin 144 select @monprocname = "sybsystemprocs.dbo.sp_monitor_report_usage" 145 exec @monprocname @sqlmsg 146 end 147 return (0) 148 end -- } 149
exec sp_procxmode 'sp_monitor_help', 'AnyMode' go Grant Execute on sp_monitor_help to public go
DEFECTS | |
![]() | 103 |
![]() | 110 |
![]() | 127 |
![]() | 73 |
![]() | 103 |
![]() | 103 |
![]() | 110 |
![]() | 110 |
![]() | 127 |
![]() | 127 |
![]() | 133 |
![]() | 133 |
![]() | 133 |
![]() | 139 |
![]() | 139 |
![]() | 139 |
![]() | 145 |
![]() | 145 |
![]() | 145 |
![]() | |
![]() | 48 |
![]() | 78 |
![]() | 80 |
![]() | 87 |
![]() | 89 |
![]() | 91 |
![]() | 93 |
![]() | 95 |
![]() | 116 |
![]() | 118 |
![]() | 35 |
![]() | 39 |
![]() | 53 |
![]() | 62 |
![]() | 69 |
![]() | 75 |
![]() | 84 |
![]() | 99 |
![]() | 106 |
![]() | 113 |
![]() | 124 |
![]() | 130 |
![]() | 136 |
![]() | 142 |
![]() | 147 |
![]() | 0 |
![]() | 0 |
![]() | 0 |
![]() | 0 |
![]() | 0 |
![]() | 0 |
![]() | 0 |
![]() | 73 |
![]() | 103 |
![]() | 110 |
![]() | 127 |
![]() | 133 |
![]() | 139 |
![]() | 145 |
![]() | 35 |
![]() | 35 |
![]() | 35 |
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..sp_getmessage ![]() reads table sybsystemprocs..sysusermessages ![]() reads table master..sysmessages (1) ![]() reads table master..syslanguages (1) ![]() calls proc sybsystemprocs..sp_validlang ![]() reads table master..syslanguages (1) ![]() |