20.6.18

How do I shrink all files quickly for all databases?

SELECT 
      'USE [' + d.name + N']' + CHAR(13) + CHAR(10) 
    + 'DBCC SHRINKFILE (N''' + mf.name + N''' , 0, TRUNCATEONLY)' 
    + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10) 
FROM 
         sys.master_files mf 
    JOIN sys.databases d 
        ON mf.database_id = d.database_id 
WHERE d.database_id > 4;
https://dba.stackexchange.com/questions/358/how-do-i-shrink-all-files-quickly-for-all-databases

Комментариев нет:

Отправить комментарий