Thor Logo dbatools

Log

Get-DbaDbFile

Stuart Moore (@napalmgram), stuart-moore.com

Get-DbaDbFile View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Retrieves comprehensive database file information including size, growth, I/O statistics, and storage details. Description Retrieves detailed information about database files (data and log files) from SQL Server instances using direct T-SQL queries for optimal performance. This function provides comprehensive file metadata including current size, used space, growth settings, I/O statistics, and volume free space information that DBAs need for capacity planning, performance analysis, and storage management.

Read more

Get-DbaDbFileGrowth

Chrissy LeMaire (@cl), netnerds.net

Get-DbaDbFileGrowth View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves database file auto-growth settings and maximum size limits Description Retrieves auto-growth configuration for data and log files across SQL Server databases, including growth type (percentage or fixed MB), growth increment values, and maximum size limits. This function helps DBAs quickly identify databases with problematic growth settings like percentage-based growth on large files, unlimited growth configurations, or insufficient growth increments that could cause performance issues during auto-growth events.

Read more

Get-DbaDbFileMapping

Chrissy LeMaire (@cl), netnerds.net | Andreas Jordan (@JordanOrdix), ordix.de

Get-DbaDbFileMapping View Source Chrissy LeMaire (@cl), netnerds.net , Andreas Jordan (@JordanOrdix), ordix.de Windows, Linux, macOS Synopsis Creates file mapping hashtable from existing database for use in restore operations Description Extracts the logical-to-physical file name mappings from an existing database and returns them in a hashtable format compatible with Restore-DbaDatabase. This eliminates the need to manually specify file paths when restoring databases to different servers or locations. The function reads both data files and log files from the database’s file groups and creates a complete mapping that preserves the original file structure during restore operations.

Read more

Get-DbaDbLogSpace

Jess Pomfret, JessPomfret.com

Get-DbaDbLogSpace View Source Jess Pomfret, JessPomfret.com Windows, Linux, macOS Synopsis Retrieves transaction log space usage and capacity information from SQL Server databases. Description Collects detailed transaction log metrics including total size, used space percentage, and used space in bytes for databases across SQL Server instances. Uses the sys.dm_db_log_space_usage DMV on SQL Server 2012+ or DBCC SQLPERF(logspace) on older versions. Essential for proactive log space monitoring to prevent unexpected transaction log growth, identify databases approaching log capacity limits, and plan log file sizing.

Read more

Get-DbaDefaultPath

Chrissy LeMaire (@cl), netnerds.net

Get-DbaDefaultPath View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves default file paths for SQL Server data, log, backup, and error log directories Description Retrieves the default directory paths that SQL Server uses for new database files, transaction logs, backups, and error logs. This information is essential for capacity planning, automated database provisioning, and understanding where SQL Server will place files when no explicit path is specified. The function uses multiple fallback methods to determine these paths, including server properties, system queries, and examining existing system databases when standard properties are unavailable.

Read more

Read-DbaTransactionLog

Stuart Moore (@napalmgram), stuart-moore.com

Read-DbaTransactionLog View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Retrieves raw transaction log records from a database using fn_dblog for forensic analysis and troubleshooting Description Uses SQL Server’s built-in fn_dblog function to extract raw transaction log records from a live database, returning detailed information about every transaction in the format used by the SQL Server logging subsystem. This gives you access to the same low-level data that SQL Server uses internally to track database changes.

Read more

Set-DbaDbFileGrowth

Chrissy LeMaire (@cl), netnerds.net

Set-DbaDbFileGrowth View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Modifies auto-growth settings for database data and log files to use fixed-size increments instead of percentage-based growth. Description Configures database file auto-growth settings using ALTER DATABASE statements to replace default percentage-based growth with fixed-size increments. This prevents unpredictable growth patterns that can cause performance issues and storage fragmentation as databases grow larger. Defaults to 64MB growth increments, which provides better control over file expansion and reduces the risk of exponential growth that can quickly consume available disk space.

Read more