Thor Logo dbatools

Delete

Remove-DbaDatabase

Chrissy LeMaire (@cl), netnerds.net

Remove-DbaDatabase View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Removes user databases using multiple fallback methods to handle stuck or locked databases. Description Removes user databases by attempting three different drop methods in sequence until one succeeds. First tries the standard KillDatabase() method, then attempts to set the database to single-user mode with rollback immediate before dropping, and finally uses the SMO Drop() method.

Read more

Remove-DbaDatabaseSafely

Rob Sewell (@SQLDBAWithBeard), sqldbawithabeard.com

Remove-DbaDatabaseSafely View Source Rob Sewell (@SQLDBAWithBeard), sqldbawithabeard.com Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Removes databases after creating verified backups and testing restore procedures. Description Performs a comprehensive database removal workflow that validates database integrity, creates verified backups, and tests restore procedures before permanently removing databases. This function runs DBCC CHECKDB to verify database health, creates a checksummed backup to a specified location, generates a SQL Agent job for automated restore testing, drops the original database, executes the restore job to verify backup integrity, performs another DBCC check on the restored database, and finally removes the test database.

Read more

Remove-DbaDbBackupRestoreHistory

IJeb Reitsma

Remove-DbaDbBackupRestoreHistory View Source IJeb Reitsma Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Removes backup and restore history records from MSDB database to prevent excessive growth Description Removes backup and restore history records from MSDB database tables to prevent them from consuming excessive disk space and degrading performance. Over time, these history tables can grow substantially on busy SQL Server instances with frequent backup operations.

Read more

Remove-DbaLogin

Chrissy LeMaire (@cl), netnerds.net

Remove-DbaLogin View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Removes SQL Server logins from target instances Description Removes one or more SQL Server logins from specified instances using the SMO Drop() method. This function handles the complete removal process including dependency checks and provides proper error handling when logins cannot be dropped due to existing sessions or database ownership.

Read more