سؤال

I'd like to monitor the statistics of my indexes on my sql server instance of my app harbor website. But running my query says I don't have permission to access that object. Is there other ways to query the dm_* tables/views to get these statistics so I know whether to add more indexes, rebuild/reorg my current ones, etc?

هل كانت مفيدة؟

المحلول

yet to answer your question:

In order to view the statistics object, the user must own the table or the user must be a member of the sysadmin fixed server role, the db_owner fixed database role, or the db_ddladmin fixed database role.

DBCC SHOW_STATISTICS @ BOL

EDIT1:

As Martin pointed out if it is about querying information from Catalog then depending on SQL SERVER version you need to grant some permission to user who wants to access this information. check the BOL guideline for that:

Metadata Visibility Configuration

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top