Tag Archives: Script

SQL Recursive CTE example

* Recursive CTE

Posted in Script, SQL, SQL Query | Tagged , , , , , , | Leave a comment

Windows Server storage capacity and usage report using Powershell

Below Scrip generates list of all Drives and mount points configured, thery storage capacity and free space. Following Script to check the storage on a single server; If you want to calculate the storage to be added to maintain certain … Continue reading

Posted in Powershell, Productivity, Uncategorized, Windows Server | Tagged , , , , | Leave a comment

Generate SQL Query for Database Snapshot creation using Powershell

Following PowerShell script generates SQL Query to take a snapshot;

Posted in Powershell, Productivity, SQL, Uncategorized | Tagged , , , , | Leave a comment

Tip – Excel formula to convert Instance Name to Server Name

Below formula will give sub string preceding \

Posted in Script, Uncategorized | Tagged , , , , , | Leave a comment

Powershell script to test Geo-Replication Configuration

Recently we have upgraded and downgraded multiple databases in SQLAzure and as part of that we have deleted and recreated geo-replication on large number of databases. Considering the number of databases and priority we end up performing manual changes. Created … Continue reading

Posted in Azure, Powershell, SQL, Uncategorized | Tagged , , , , | Leave a comment

Powershell script to search specific error on all log files in given servers

I have used this code to find specific activity failure during a critical process which is running across 25 different servers. this script also searches the log files which are created in last 5 days.

Posted in Powershell, Productivity | Tagged , , , , , | Leave a comment

Delete old files using powershell script

Powershell script to delete old backup files

Posted in Powershell, Productivity, Uncategorized | Tagged , , , | Leave a comment

Foreign key reference for 1 to 1 relationship in SQL

Recently we had a situation to design one to one relationship between 2 tables. One of our developer confused, need to create a quick demo to explain the design. Primary Table can be created with ID as identify and the … Continue reading

Posted in Script, SQL Server | Tagged , , , | Leave a comment

Find all Locks and Blocks on a Database or Server – Point in time

On one of our Databases I noticed frequent blocks resulting web page timeouts, had to analyze what is resulting these blocks and which tables are major contributors. SP_WHO2 is the easy way to find the processes which are getting blocked … Continue reading

Posted in Performance, Productivity, Script, SQL | Tagged , , , | Leave a comment

Database Restoration history of all databases

I had to find how frequently and which databases are restored by whom on one of my Development Servers. Following SQL Query does it!

Posted in Productivity, Script, SQL, SQL Query | Tagged , , , | Leave a comment