Category Archives: Scripts

Script to Check SQL Server Connectivity

Use this VB script to check SQL Server connectivity. You can add N number of SQL Server instances to verify it’s status.

Read more »

VN:F [1.9.13_1145]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)

Capture SQL Performance Counters through TSQL

Performance counters are useful to gather information about server status and we can analyze the server status later using these data. In my environment one of my client is not ready to pay or buy metrics tools (normally we will be using BMC, HP etc). Our windows team has written they own custom scripts to capture the counters related to them, then it comes to our team how we are going to capture these data. Immediately it strikes my mind that we have a DMV “sys.dm_os_performance_counters” to get SQL performance counter values. So I thought of utilizing this procedure to get SQL Performance counter values and storing it in a table which will help us in the future to analyze the data.

Read more »

VN:F [1.9.13_1145]
Rating: 3.2/5 (5 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 5 votes)

Change \ Transfer Schema for all Objects

In my working environment we will be using different schema for production and development environments. Our development apps are configured to Dev schema and Production apps are configured to Prod schema, so when we restore the db from production to development environment, all our dev apps stopped working since the objects \ securable will be using prod schema. Here I need to change the schema to dev from prod, so the syntax will be like below

Read more »

VN:F [1.9.13_1145]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)

Script to Retrieve Security Information – SQL Server 2005 and above

In my working environment I’ve asked to write a script to find security information which should return Server Logins, Database Logins and object level permissions. I’ve written that and I’m sharing this to you since this could be helpful to you.

Read more »

VN:F [1.9.13_1145]
Rating: 4.8/5 (4 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 3 votes)

Script to Retrieve Security Information – SQL Server 2000

In my working environment I’ve asked to write a script to find security information which should return Server Logins, Database Logins and object level permissions. I’ve written that and I’m sharing this to you since this could be helpful to you.

Read more »

VN:F [1.9.13_1145]
Rating: 5.0/5 (4 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)