Database Growth Information in SQL Server
DBA’s and Developers often have a need to query the current state of database file size and growth information. This script allows you to obtain file-growth information from single or all databases. It provides the following information: 1. Local Server Name2....
Check for Database Compatibility Issues
Setting the database to the right compatibility level is very important as it can have negative impact on the performance and behavior of your databases. I’ve seen many customers upgrade their SQL Servers from older versions to newer but forget to upgrade the...
Attaching and Detaching SQL Server Databases
DBAs and Developers at times may need to detach and attach the databases for various reasons including the following: 1. Moving files to other drives2. Server migration2. Upgrades,3. system maintenance, etc. This script takes away the headache of remembering the...
Update Statistics in SQL Server using T-SQL
Index Statistics are important for query optimizer to generate optimal query plans. If indexes have outdated or stale statistics, your query’s performance will suffer. It is important to update the statistics to make sure query optimizer always generates the best and...
How to Hack SQL Server Without SA Password
You are a proud and trusted DBA of your organization who is responsible for maintaining and managing SQL Servers in the production environment. To prevent any unauthorized access to your production environment, you have decided to perform the following steps that...
Automatic SQL Database Backups in the Cloud
Backups are extremely important for the continuity of business. Many companies fire their engineers just because they didn't have proper backups in place. Wouldn't it be great if there was a way that DBAs and engineers didn't have to worry about backups and SQL...
Optimizing Ad-hoc Workload in SQL Server
By default, when a query is executed in SQL Server, it compiles and generates an execution plan for that query and stores that plan in the plan cache. Now if this happens to be a one-off/ad-hoc query that will never be run again, then the newly generated plan is...
Recover Corrupt SQL Server Database
Remember those days when the database would go in to suspect mode and you had to perform various steps to recover the database by putting the database in the emergency mode and then extracting the data out of that emergency database? Here’s a flash back on how we used...
Why Queries perform differently in Test vs Production
You may have experienced something similar where the query or a stored procedure performs bad when deployed in the production and the same query / stored procedure works perfectly well in the test or development environment. Behind the scenes (Query Internals) It...
Restore Damaged Pages from DB Backup
Are your database pages corrupt or damaged? Now you can restore damaged pages without impacting the availability of the database. SQL Server provides an extension to the RESTORE command that can help restore damaged pages from the backups. (Note: Only the...
Recent Comments