SQL Server: Disable/Remove Indexes Across Servers/Databases Using PowerShell & dbatools

This is something I had to do today. In this blog post, I am going to show you how you can disable or remove indexes matching certain name criteria or other condition(s) across multiple servers and databases in various tables. Usually, this is a very painful process if done by hand but with the fantastic … Continue reading SQL Server: Disable/Remove Indexes Across Servers/Databases Using PowerShell & dbatools

Advertisement

PowerShell & SQL Server: Search & Find Indexes By SchemaName, TableName, IndexName Or ColumnName Across Instances/DB’s

Necessity is the mother of new PowerShell code :-)! Today, I received an email request to get the list of all indexes in a given TableName but the requester did not specify the DatabaseName although the SQL InstanceName was specified. It would be too easy to ask the person for the DBName and script it … Continue reading PowerShell & SQL Server: Search & Find Indexes By SchemaName, TableName, IndexName Or ColumnName Across Instances/DB’s

SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances

There are a bunch of tools in the market to do the database comparisons for differences but if you want to do it for free (and programmatically)  at a basic level, you could use the method outlined below. For me, this came about as a result of an user asking "So, what is different between … Continue reading SQL Server: Compare Database Tables/Indexes/Views/SP’s etc. For Differences Across Instances

SQL Server: Identify And Defragment Indexes Using DBCC SHOWCONTIG & DBCC INDEXDEFRAG

Update Sep 7, 2018: This article uses deprecated commands. Please checkout this blog post on "Alter Index Vs DBCC IndexDefrag Vs DBCC DBReIndex". In the newer versions, I prefer ALTER INDEX although it has not been good at defragmenting in all cases. A good defrag script is worth its weight in gold. This time, I copied … Continue reading SQL Server: Identify And Defragment Indexes Using DBCC SHOWCONTIG & DBCC INDEXDEFRAG

Oracle – TRUNCATE vs DELETE – Spoiler: TRUNCATE Wins & Why? Hours vs Seconds!

Why DELETE is bad? In Oracle, when it comes to deleting  ** A L L **   the data from a table (clearing the contents of a staging table for example), using a DELETE statement is the most inefficient choice. Here are some reasons why DELETE is bad It uses UNDO It uses REDO It fires … Continue reading Oracle – TRUNCATE vs DELETE – Spoiler: TRUNCATE Wins & Why? Hours vs Seconds!