Explanation/Reference:
Explanation:
When the actual state is read-only, use the readonly_reason column to determine the root cause. Typically you will find that Query Store transitioned to read-only mode because the size quota was exceeded.
Consider the following steps to switch Query Store to read-write mode and activate data collection:
Increase the maximum storage size by using the MAX_STORAGE_SIZE_MB option of ALTER

DATABASE.
Clean up Query Store data by using the following statement:

ALTER DATABASE [QueryStoreDB] SET QUERY_STORE CLEAR;

You can apply one or both of these steps by the executing the following statement that explicitly changes operation mode back to read-write:
ALTER DATABASE [QueryStoreDB]
SET QUERY_STORE (OPERATION_MODE = READ_WRITE);
References:
https://docs.microsoft.com/en-us/sql/relational-databases/performance/best-practice-with-the-query-store