Msg 15705 Automatic Tuning cannot be enabled.
Applies to: SQL Server 2022, SQL Server 2019.
Date created: May 3, 2024.
 
Problem Description.
 
You can enable Automatic Tuning on a database and specify that the last good 
plan should be forced whenever some plan change regression is detected. You can 
try to enable it using the following command:
ALTER DATABASE <yourDatabase>
SET AUTOMATIC_TUNING ( FORCE_LAST_GOOD_PLAN = ON );
However, you may get the following error message trying enable Automatic Tuning:
Msg 15705, Level 16, State 1, Line 1
Automatic Tuning option FORCE_LAST_GOOD_PLAN cannot be enabled, because Query 
Store is not turned on.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
 

 
Cause.
To enable Automatic Tuning you need to enable Query Store on the database first.
 
Workaround/Solution.
To solve this issue you must first enable Query Store on properties of the 
database. Set the operation mode as shown below. You can also enable Query Store 
using Transact-SQL.
 

 
After that you can enable Automatic Tuning.