DatabaseProcApplicationCreatedLinks
sybsystemprocssp_help_rep_agent  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** Messages for "sp_help_rep_agent"	18425
4     **
5     ** 17421, "No such database -- run sp_helpdb to list databases."
6     ** 18374, "Database '%1!' is not configured to use Replication Agent. Run sp_config_rep_agent without parameters to see a list of databases that use Replication Agent. Use the ENABLE option of sp_config_rep_agent to configure a database to use this feature."
7     ** 18375, "You are not authorized to execute this stored procedure. Only the System Administrator (SA), the Database Owner (DBO) or a user with replication_role authorization can execute this stored procedure."
8     ** 18425, "Incorrect syntax for sp_help_rep_agent. Usage: sp_help_rep_agent [ [,{recovery | process | config | scan | scan_verbose| security | send | all } ] ]."
9     */
10    create or replace procedure sp_help_rep_agent
11        @dbname varchar(30) = NULL, /* database name - optional */
12        @whattoprint varchar(30) = NULL /* what properties to print */
13    as
14    
15        declare @dbid int /* dbid of the database */
16        declare @dbuid int /* id of the owner of the database */
17        declare @msg varchar(250)
18        declare @sptlang int
19        declare @procval int
20        declare @type int /* Type of the config. parameter */
21        declare @dbstatus3 int /* Database's status3		   */
22        declare @skip_status int /* Holds db status to be skipped
23        ** from the sysdatabases select    */
24        declare @tempdb_mask int /* Mask indicating this is a
25        ** temporary database 		   */
26        declare @multiple_scanners varchar(5) /* multiple scanners true/false */
27        declare @num_multithread_rat int /* Number of databases running in 
28        ** multithread mode.               */
29        declare @num_multiscanner_rat int /* Number of databases running in 
30        ** multiple scanner mode.          */
31        declare @num_tpm_rat int /* Number of databases running with
32        ** CI STPM task 		   */
33    
34        declare @dummy int
35        declare @nullarg char(1)
36        declare @gp_enabled int
37        declare @stream_repl_enabled varchar(5)
38        declare @enable_state varchar(8) /* enabled/disabled text */
39        declare @status1 int
40        declare @status2 int
41    
42        select @status1 = 1
43        select @status2 = 1
44        select @stream_repl_enabled = "false"
45    
46        if @@trancount = 0
47        begin
48            set chained off
49        end
50    
51        set transaction isolation level 1
52    
53        /* Turn rowcounting off. */
54        set nocount on
55        /*
56        ** Initialize the variable with the status to be skipped from the
57        ** select from sysdatabases:
58        **
59        **      status3 = 8    : Database is being shutdown
60        **      status3 = 4096 : Shutdown of the database is complete
61        */
62        select @skip_status = 8 | 4096
63        select @tempdb_mask = number
64        from master.dbo.spt_values
65        where type = "D3" and name = "TEMPDB STATUS MASK"
66    
67        select @skip_status = @skip_status | @tempdb_mask
68    
69        select @sptlang = @@langid
70    
71        if @@langid != 0
72        begin
73            if not exists (
74                    select * from master.dbo.sysmessages where error
75                        between 17050 and 17069
76                        and langid = @@langid)
77                select @sptlang = 0
78        end
79    
80        if (@dbname is not NULL)
81        begin
82            /*
83            **  Verify the database name and get the @dbid and @dbuid
84            */
85            select @dbid = dbid, @dbuid = suid, @dbstatus3 = status3
86            from master.dbo.sysdatabases
87            where name = @dbname
88    
89            /*
90            **  If @dbname not found, say so and list the databases.
91            */
92            if @dbid is NULL
93            begin
94                /*
95                ** 17421, "No such database -- run sp_helpdb to list databases."
96                */
97                raiserror 17421
98                return (1)
99            end
100   
101           /*
102           ** Verify that this database is not being shutdown, or the shutdown
103           ** is complete after a HA takeover.
104           **	status3 = 8    : Database is being shutdown
105           **	status3 = 4096 : Shutdown of the database is complete
106           ** or it is a temporary database.
107           */
108           if (((@dbstatus3 & 8) = 8) or
109                   ((@dbstatus3 & 4096) = 4096) or
110                   ((@dbstatus3 & @tempdb_mask != 0)) or (@dbid = 2))
111           begin
112               raiserror 18374, @dbname
113               return (1)
114           end
115   
116           select @stream_repl_enabled =
117               convert(varchar(5),
118               rep_agent_config(@dbid,
119                   "current config",
120                   "stream replication"))
121       end
122   
123       /*
124       **  If granular permissions is not enabled, 
125       **  Accounts with SA or replication role can execute it, 
126       **  and it can also be executed for a specific database by the DBO.
127       **  If granular permissions is enabled then users with 
128       **  'monitor server replication' permission can execute it, 
129       **  and it can also be executed for a specific database by users 
130       **  with 'manage replication' permission.
131       */
132       select @nullarg = NULL
133   
134       execute @status1 = sp_aux_checkroleperm "sa_role", "monitor server replication",
135           @nullarg, @gp_enabled output
136   
137       execute @status2 = sp_aux_checkroleperm "replication_role",
138           "manage replication", @dbname, @gp_enabled output
139   
140       if (@gp_enabled = 0)
141       begin --{
142           /*
143           **  Only the Database Owner (DBO) or
144           **  Accounts with SA role or replication role can execute it.
145           **  First check if we are the DBO if the database name is specified.
146           */
147           if (@dbname is NULL) or (suser_id() != @dbuid)
148           begin
149               /* Check if we have sa_role or replication_role. */
150               if ((@status1 != 0) and (@status2 != 0))
151               begin
152                   /*
153                   ** Audit failure. This will result in three messages, 
154                   ** but we will live with that until there is a 
155                   ** better 'proc_role()' interface.
156                   */
157                   select @procval = proc_role("sa_role")
158                   select @procval = proc_role("replication_role")
159   
160                   /* 18375, "You are not authorized to execute this 
161                   ** stored procedure. Only the System Administrator (SA),
162                   **  the Database Owner (DBO) or a user with 
163                   ** replication_role authorization can execute this 
164                   ** stored procedure."
165                   */
166                   raiserror 18375
167                   return (1)
168               end
169           end
170   
171           /* Audit success(es) */
172           if (@status1 = 0)
173               select @procval = proc_role("sa_role")
174           if (@status2 = 0)
175               select @procval = proc_role("replication_role")
176       end --}
177       else
178       begin --{
179           if (@dbname is not NULL)
180           begin
181               if (@status1 != 0 and @status2 != 0)
182               begin
183                   select @dummy = proc_auditperm("manage replication",
184                           @status2, @dbname)
185                   select @dummy = proc_auditperm(
186                           "monitor server replication", @status1)
187                   return 1
188               end
189           end
190           else
191           begin
192               if (@status1 != 0)
193               begin
194                   select @dummy = proc_auditperm(
195                           "monitor server replication", @status1)
196                   return 1
197               end
198           end
199   
200           if (@status1 = 0)
201               select @dummy = proc_auditperm("monitor server replication",
202                       @status1, @dbname)
203           if ((@dbname is not NULL) and (@status2 = 0))
204               select @dummy = proc_auditperm("manage replication", @status2,
205                       @dbname)
206       end --}
207   
208       /* Verify that the database has the Rep Agent property enabled. */
209       if (@dbname is not NULL) and (is_rep_agent_enabled(@dbid) = 0)
210       begin
211           /* 18374, "Database '%1!' is not configured to use Replication Agent.
212           ** Run sp_config_rep_agent without parameters to see a list of
213           ** databases that use Replication Agent. Use the ENABLE option of
214           ** sp_config_rep_agent to configure a database to use this feature."
215           */
216           raiserror 18374, @dbname
217           return (1)
218       end
219   
220       /* Validate @whattoprint */
221   
222       if @whattoprint is not NULL and
223           not (@whattoprint in ("recovery", "config", "scan", "scan_verbose", "process", "security", "send", "all"))
224       begin
225           /* 18425, "Incorrect syntax for sp_help_rep_agent. Usage:
226           ** sp_help_rep_agent [ [,{recovery | process | config |
227           ** scan | scan_verbose | security | send | all } ] ]."
228           */
229           raiserror 18425
230           return (1)
231       end
232   
233       /*
234       ** If we have 'stream replication' enabled the following db specific
235       ** options are not supported: recovery, send
236       */
237       if ((@stream_repl_enabled = "true") and
238               (@whattoprint in ("recovery", "send")))
239       begin
240           /*
241           ** 17225 - "The '%1!' option is not supported when '%2!' is %3!."
242           ** @msg is the format string passed to print
243           */
244           exec sp_getmessage 19247, @enable_state output
245           raiserror 17225, @whattoprint, 'stream replication', @enable_state
246           return (1)
247       end
248   
249       /* If no category is specified, then print all categories */
250       if (@whattoprint is NULL)
251       begin
252           select @whattoprint = "all"
253       end
254   
255   
256   
257       if (@whattoprint in ("recovery", "all"))
258       begin
259           /* RESOLVE --chr: Do we want to suppress this header if we are only showing
260           ** a stream replication database since there is no recovery information ? */
261           print "Replication Agent Recovery Status"
262           if @dbname is not NULL
263           begin --{
264               /*
265               ** Only print recovery information for the specified
266               ** database if 'stream replication' is not enabled.
267               */
268               if (@stream_repl_enabled = "false")
269               begin --{
270                   /* For a given database */
271   
272                   if (is_multithread_rep_agent(@dbid) = 1)
273                   begin --{
274                       /* 'select into' the recovery information into a temp table */
275                       select distinct "dbname" = @dbname,
276                           "pathname" = send.PathName,
277                           "connect_dataserver" = send.Dataserver,
278                           "connect_database" = scan.DBName,
279                           "status" = scan.Status,
280                           "log_recs_scanned" = scan.LogRecordsScanned
281                       into #help_rep_agent_recovery0
282                       from master..monRepScanners scan,
283                           master..monRepSenders send
284                       where scan.DBID = @dbid and
285                           send.DBID = scan.DBID
286   
287                       /* Output and format the content of the	temp table */
288                       exec sp_autoformat #help_rep_agent_recovery0
289   
290                       /* drop the temp table */
291                       drop table #help_rep_agent_recovery0
292                   end --}
293                   else
294                   begin --{
295                       /* 'select into' the recovery information into a temp table */
296                       select "dbname" = @dbname,
297                           "connect_dataserver" = send.Dataserver,
298                           "connect_database" = scan.DBName,
299                           "status" = scan.Status,
300                           "rs_servername" = send.ReplicationServer,
301                           "rs_username" = send.Username
302                       into #help_rep_agent_recovery1
303                       from master..monRepScanners scan,
304                           master..monRepSenders send
305                       where scan.DBID = @dbid and
306                           send.DBID = scan.DBID
307   
308                       /* Output and format the content of the	temp table */
309                       exec sp_autoformat #help_rep_agent_recovery1
310   
311                       /* drop the temp table */
312                       drop table #help_rep_agent_recovery1
313                   end --}
314               end --}
315           end --}
316           else
317           begin
318               /* 'select into' the recovery information into a temp table */
319   
320               select distinct "dbname" = db.name,
321                   "pathname" = send.PathName,
322                   "connect_dataserver" = send.Dataserver,
323                   "connect_database" = scan.DBName,
324                   "status" = scan.Status,
325                   "log_recs_scanned" = scan.LogRecordsScanned,
326                   "rs_servername" = send.ReplicationServer,
327                   "rs_username" = send.Username
328               into #help_rep_agent_recovery2
329               from master.dbo.sysdatabases db,
330                   master..monRepScanners scan,
331                   master..monRepSenders send
332               where 1 = (case when ((db.status3 & @skip_status) = 0)
333                       then is_rep_agent_enabled(db.dbid) else 0
334                   end) and
335                   scan.DBID = db.dbid and
336                   send.DBID = scan.DBID
337   
338               /* Output and format the content of the	temp table */
339               exec sp_autoformat #help_rep_agent_recovery2
340   
341               /* drop the temp table */
342               drop table #help_rep_agent_recovery2
343           end
344       end
345       if (@whattoprint in ("process", "all"))
346       begin
347           if @dbname is not NULL
348           begin
349               /* For a given database */
350               /* 'select into' the process information into a	temp table */
351   
352               select @multiple_scanners =
353                   convert(varchar(5),
354                   rep_agent_config(@dbid,
355                       "current config",
356                       "multiple scanners"))
357               if (@multiple_scanners = "true")
358               begin
359                   /*  We will report Coordinator first */
360                   print "Replication Agent Coordinator Process Status"
361                   select "dbname" = @dbname,
362                       "spid" = coord.SPID,
363                       "sleep_status" = coord.SleepStatus,
364                       "state" = coord.Status
365                   into #help_rep_agent_process6
366                   from master..monRepCoordinator coord
367                   where coord.DBID = @dbid
368   
369                   /* Output and format the content of the	temp table */
370                   exec sp_autoformat #help_rep_agent_process6
371   
372                   /* drop the temp table */
373                   drop table #help_rep_agent_process6
374               end
375               if (is_multithread_rep_agent(@dbid) = 1)
376               begin
377                   /*  Now report scanners */
378                   print "Replication Agent Scanner Process Status"
379                   select "dbname" = @dbname,
380                       "pathname" = scan.PathName,
381                       "scanner_spid" = scan.ScannerSPID,
382                       "start_marker" = scan.StartMarker,
383                       "end_marker" = scan.EndMarker,
384                       "current_marker" = scan.CurrentMarker,
385                       "sleep_status" = scan.SleepStatus,
386                       "state" = scan.Status
387                   into #help_rep_agent_process0
388                   from master..monRepScanners scan
389                   where scan.DBID = @dbid
390   
391                   /* Output and format the content of the	temp table */
392                   exec sp_autoformat #help_rep_agent_process0
393   
394                   /* drop the temp table */
395                   drop table #help_rep_agent_process0
396   
397                   print "Replication Agent Sender Process Status"
398   
399                   /* 'select into' the process information into a	temp table */
400                   select "dbname" = @dbname,
401                       "pathname" = send.PathName,
402                       "sender_spid" = send.SenderSPID,
403                       "sleep_status" = send.SleepStatus,
404                       "state" = send.Status,
405                       "retry_count" = send.NumberOfRetries,
406                       "last_error" = send.LastRepServerError,
407                       "scanner_spid" = send.ScannerSPID
408                   into #help_rep_agent_process2
409                   from master..monRepSenders send
410                   where send.DBID = @dbid
411   
412                   /* Output and format the content of the	temp table */
413                   exec sp_autoformat #help_rep_agent_process2
414   
415                   /* drop the temp table */
416                   drop table #help_rep_agent_process2
417               end
418               else
419               begin
420                   /* For a single task model the scanner is also a sender */
421                   if (@stream_repl_enabled = "false")
422                   begin
423                       /* LTL Replication */
424                       print "Replication Agent Process Status"
425                       select "dbname" = @dbname,
426                           "spid" = scan.ScannerSPID,
427                           "start_marker" = scan.StartMarker,
428                           "end_marker" = scan.EndMarker,
429                           "current_marker" = scan.CurrentMarker,
430                           "sleep_status" = scan.SleepStatus,
431                           "state" = scan.Status,
432                           "retry_count" = send.NumberOfRetries,
433                           "last_error" = send.LastRepServerError
434                       into #help_rep_agent_process1
435                       from master..monRepScanners scan,
436                           master..monRepSenders send
437                       where scan.DBID = @dbid and
438                           send.DBID = scan.DBID and
439                           scan.ScannerSPID = send.SenderSPID
440                       /* Output and format the content of the	temp table */
441                       exec sp_autoformat #help_rep_agent_process1
442   
443                       /* drop the temp table */
444                       drop table #help_rep_agent_process1
445                   end
446                   else
447                   begin
448                       /* CI Lib Replication */
449                       /*  We will report Coordinator first */
450                       print "Replication Agent Coordinator Process Status"
451                       select "dbname" = @dbname,
452                           "spid" = coord.SPID,
453                           "sleep_status" = coord.SleepStatus,
454                           "state" = coord.Status
455                       into #help_rep_agent_process_cic
456                       from master..monRepCoordinator coord
457                       where coord.DBID = @dbid
458   
459                       /* Output and format the content of the	temp table */
460                       exec sp_autoformat #help_rep_agent_process_cic
461   
462                       /* drop the temp table */
463                       drop table #help_rep_agent_process_cic
464   
465                       /*  Scanner process */
466                       print ""
467                       print "Replication Agent Scanner Process Status"
468                       select "dbname" = @dbname,
469                           "spid" = scan.ScannerSPID,
470                           "start_marker" = scan.StartMarker,
471                           "end_marker" = scan.EndMarker,
472                           "current_marker" = scan.CurrentMarker,
473                           "sleep_status" = scan.SleepStatus,
474                           "state" = scan.Status
475                       into #help_rep_agent_process_cis
476                       from master..monRepScanners scan
477                       where scan.DBID = @dbid
478   
479                       /* Output and format the content of the	temp table */
480                       exec sp_autoformat #help_rep_agent_process_cis
481   
482                       /* drop the temp table */
483                       drop table #help_rep_agent_process_cis
484   
485                       /*  STPM process */
486                       print ""
487                       print "Replication Agent Truncation Point Manager Process Status"
488                       select "dbname" = @dbname,
489                           "spid" = tpm.SPID,
490                           "trunc_pts_processed" = tpm.TruncpointsProcessed,
491                           "total_processing_time" = tpm.TotalProcessingTime,
492                           "longest_process_time" = tpm.LongestProcessingTime,
493                           "idle_time" = tpm.IdleTime,
494                           "sleep_status" = tpm.SleepStatus,
495                           "state" = tpm.Status
496                       into #help_rep_agent_process_cit
497                       from master..monRepTruncationPoint tpm
498                       where tpm.DBID = @dbid
499   
500                       /* Output and format the content of the	temp table */
501                       exec sp_autoformat #help_rep_agent_process_cit
502   
503                       /* drop the temp table */
504                       drop table #help_rep_agent_process_cit
505                   end
506               end
507           end
508           else
509           begin
510               print "Replication Agent Process Status"
511   
512               /*  We will report Coordinators if any */
513               select "dbname" = db.name,
514                   "spid" = convert(varchar(11), coord.SPID),
515                   "sleep_status" = coord.SleepStatus,
516                   "state" = coord.Status
517               into #help_rep_agent_process5
518               from master.dbo.sysdatabases db,
519                   master..monRepCoordinator coord
520               where 1 = (case when ((db.status3 & @skip_status) = 0)
521                       then is_rep_agent_enabled(db.dbid) else 0
522                   end) and
523                   coord.DBID = db.dbid
524   
525               select @num_multiscanner_rat = count(*) from #help_rep_agent_process5
526   
527               /* Display, if any database is running multiple scanner Rep Agent */
528               if (@num_multiscanner_rat > 0)
529               begin
530                   print "Replication Agent Coordinator Process Status"
531   
532                   /* Output and format the content of the	temp table */
533                   exec sp_autoformat #help_rep_agent_process5
534   
535               end
536   
537               /* drop the temp table */
538               drop table #help_rep_agent_process5
539   
540               /* We will always have at least 1 scanner if a RepAgent is running */
541               print "Replication Agent Scanner Process Status"
542               select "dbname" = db.name,
543                   "pathname" = scan.PathName,
544                   "scanner_spid" = scan.ScannerSPID,
545                   "start_marker" = scan.StartMarker,
546                   "end_marker" = scan.EndMarker,
547                   "current_marker" = scan.CurrentMarker,
548                   "sleep_status" = scan.SleepStatus,
549                   "state" = scan.Status
550               into #help_rep_agent_process3
551               from master.dbo.sysdatabases db,
552                   master..monRepScanners scan
553               where 1 = (case when ((db.status3 & @skip_status) = 0)
554                       then is_rep_agent_enabled(db.dbid) else 0
555                   end) and
556                   scan.DBID = db.dbid
557   
558               /* Output and format the content of the	temp table */
559               exec sp_autoformat #help_rep_agent_process3
560   
561               /* drop the temp table */
562               drop table #help_rep_agent_process3
563   
564               /*  We will report multiple rows when more senders are running */
565   
566               /* 'select into' the process information into a	temp table */
567               select "dbname" = name,
568                   "pathname" = send.PathName,
569                   "sender_spid" = send.SenderSPID,
570                   "total_send_buffers" = send.MessageQueueSize,
571                   "send_buffers_used" = send.MessagesInQueue,
572                   "sleep_status" = send.SleepStatus,
573                   "retry_count" = send.NumberOfRetries,
574                   "last_error" = send.LastRepServerError,
575                   "scanner_spid" = send.ScannerSPID
576               into #help_rep_agent_process4
577               from master.dbo.sysdatabases db,
578                   master..monRepSenders send
579               where 1 = (case when ((db.status3 & @skip_status) = 0)
580                       then (case when ((is_rep_agent_enabled(db.dbid) = 1) and
581                                   (is_multithread_rep_agent(db.dbid) = 1))
582                           then 1
583                           else 0
584                       end)
585                       else 0
586                   end) and
587                   send.DBID = db.dbid
588   
589               select @num_multithread_rat = count(*) from #help_rep_agent_process4
590   
591               /* Display, if more than one database running multithread Rep Agent */
592               if (@num_multithread_rat > 0)
593               begin
594                   print "Replication Agent Sender Process Status"
595   
596                   /* Output and format the content of the	temp table */
597                   exec sp_autoformat #help_rep_agent_process4
598   
599               end
600   
601               /* drop the temp table */
602               drop table #help_rep_agent_process4
603               /*  STPM process */
604               print "Replication Agent Truncation Point Manager Process Status"
605               select "dbname" = name,
606                   "spid" = tpm.SPID,
607                   "trunc_pts_processed" = tpm.TruncpointsProcessed,
608                   "total_processing_time" = tpm.TotalProcessingTime,
609                   "longest_process_time" = tpm.LongestProcessingTime,
610                   "idle_time" = tpm.IdleTime,
611                   "sleep_status" = tpm.SleepStatus,
612                   "state" = tpm.Status
613               into #help_rep_agent_process7
614               from master.dbo.sysdatabases db,
615                   master..monRepTruncationPoint tpm
616               where 1 = (case when ((db.status3 & @skip_status) = 0)
617                       then is_rep_agent_enabled(db.dbid) else 0
618                   end) and
619                   tpm.DBID = db.dbid
620   
621               select @num_tpm_rat = count(*) from #help_rep_agent_process7
622               if (@num_tpm_rat > 0)
623               begin
624                   /* Output and format the content of the	temp table */
625                   exec sp_autoformat #help_rep_agent_process7
626               end
627               drop table #help_rep_agent_process7
628           end
629       end
630       if (@whattoprint in ("scan", "all"))
631       begin
632           if @dbname is not NULL
633           begin
634               /* For a given database	*/
635               print "Replication Agent Scan Status"
636   
637               /* 'select into' the scan information into a temp table	*/
638               select "dbname" = @dbname,
639                   "pathname" = scan.PathName,
640                   "scanner_spid" = scan.ScannerSPID,
641                   "start_marker" = scan.StartMarker,
642                   "end_marker" = scan.EndMarker,
643                   "current_marker" = scan.CurrentMarker,
644                   "log_recs_scanned" = scan.LogRecordsScanned,
645                   "oldest_transaction" = scan.OldestTransaction
646               into #help_rep_agent_scan1
647               from master..monRepScanners scan
648               where scan.DBID = @dbid
649   
650               /* Output and format the content of the	temp table */
651               exec sp_autoformat #help_rep_agent_scan1
652   
653               /* drop the temp table */
654               drop table #help_rep_agent_scan1
655           end
656           else
657           begin
658               print ""
659               print "Replication Agent Scan Status"
660               /* 'select into' the scan information into a temp table	*/
661               select "dbname" = db.name,
662                   "pathname" = scan.PathName,
663                   "scanner_spid" = scan.ScannerSPID,
664                   "start_marker" = scan.StartMarker,
665                   "end_marker" = scan.EndMarker,
666                   "current_marker" = scan.CurrentMarker,
667                   "log_recs_scanned" = scan.LogRecordsScanned,
668                   "oldest_transaction" = scan.OldestTransaction
669               into #help_rep_agent_scan2
670               from master..monRepScanners scan,
671                   master.dbo.sysdatabases db
672               where 1 = (case when ((db.status3 & @skip_status) = 0)
673                       then is_rep_agent_enabled(db.dbid) else 0
674                   end) and
675                   scan.DBID = db.dbid
676   
677               /* Output and format the content of the	temp table */
678               exec sp_autoformat #help_rep_agent_scan2
679   
680               /* drop the temp table */
681               drop table #help_rep_agent_scan2
682           end
683       end
684       if (@whattoprint = "scan_verbose")
685       begin
686           if @dbname is not NULL
687           begin
688               /* For a given database	*/
689               print "Replication Agent Scan Status"
690   
691               /* 'select into' the scan information into a temp table	*/
692               select "dbname" = @dbname,
693                   "pathname" = scan.PathName,
694                   "scanner_spid" = scan.ScannerSPID,
695                   "start_marker" = scan.StartMarker,
696                   "end_marker" = scan.EndMarker,
697                   "current_marker" = scan.CurrentMarker,
698                   "log_pages_left" = scan.LogPagesLeft,
699                   "log_recs_scanned" = scan.LogRecordsScanned,
700                   "oldest_transaction" = scan.OldestTransaction
701               into #help_rep_agent_scan3
702               from master..monRepScanners scan
703               where scan.DBID = @dbid and
704                   scan.GetLogPageCount = 1
705   
706               /* Output and format the content of the	temp table */
707               exec sp_autoformat #help_rep_agent_scan3
708   
709               /* drop the temp table */
710               drop table #help_rep_agent_scan3
711           end
712           else
713           begin
714               print ""
715               print "Replication Agent Scan Status"
716               /* 'select into' the scan information into a temp table	*/
717               select "dbname" = db.name,
718                   "pathname" = scan.PathName,
719                   "scanner_spid" = scan.ScannerSPID,
720                   "start_marker" = scan.StartMarker,
721                   "end_marker" = scan.EndMarker,
722                   "current_marker" = scan.CurrentMarker,
723                   "log_pages_left" = scan.LogPagesLeft,
724                   "log_recs_scanned" = scan.LogRecordsScanned,
725                   "oldest_transaction" = scan.OldestTransaction
726               into #help_rep_agent_scan4
727               from master..monRepScanners scan,
728                   master.dbo.sysdatabases db
729               where 1 = (case when ((db.status3 & @skip_status) = 0)
730                       then is_rep_agent_enabled(db.dbid) else 0
731                   end) and
732                   scan.DBID = db.dbid and
733                   scan.GetLogPageCount = 1
734   
735               /* Output and format the content of the	temp table */
736               exec sp_autoformat #help_rep_agent_scan4
737   
738               /* drop the temp table */
739               drop table #help_rep_agent_scan4
740           end
741       end
742       if (@whattoprint in ("config", "all"))
743       begin
744           print "Replication Agent Configuration"
745           if @dbname is not NULL
746           begin
747               /* For a given database */
748   
749               /* 'select into' the config information	into a temp table */
750               select "dbname" = @dbname,
751                   "auto_start" = rep_agent_config(@dbid, "config", "auto start"),
752                   "rs_servername" = convert(varchar(30), rep_agent_config(@dbid, "config", "rs servername")),
753                   "rs_username" = convert(varchar(30), rep_agent_config(@dbid, "config", "rs username")),
754                   "connect_dataserver" = convert(varchar(30), rep_agent_config(@dbid, "recovery", "connect dataserver")),
755                   "connect_database" = convert(varchar(30), rep_agent_config(@dbid, "recovery", "connect database")),
756                   "scan_batch_size" = convert(varchar(11), rep_agent_config(@dbid, "config", "scan batch size")),
757                   "scan_timeout" = convert(varchar(11), rep_agent_config(@dbid, "config", "scan timeout")),
758                   "retry_timeout" = convert(varchar(11), rep_agent_config(@dbid, "config", "retry timeout")),
759                   "skip_ltl_errors" = convert(varchar(5), rep_agent_config(@dbid, "config", "skip ltl errors")),
760                   "batch_ltl" = convert(varchar(5), rep_agent_config(@dbid, "config", "batch ltl")),
761                   "send_warm_standby_xacts" = convert(varchar(5), rep_agent_config(@dbid, "config", "send warm standby xacts")),
762                   "send_maint_xacts_to_replicate" = convert(varchar(5), rep_agent_config(@dbid, "config", "send maint xacts to replicate")),
763                   "ha_failover" = convert(varchar(5), rep_agent_config(@dbid, "config", "ha failover")),
764                   "skip_unsupported_features" = convert(varchar(5), rep_agent_config(@dbid, "config", "skip unsupported features")),
765                   "short_ltl_keywords" = convert(varchar(5), rep_agent_config(@dbid, "config", "short ltl keywords")),
766                   "send_buffer_size" = convert(varchar(11), rep_agent_config(@dbid, "config", "send buffer size")),
767                   "priority" = convert(varchar(11), rep_agent_config(@dbid, "config", "priority")),
768                   "send_structured_oqids" = rep_agent_config(@dbid, "config", "send structured oqids"),
769                   "data_limits_filter_mode" = rep_agent_config(@dbid, "config", "data limits filter mode"),
770                   "startup_delay" = convert(varchar(11), rep_agent_config(@dbid, "config", "startup delay")),
771                   "bind_to_engine" = rep_agent_config(@dbid, "config", "bind to engine"),
772                   "ltl_batch_size" = convert(varchar(11), rep_agent_config(@dbid, "config", "ltl batch size"))
773   
774   
775                   , "multithread_rep_agent" = convert(varchar(5), rep_agent_config(@dbid, "config", "multithread rep agent"))
776                   , "number_of_send_buffers" = convert(varchar(11), rep_agent_config(@dbid, "config", "number of send buffers"))
777                   , "max_number_of_replication_paths" = convert(varchar(11), rep_agent_config(@dbid, "config", "max number replication paths"))
778                   , "multipath_distribution_model" = convert(varchar(11), rep_agent_config(@dbid, "config", "multipath distribution model"))
779                   , "multiple_scanners" = convert(varchar(5), rep_agent_config(@dbid, "config", "multiple scanners"))
780                   , "max_schema_cache_per_scanner" = convert(varchar(11), rep_agent_config(@dbid, "config", "max schema cache per scanner"))
781                   , "trunc_point_request_interval" = convert(varchar(11), rep_agent_config(@dbid, "config", "trunc point request interval"))
782                   , "ltl_metadata_reduction" = convert(varchar(5), rep_agent_config(@dbid, "config", "ltl metadata reduction"))
783                   , "activate_monitoring" = convert(varchar(5), rep_agent_config(@dbid, "config", "activate monitoring"))
784                   , "ddl_path_for_unbound_objects" = convert(varchar(5), rep_agent_config(@dbid, "config", "ddl path for unbound objects"))
785                   , "stream_replication" = convert(varchar(5), rep_agent_config(@dbid, "config", "stream replication"))
786                   , "stream_mode" = rep_agent_config(@dbid, "config", "stream mode")
787                   , "max_stream_retry" = convert(varchar(11), rep_agent_config(@dbid, "config", "max stream retry"))
788                   , "buffer_pool_size" = convert(varchar(11), rep_agent_config(@dbid, "config", "buffer pool size"))
789                   , "stream_buffer_size" = convert(varchar(11), rep_agent_config(@dbid, "config", "stream buffer size"))
790                   , "max_commit_wait" = convert(varchar(11), rep_agent_config(@dbid, "config", "max commit wait"))
791   
792               into #help_rep_agent_config1
793   
794               /* Output and format the content of the	temp table */
795               exec sp_autoformat #help_rep_agent_config1
796   
797               /* drop the temp table */
798               drop table #help_rep_agent_config1
799   
800           end
801           else
802           begin
803   
804               /* 'select into' the config information	into a temp table */
805               select "dbname" = name,
806                   "auto_start" = rep_agent_config(dbid, "config", "auto start")
807                   , "multithread_rep_agent" = convert(varchar(5), rep_agent_config(dbid, "config", "multithread rep agent"))
808                   , "number_of_send_buffers" = convert(varchar(11), rep_agent_config(dbid, "config", "number of send buffers"))
809                   , "max_number_of_replication_paths" = convert(varchar(11), rep_agent_config(dbid, "config", "max number replication paths"))
810                   , "multipath_distribution_model" = convert(varchar(11), rep_agent_config(dbid, "config", "multipath distribution model"))
811                   , "multiple_scanners" = convert(varchar(5), rep_agent_config(dbid, "config", "multiple scanners"))
812                   , "max_schema_cache_per_scanner" = convert(varchar(11), rep_agent_config(dbid, "config", "max schema cache per scanner"))
813                   , "trunc_point_request_interval" = convert(varchar(11), rep_agent_config(dbid, "config", "trunc point request interval"))
814                   , "ltl_metadata_reduction" = convert(varchar(5), rep_agent_config(dbid, "config", "ltl metadata reduction"))
815                   , "activate_monitoring" = convert(varchar(5), rep_agent_config(dbid, "config", "activate monitoring"))
816                   , "ddl_path_for_unbound_objects" = convert(varchar(5), rep_agent_config(dbid, "config", "ddl path for unbound objects"))
817                   , "stream_replication" = convert(varchar(5), rep_agent_config(dbid, "config", "stream replication"))
818                   , "stream_mode" = rep_agent_config(dbid, "config", "stream mode")
819   
820               into #help_rep_agent_config2
821               from master.dbo.sysdatabases as sysdb
822               where 1 = (case when ((status3 & @skip_status) = 0)
823                       then is_rep_agent_enabled(dbid) else 0
824                   end)
825   
826               /* Output and format the content of the	temp table */
827               exec sp_autoformat #help_rep_agent_config2
828   
829               /* drop the temp table */
830               drop table #help_rep_agent_config2
831   
832           end
833       end
834       /* If category is "security", or "all" */
835       if (@whattoprint in ("security", "all"))
836       begin
837           /* Print the title, and set the category. */
838           print "Replication Agent Security Configuration"
839   
840           /* If dbname was specified, do specified database. */
841           if @dbname is not NULL
842           begin
843               /* Retrieve the information requested. */
844               select "dbname" = @dbname,
845                   "security_mechanism" =
846                   rep_agent_config(@dbid, "security",
847                       "security mechanism"),
848                   "unified_login" =
849                   convert(varchar(5), rep_agent_config(@dbid, "security",
850                       "unified login")),
851                   "msg_confidentiality" =
852                   convert(varchar(5), rep_agent_config(@dbid, "security",
853                       "msg confidentiality")),
854                   "msg_integrity" =
855                   convert(varchar(5), rep_agent_config(@dbid, "security",
856                       "msg integrity")),
857                   "msg_replay_detection" =
858                   convert(varchar(5), rep_agent_config(@dbid, "security",
859                       "msg replay detection")),
860                   "msg_origin_check" =
861                   convert(varchar(5), rep_agent_config(@dbid, "security",
862                       "msg origin check")),
863                   "msg_out_of_sequence_check" =
864                   convert(varchar(5), rep_agent_config(@dbid, "security",
865                       "msg out-of-sequence check")),
866                   "mutual_authentication" =
867                   convert(varchar(5), rep_agent_config(@dbid, "security",
868                       "mutual authentication")),
869                   "net_password_encryption" =
870                   convert(varchar(5), rep_agent_config(@dbid, "security",
871                       "net password encryption"))
872               into #help_rep_agent_security1
873   
874               /* Output and format the content of the	temp table. */
875               /* And because the column name 'msg_out_of_sequence_check' should */
876               /* be renamed as 'msg_out-of-sequence_check', the selectlist is	*/
877               /* set for 'sp_autoformat' */
878               exec sp_autoformat #help_rep_agent_security1,
879                   "'dbname' = dbname,
880   			'security_mechanism' = security_mechanism,
881   			'unified_login'	= unified_login,
882   			'msg_confidentiality' = msg_confidentiality,
883   			'msg_integrity'	= msg_integrity,
884   			'msg_replay_detection' = msg_replay_detection,
885   			'msg_origin_check' = msg_origin_check,
886   			'msg_out-of-sequence_check' = msg_out_of_sequence_check,
887   			'mutual_authentication'	= mutual_authentication,
888   			'net_password_encryption'= net_password_encryption"
889   
890               /* drop the temp table */
891               drop table #help_rep_agent_security1
892   
893           end
894           else
895           /* If dbname was not specified, do all enabled databases. */
896           begin
897               /* Retrieve the information requested. */
898               select "dbname" = name,
899                   "security_mechanism" =
900                   rep_agent_config(dbid, "security",
901                       "security mechanism"),
902                   "unified_login" =
903                   convert(varchar(5), rep_agent_config(dbid, "security",
904                       "unified login")),
905                   "msg_confidentiality" =
906                   convert(varchar(5), rep_agent_config(dbid, "security",
907                       "msg confidentiality")),
908                   "msg_integrity" =
909                   convert(varchar(5), rep_agent_config(dbid, "security",
910                       "msg integrity")),
911                   "msg_replay_detection" =
912                   convert(varchar(5), rep_agent_config(dbid, "security",
913                       "msg replay detection")),
914                   "msg_origin_check" =
915                   convert(varchar(5), rep_agent_config(dbid, "security",
916                       "msg origin check")),
917                   "msg_out_of_sequence_check" =
918                   convert(varchar(5), rep_agent_config(dbid, "security",
919                       "msg out-of-sequence check")),
920                   "mutual_authentication" =
921                   convert(varchar(5), rep_agent_config(dbid, "security",
922                       "mutual authentication")),
923                   "net_password_encryption" =
924                   convert(varchar(5), rep_agent_config(dbid, "security",
925                       "net password encryption"))
926               into #help_rep_agent_security2
927               from master.dbo.sysdatabases
928               where 1 = (case when ((status3 & @skip_status) = 0)
929                       then is_rep_agent_enabled(dbid) else 0
930                   end)
931   
932               /* Output and format the content of the	temp table. */
933               /* And because the column name 'msg_out_of_sequence_check' should */
934               /* be renamed as 'msg_out-of-sequence_check', the selectlist is	*/
935               /* set for 'sp_autoformat' */
936               exec sp_autoformat #help_rep_agent_security2,
937                   "'dbname' = dbname,
938   			'security_mechanism' = security_mechanism,
939   			'unified_login'	= unified_login,
940   			'msg_confidentiality' = msg_confidentiality,
941   			'msg_integrity'	= msg_integrity,
942   			'msg_replay_detection' = msg_replay_detection,
943   			'msg_origin_check' = msg_origin_check,
944   			'msg_out-of-sequence_check' = msg_out_of_sequence_check,
945   			'mutual_authentication'	= mutual_authentication,
946   			'net_password_encryption'= net_password_encryption"
947   
948               /* drop the temp table */
949               drop table #help_rep_agent_security2
950   
951           end
952       end
953       if (@whattoprint in ("send", "all"))
954       begin
955           if @dbname is not NULL
956           begin
957               /* RESOLVE --chr: Do we want to suppress this header if we are only showing
958               ** a stream replication database since there is no sender information ? */
959               /* For a given database	*/
960               print "Replication Agent Send Status"
961   
962               /* 'select into' the send information into a temp table	*/
963               select "dbname" = @dbname,
964                   "pathname" = send.PathName,
965                   "sender_spid" = send.SenderSPID,
966                   "total_send_buffers" = send.MessageQueueSize,
967                   "send_buffers_used" = send.MessagesInQueue,
968                   "scanner_spid" = send.ScannerSPID
969               into #help_rep_agent_send1
970               from master..monRepSenders send
971               where send.DBID = @dbid
972   
973               /* Output and format the content of the	temp table */
974               exec sp_autoformat #help_rep_agent_send1
975   
976               /* drop the temp table */
977               drop table #help_rep_agent_send1
978           end
979           else
980           begin
981               print ""
982               print "Replication Agent Send Status"
983               /* 'select into' the send information into a temp table	*/
984               select "dbname" = db.name,
985                   "pathname" = send.PathName,
986                   "sender_spid" = send.SenderSPID,
987                   "total_send_buffers" = send.MessageQueueSize,
988                   "send_buffers_used" = send.MessagesInQueue,
989                   "scanner_spid" = send.ScannerSPID
990               into #help_rep_agent_send2
991               from master.dbo.sysdatabases db,
992                   master..monRepSenders send
993               where 1 = (case when ((db.status3 & @skip_status) = 0)
994                       then is_rep_agent_enabled(db.dbid) else 0
995                   end) and
996                   send.DBID = db.dbid
997   
998               /* Output and format the content of the	temp table */
999               exec sp_autoformat #help_rep_agent_send2
1000  
1001              /* drop the temp table */
1002              drop table #help_rep_agent_send2
1003          end
1004      end
1005  
1006  
1007  
1008      return (0)
1009  
1010  


