Yes, it is possible to use a SQL query to change the recovery model of all databases on a SQL Server server to "SIMPLE". To do this, you can use the following query:
EXEC sp_msforeachdb 'USE [?]; IF DATABASEPROPERTYEX(''?'', ''recovery'') = ''FULL'' ALTER DATABASE [?] SET RECOVERY SIMPLE;'
This query uses the SQL Server function sp_msforeachdb to iterate through all databases on the server and changes the recovery model of all databases that use the "FULL" model to "SIMPLE". Note that this query should be run with care and you should back up your databases before running this query as changing your recovery model may affect your ability to recover data in case of server failures.
I hope this helps!
Comments
Post a Comment