Home Forums SQL Server 2008 SQL Server 2008 - General Determine if a database is read-only when the log is not marked as read-only so DBCC SHRINKFILE may be skipped? RE: Determine if a database is read-only when the log is not marked as read-only so DBCC SHRINKFILE may be skipped?
SQLOzzie
Default port
Points: 1441
More actions
August 20, 2012 at 5:47 am
#1527529
John,
I need the File_ID to pass to DBCC SHRINKFILE - but I'm all ears in terms of suggestions.
SELECT @Log = FILE_ID,
@DB = Name
FROM sys.database_files
WHERE type_desc = ''Log'';
DBCC SHRINKFILE( @Log, TRUNCATEONLY );
Thanks,
Doug