exec sp_procxmode 'sp_help_rep_agent', 'AnyMode'
go

Grant Execute on sp_help_rep_agent to public
go
DEFECTS
 QJWI 5 Join or Sarg Without Index 285
 QJWI 5 Join or Sarg Without Index 306
 QJWI 5 Join or Sarg Without Index 336
 QJWI 5 Join or Sarg Without Index 438
 MEST 4 Empty String will be replaced by Single Space 466
 MEST 4 Empty String will be replaced by Single Space 486
 MEST 4 Empty String will be replaced by Single Space 658
 MEST 4 Empty String will be replaced by Single Space 714
 MEST 4 Empty String will be replaced by Single Space 981
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 288
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 309
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 339
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 370
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 392
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 413
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 441
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 460
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 480
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 501
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 533
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 559
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 597
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 625
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 651
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 678
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 707
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 736
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 795
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 827
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 878
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 936
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 974
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: parameter # 1 999
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
65
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 76
 QTYP 4 Comparison type mismatch smallint = int 76
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 335
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 523
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 556
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 587
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 619
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 675
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 732
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 996
 TNOI 4 Table with no index master..monRepCoordinator master..monRepCoordinator
 TNOI 4 Table with no index master..monRepScanners master..monRepScanners
 TNOI 4 Table with no index master..monRepSenders master..monRepSenders
 TNOI 4 Table with no index master..monRepTruncationPoint master..monRepTruncationPoint
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MGTP 3 Grant to public master..monRepCoordinator  
 MGTP 3 Grant to public master..monRepScanners  
 MGTP 3 Grant to public master..monRepSenders  
 MGTP 3 Grant to public master..monRepTruncationPoint  
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysdatabases  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public sybsystemprocs..sp_help_rep_agent  
 MNER 3 No Error Check should check return value of exec 134
 MNER 3 No Error Check should check return value of exec 244
 MNER 3 No Error Check should check @@error after select into 275
 MNER 3 No Error Check should check return value of exec 288
 MNER 3 No Error Check should check @@error after select into 296
 MNER 3 No Error Check should check return value of exec 309
 MNER 3 No Error Check should check @@error after select into 320
 MNER 3 No Error Check should check return value of exec 339
 MNER 3 No Error Check should check @@error after select into 361
 MNER 3 No Error Check should check return value of exec 370
 MNER 3 No Error Check should check @@error after select into 379
 MNER 3 No Error Check should check return value of exec 392
 MNER 3 No Error Check should check @@error after select into 400
 MNER 3 No Error Check should check return value of exec 413
 MNER 3 No Error Check should check @@error after select into 425
 MNER 3 No Error Check should check return value of exec 441
 MNER 3 No Error Check should check @@error after select into 451
 MNER 3 No Error Check should check return value of exec 460
 MNER 3 No Error Check should check @@error after select into 468
 MNER 3 No Error Check should check return value of exec 480
 MNER 3 No Error Check should check @@error after select into 488
 MNER 3 No Error Check should check return value of exec 501
 MNER 3 No Error Check should check @@error after select into 513
 MNER 3 No Error Check should check return value of exec 533
 MNER 3 No Error Check should check @@error after select into 542
 MNER 3 No Error Check should check return value of exec 559
 MNER 3 No Error Check should check @@error after select into 567
 MNER 3 No Error Check should check return value of exec 597
 MNER 3 No Error Check should check @@error after select into 605
 MNER 3 No Error Check should check return value of exec 625
 MNER 3 No Error Check should check @@error after select into 638
 MNER 3 No Error Check should check return value of exec 651
 MNER 3 No Error Check should check @@error after select into 661
 MNER 3 No Error Check should check return value of exec 678
 MNER 3 No Error Check should check @@error after select into 692
 MNER 3 No Error Check should check return value of exec 707
 MNER 3 No Error Check should check @@error after select into 717
 MNER 3 No Error Check should check return value of exec 736
 MNER 3 No Error Check should check @@error after select into 750
 MNER 3 No Error Check should check return value of exec 795
 MNER 3 No Error Check should check @@error after select into 805
 MNER 3 No Error Check should check return value of exec 827
 MNER 3 No Error Check should check @@error after select into 844
 MNER 3 No Error Check should check return value of exec 878
 MNER 3 No Error Check should check @@error after select into 898
 MNER 3 No Error Check should check return value of exec 936
 MNER 3 No Error Check should check @@error after select into 963
 MNER 3 No Error Check should check return value of exec 974
 MNER 3 No Error Check should check @@error after select into 984
 MNER 3 No Error Check should check return value of exec 999
 MUCO 3 Useless Code Useless Brackets 80
 MUCO 3 Useless Code Useless Brackets 98
 MUCO 3 Useless Code Useless Brackets 108
 MUCO 3 Useless Code Useless Brackets 110
 MUCO 3 Useless Code Useless Brackets 113
 MUCO 3 Useless Code Useless Brackets 140
 MUCO 3 Useless Code Useless Brackets 150
 MUCO 3 Useless Code Useless Brackets 167
 MUCO 3 Useless Code Useless Brackets 172
 MUCO 3 Useless Code Useless Brackets 174
 MUCO 3 Useless Code Useless Brackets 179
 MUCO 3 Useless Code Useless Brackets 181
 MUCO 3 Useless Code Useless Brackets 192
 MUCO 3 Useless Code Useless Brackets 200
 MUCO 3 Useless Code Useless Brackets 203
 MUCO 3 Useless Code Useless Brackets 217
 MUCO 3 Useless Code Useless Brackets 230
 MUCO 3 Useless Code Useless Brackets 237
 MUCO 3 Useless Code Useless Brackets 246
 MUCO 3 Useless Code Useless Brackets 250
 MUCO 3 Useless Code Useless Brackets 257
 MUCO 3 Useless Code Useless Brackets 268
 MUCO 3 Useless Code Useless Brackets 272
 MUCO 3 Useless Code Useless Brackets 332
 MUCO 3 Useless Code Useless Brackets 345
 MUCO 3 Useless Code Useless Brackets 357
 MUCO 3 Useless Code Useless Brackets 375
 MUCO 3 Useless Code Useless Brackets 421
 MUCO 3 Useless Code Useless Brackets 520
 MUCO 3 Useless Code Useless Brackets 528
 MUCO 3 Useless Code Useless Brackets 553
 MUCO 3 Useless Code Useless Brackets 579
 MUCO 3 Useless Code Useless Brackets 580
 MUCO 3 Useless Code Useless Brackets 592
 MUCO 3 Useless Code Useless Brackets 616
 MUCO 3 Useless Code Useless Brackets 622
 MUCO 3 Useless Code Useless Brackets 630
 MUCO 3 Useless Code Useless Brackets 672
 MUCO 3 Useless Code Useless Brackets 684
 MUCO 3 Useless Code Useless Brackets 729
 MUCO 3 Useless Code Useless Brackets 742
 MUCO 3 Useless Code Useless Brackets 822
 MUCO 3 Useless Code Useless Brackets 835
 MUCO 3 Useless Code Useless Brackets 928
 MUCO 3 Useless Code Useless Brackets 953
 MUCO 3 Useless Code Useless Brackets 993
 MUCO 3 Useless Code Useless Brackets 1008
 QAFM 3 Var Assignment from potentially many rows 63
 QAPT 3 Access to Proxy Table master..monRepScanners 282
 QAPT 3 Access to Proxy Table master..monRepSenders 283
 QAPT 3 Access to Proxy Table master..monRepScanners 303
 QAPT 3 Access to Proxy Table master..monRepSenders 304
 QAPT 3 Access to Proxy Table master..monRepScanners 330
 QAPT 3 Access to Proxy Table master..monRepSenders 331
 QAPT 3 Access to Proxy Table master..monRepCoordinator 366
 QAPT 3 Access to Proxy Table master..monRepScanners 388
 QAPT 3 Access to Proxy Table master..monRepSenders 409
 QAPT 3 Access to Proxy Table master..monRepScanners 435
 QAPT 3 Access to Proxy Table master..monRepSenders 436
 QAPT 3 Access to Proxy Table master..monRepCoordinator 456
 QAPT 3 Access to Proxy Table master..monRepScanners 476
 QAPT 3 Access to Proxy Table master..monRepTruncationPoint 497
 QAPT 3 Access to Proxy Table master..monRepCoordinator 519
 QAPT 3 Access to Proxy Table master..monRepScanners 552
 QAPT 3 Access to Proxy Table master..monRepSenders 578
 QAPT 3 Access to Proxy Table master..monRepTruncationPoint 615
 QAPT 3 Access to Proxy Table master..monRepScanners 647
 QAPT 3 Access to Proxy Table master..monRepScanners 670
 QAPT 3 Access to Proxy Table master..monRepScanners 702
 QAPT 3 Access to Proxy Table master..monRepScanners 727
 QAPT 3 Access to Proxy Table master..monRepSenders 970
 QAPT 3 Access to Proxy Table master..monRepSenders 992
 QCTC 3 Conditional Table Creation 275
 QCTC 3 Conditional Table Creation 296
 QCTC 3 Conditional Table Creation 320
 QCTC 3 Conditional Table Creation 361
 QCTC 3 Conditional Table Creation 379
 QCTC 3 Conditional Table Creation 400
 QCTC 3 Conditional Table Creation 425
 QCTC 3 Conditional Table Creation 451
 QCTC 3 Conditional Table Creation 468
 QCTC 3 Conditional Table Creation 488
 QCTC 3 Conditional Table Creation 513
 QCTC 3 Conditional Table Creation 542
 QCTC 3 Conditional Table Creation 567
 QCTC 3 Conditional Table Creation 605
 QCTC 3 Conditional Table Creation 638
 QCTC 3 Conditional Table Creation 661
 QCTC 3 Conditional Table Creation 692
 QCTC 3 Conditional Table Creation 717
 QCTC 3 Conditional Table Creation 750
 QCTC 3 Conditional Table Creation 805
 QCTC 3 Conditional Table Creation 844
 QCTC 3 Conditional Table Creation 898
 QCTC 3 Conditional Table Creation 963
 QCTC 3 Conditional Table Creation 984
 QDIS 3 Check correct use of 'select distinct' 275
 QDIS 3 Check correct use of 'select distinct' 320
 QGWO 3 Group by/Distinct/Union without order by 275
 QGWO 3 Group by/Distinct/Union without order by 320
 QISO 3 Set isolation level 51
 QNAJ 3 Not using ANSI Inner Join 282
 QNAJ 3 Not using ANSI Inner Join 303
 QNAJ 3 Not using ANSI Inner Join 329
 QNAJ 3 Not using ANSI Inner Join 435
 QNAJ 3 Not using ANSI Inner Join 518
 QNAJ 3 Not using ANSI Inner Join 551
 QNAJ 3 Not using ANSI Inner Join 577
 QNAJ 3 Not using ANSI Inner Join 614
 QNAJ 3 Not using ANSI Inner Join 670
 QNAJ 3 Not using ANSI Inner Join 727
 QNAJ 3 Not using ANSI Inner Join 991
 QNUA 3 Should use Alias: Column name should use alias db 567
 QNUA 3 Should use Alias: Column name should use alias db 605
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
74
 VNRD 3 Variable is not read @sptlang 77
 VNRD 3 Variable is not read @procval 175
 VNRD 3 Variable is not read @dummy 204
 VUNU 3 Variable is not used @msg 17
 VUNU 3 Variable is not used @type 20
 MSUB 2 Subquery Marker 73
 MTR1 2 Metrics: Comments Ratio Comments: 23% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 65 = 72dec - 9exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 377 10
 PRED_QUERY_COLLECTION 2 {mrs=master..monRepScanners, mrs2=master..monRepSenders} 0 275
 PRED_QUERY_COLLECTION 2 {mrs=master..monRepSenders, mrs2=master..monRepScanners} 0 296
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepSenders, mrs2=master..monRepScanners} 0 320
 PRED_QUERY_COLLECTION 2 {mrs=master..monRepSenders, mrs2=master..monRepScanners} 0 425
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrc=master..monRepCoordinator} 0 513
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepScanners} 0 542
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepSenders} 0 567
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrtp=master..monRepTruncationPoint} 0 605
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepScanners} 0 661
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepScanners} 0 717
 PRED_QUERY_COLLECTION 2 {d=master..sysdatabases, mrs=master..monRepSenders} 0 984

