Backs up, drops, and flushes QP metrics—always captured in the default running group, which is group 1 in each respective database—and their statistics on queries.
sp_metrics [‘backup’ backup_group_ID | ‘drop’, ‘gid’ [, ‘id’] | ‘flush’ | ‘help’, ‘command’]
sp_metrics 'backup', '3'
sp_metrics 'help', 'flush'
Access metric information using a select statement with order by against the sysquerymetrics view.
Use to back up the QP metrics from the old server into a backup group. To move saved QP metrics from the default running group to a backup group, to remove QP metrics from the system catalog. Flush all aggregated metrics in memory to the system catalog.
See also select, set in Reference Manual: Commands.
The permission checks for sp_metrics differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage server privilege or with monitor qp performance privilege (for filter, show, help). |
Disabled | With granular permissions disabled, you must be a user with sa_role. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|