To view the size and status of the business database log file in TencentDB for SQL Server, you can use SQL Server Management Studio (SSMS) or execute T-SQL commands directly.
Run the following query to check the log file details:
USE [YourDatabaseName];
GO
SELECT
name AS LogFileName,
size * 8 / 1024 AS SizeMB,
FILEPROPERTY(name, 'SpaceUsed') * 8 / 1024 AS UsedSpaceMB,
growth AS GrowthSetting,
physical_name AS FilePath
FROM sys.database_files
WHERE type_desc = 'LOG';
This query returns the log file name, size (in MB), used space, growth setting, and physical file path.
For managed database monitoring, Tencent Cloud provides Cloud Monitor to track log file growth and storage usage. Enable alerts to notify you when the log file approaches its size limit. Additionally, consider using TencentDB for SQL Server’s automated backup and log truncation features to manage log file size efficiently.
Example: If the log file grows too large due to long-running transactions, you can use:
BACKUP LOG [YourDatabaseName] TO DISK = 'NUL'; -- For simple recovery model (truncates log)
-- Or perform a proper transaction log backup in full/bulk-logged recovery models.
For production environments, ensure proper backup strategies to avoid excessive log growth.