DEPENDENCIES
PROCS AND TABLES USED
writes table tempdb..#help_rep_agent_send1 (1) 
reads table master..spt_values (1)  
calls proc sybsystemprocs..sp_getmessage  
   reads table master..syslanguages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)  
   reads table sybsystemprocs..sysusermessages  
read_writes table tempdb..#help_rep_agent_process7 (1) 
writes table tempdb..#help_rep_agent_process_cit (1) 
reads table master..sysdatabases (1)  
reads table master..monRepScanners (1)  
writes table tempdb..#help_rep_agent_process2 (1) 
writes table tempdb..#help_rep_agent_scan4 (1) 
writes table tempdb..#help_rep_agent_config2 (1) 
writes table tempdb..#help_rep_agent_scan1 (1) 
calls proc sybsystemprocs..sp_autoformat  
   writes table sybsystemprocs..sp_autoformat_rset_003 
   read_writes table tempdb..#colinfo_af (1) 
   reads table tempdb..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_001 
   calls proc sybsystemprocs..sp_autoformat  
   reads table tempdb..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_005 
   reads table master..systypes (1)  
   calls proc sybsystemprocs..sp_namecrack  
   writes table sybsystemprocs..sp_autoformat_rset_004 
   reads table master..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_002 
reads table master..monRepTruncationPoint (1)  
read_writes table tempdb..#help_rep_agent_process4 (1) 
reads table master..sysmessages (1)  
writes table tempdb..#help_rep_agent_recovery2 (1) 
read_writes table tempdb..#help_rep_agent_process5 (1) 
writes table tempdb..#help_rep_agent_scan3 (1) 
writes table tempdb..#help_rep_agent_scan2 (1) 
writes table tempdb..#help_rep_agent_recovery1 (1) 
writes table tempdb..#help_rep_agent_send2 (1) 
writes table tempdb..#help_rep_agent_process1 (1) 
reads table master..monRepCoordinator (1)  
writes table tempdb..#help_rep_agent_process_cic (1) 
writes table tempdb..#help_rep_agent_security1 (1) 
writes table tempdb..#help_rep_agent_process3 (1) 
writes table tempdb..#help_rep_agent_process0 (1) 
writes table tempdb..#help_rep_agent_security2 (1) 
writes table tempdb..#help_rep_agent_process6 (1) 
writes table tempdb..#help_rep_agent_recovery0 (1) 
reads table master..monRepSenders (1)  
writes table tempdb..#help_rep_agent_process_cis (1) 
writes table tempdb..#help_rep_agent_config1 (1) 
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..sysconfigures (1)  
   reads table master..syscurconfigs (1)