Query:
DBCC SQLPERF (Logspace)
USE master;
GO
ALTER DATABASE Tal
SET RECOVERY FULL;
GO
BACKUP DATABASE Tal
TO DISK = 'D:\SQLServerBackups\MyTalLog.bak'
WITH FORMAT;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE TAL
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE ('MyTal_Log', 1,TRUNCATEONLY);
GO
-- Reset the database recovery model.
ALTER DATABASE TAL
SET RECOVERY FULL;
GO
OUTPUT:
(7 rows affected) DBCC execution completed. If DBCC printed error messages, contact your system administrator. Processed 440 pages for database 'Tal', file 'Tal' on file 1. Processed 2 pages for database 'Tal', file 'Tal_log' on file 1. BACKUP DATABASE successfully processed 442 pages in 0.434 seconds (7.939 MB/sec). Msg 8985, Level 16, State 1, Line 16 Could not locate file 'MyTal_Log' for database 'master' in sys.database_files. The file either does not exist, or was dropped.