Thor Logo dbatools

Database

Get-DbaDbVirtualLogFile

Chrissy LeMaire (@cl), netnerds.net

Get-DbaDbVirtualLogFile View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves detailed virtual log file (VLF) metadata from transaction logs for performance analysis and troubleshooting. Description This function uses DBCC LOGINFO to return detailed metadata about each virtual log file (VLF) within database transaction logs. The output includes VLF size, file offsets, sequence numbers, status, and parity information that’s essential for analyzing transaction log structure and performance. Having a transaction log file with too many virtual log files (VLFs) can hurt database performance.

Read more

Get-DbaHelpIndex

Nic Cain, sirsql.net

Get-DbaHelpIndex View Source Nic Cain, sirsql.net Windows, Linux, macOS Synopsis Retrieves comprehensive index and statistics information from SQL Server databases for performance analysis and optimization. Description This function queries SQL Server DMVs to return detailed index and statistics information for performance analysis, index maintenance planning, and identifying optimization opportunities. You can target all indexes in a database or focus on a specific table to analyze index usage patterns, sizes, and fragmentation levels.

Read more

Get-DbaInstanceTrigger

Chrissy LeMaire (@cl), netnerds.net

Get-DbaInstanceTrigger View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Retrieves server-level DDL triggers from SQL Server instances for auditing and documentation Description Returns server-level DDL triggers that monitor and respond to instance-wide events like CREATE, ALTER, and DROP statements. Server triggers are commonly used for security auditing, change tracking, and preventing unauthorized schema modifications across all databases on an instance. This function helps identify what automated responses are configured at the server level, which is essential for troubleshooting unexpected DDL blocking and documenting compliance controls.

Read more

Get-DbaLastGoodCheckDb

Jakob Bindslet ([email protected])

Get-DbaLastGoodCheckDb View Source Jakob Bindslet ([email protected]) Windows, Linux, macOS Synopsis Retrieves the last successful DBCC CHECKDB timestamp and integrity status for databases Description Retrieves and compares the timestamp for the last successful DBCC CHECKDB operation along with database creation dates. This helps DBAs monitor database integrity checking compliance and identify databases that need attention. The function returns comprehensive information including days since the last good CHECKDB, database creation date, current status assessment (Ok, New database not checked yet, or CheckDB should be performed), and data purity settings.

Read more

Get-DbaPermission

Klaas Vandenberghe (@PowerDBAKlaas)

Get-DbaPermission View Source Klaas Vandenberghe (@PowerDBAKlaas) Windows, Linux, macOS Synopsis Retrieves explicit and implicit permissions across SQL Server instances and databases for security auditing Description Retrieves comprehensive permission information from SQL Server instances and databases, including both explicit permissions and implicit permissions from fixed roles. This function queries sys.server_permissions and sys.database_permissions to capture all granted, denied, and revoked permissions across server and database levels. Perfect for security audits, compliance reporting, troubleshooting access issues, and planning permission migrations between environments.

Read more

Get-DbaSchemaChangeHistory

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

Get-DbaSchemaChangeHistory View Source Stuart Moore (@napalmgram), stuart-moore.com Windows, Linux, macOS Synopsis Retrieves DDL change history from the SQL Server default system trace Description Queries the default system trace to track CREATE, DROP, and ALTER operations performed on database objects, providing a complete audit trail of schema modifications. This helps DBAs identify who made changes, when they occurred, and which objects were affected without needing to manually parse trace files or enable custom auditing.

Read more

Invoke-DbaBalanceDataFiles

Sander Stad (@sqlstad), sqlstad.nl

Invoke-DbaBalanceDataFiles View Source Sander Stad (@sqlstad), sqlstad.nl Windows, Linux, macOS Synopsis Re-balance data between data files Description When you have a large database with a single data file and add another file, SQL Server will only use the new file until it’s about the same size. You may want to balance the data between all the data files. The function will check the server version and edition to see if the it allows for online index rebuilds.

Read more

Invoke-DbaDbShrink

Chrissy LeMaire (@cl), netnerds.net

Invoke-DbaDbShrink View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Reduces the physical size of database files by removing unused space from data and log files. Shrinks can cause severe index fragmentation (to the tune of 99%) Shrinks can cause massive growth in the database’s transaction log Shrinks can require a lot of time and system resources to perform data movement Description Reduces database file sizes by removing unused space from data files, log files, or both.

Read more

Invoke-DbaDbUpgrade

Stephen Bennett, sqlnotesfromtheunderground.wordpress.com

Invoke-DbaDbUpgrade View Source Stephen Bennett, sqlnotesfromtheunderground.wordpress.com Windows, Linux, macOS Synopsis Upgrades database compatibility level and performs post-upgrade maintenance tasks Description Performs the essential steps needed after upgrading SQL Server or moving databases to a newer instance. Updates database compatibility level to match the hosting SQL Server version and sets target recovery time to 60 seconds for SQL Server 2016 and newer. Executes critical post-upgrade maintenance including DBCC CHECKDB with DATA_PURITY to detect data corruption, DBCC UPDATEUSAGE to correct page counts, sp_updatestats to refresh statistics, and sp_refreshview to update all user views with new metadata.

Read more

Invoke-DbaQuery

Friedrich Weinmann (@FredWeinmann)

Invoke-DbaQuery View Source Friedrich Weinmann (@FredWeinmann) Windows, Linux, macOS Synopsis Executes T-SQL queries, scripts, and stored procedures against SQL Server instances with parameterized query support Description Executes T-SQL commands against one or more SQL Server instances, supporting queries from strings, files, URLs, or SQL Server Management Objects. This is the primary dbatools command for running custom SQL against your environment, whether you’re extracting data for reports, deploying scripts across multiple servers, or running maintenance commands.

Read more
Page 4 of 8