Question

What is equal to the database table [msdb]. [dbo]. [sysschedules_localserver_view], which contains the suffix _localserver_view?

I am having a permissions problem with a [msdb].[Dbo].[Sp_help_schedule], and I noticed the user I chose to run this stored procedure, select access in the table [msdb].[dbo].[sysbobschedules] more than when accessing the table [msdb]. [dbo].[sysschedules_localserver_view] (which is executed by an internal command from [msdb].[dbo].[sp_help_schedule]) is nothing.

Also note that this table does not exist in the msdb database, or in the table, view, or stored procedure folders.

Why would you want to know what this _localserver_view extension changes in the permissions or in the table view.

Was it helpful?

Solution

I'm not sure I understood your question but I'll try to explain the differences.

When you have full permissions in msdb you'll get the same rows when

  • executing msdb.dbo.sp_help_schedule
  • selecting from msdb.dbo.sysschedules_localserver_view
  • selecting from msdb.dbo.sysschedules

This is because msdb.dbo.sp_help_schedule selects from msdb.dbo.sysschedules_localserver_view which selects from msdb.dbo.sysschedules.

You'll get less rows when select from msdb.dbo.sysjobschedules mentioned in your question, this is because msdb.dbo.sysjobschedules

Contains schedule information for jobs to be executed by SQL Server Agent.

While msdb.dbo.sysschedules shows also schedules currently not related to any existing job, for example is contains schedules for Data Collector that may not be configured.

When the user has only select permission in msdb

he will not be able to execute msdb.dbo.sp_help_schedule, he'll get the full result when selecting from tables msdb.dbo.sysschedules and msdb.dbo.sysjobschedules, but he'll get no rows when selecting from the msdb.dbo.sysschedules_localserver_view view.

This is because this view contains the where clause:

WHERE (svr.master_server = 0)
  AND ( (sched.owner_sid = SUSER_SID())
        OR (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 1)
      OR (ISNULL(IS_MEMBER(N'SQLAgentReaderRole'), 0) = 1)
      )

This means that to get any row from this view one of the following should be true for the current user:

  • user is owner of the job (and only the schedules related to owned jobs will be returned)
  • corresponding login is a member of sysadmin fixed server role (all rows will be returned)
  • user is a member of SQLAgentReaderRole database role (all rows will be returned)
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top