K
K
kipishio kipishio2019-11-29 14:29:20
SQL
kipishio kipishio, 2019-11-29 14:29:20

How to run DBCC FREEPROCCACHE() command for a specific database in SQL Scheduler?

Hello.
Tell me how to set up clearing the procedural cache through the T-SQL statement in the scheduler from SQL Server 2016?
I entered the following command there DBCC FREEPROCCACHE (8) where 8 is the number of my database.
But when I run it, I get an error and I can't figure out what's wrong?
Also, maybe someone knows how to perform this procedure for only two databases ...
for example, it can be written in T-SQL
DBCC FREEPROCCACHE (8)
DBCC FREEPROCCACHE (9)
The error comes out like this
"The query 'DBCC FREEPROCCACHE(8)' failed with the following error: 'Parameter 1 is not valid for this DBCC statement.' Possible causes of failure include problems with this query, the 'ResultSet' property was set incorrectly, parameters were set incorrectly, or the connection was not established correctly" ."
error number -1073548784

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2019-11-29
@kipishio

We look at the description: https://docs.microsoft.com/ru-RU/sql/t-sql/databas...
1. there the parameters are specific handles, not databases
2. in the footnote we look about "ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question