Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Cost Savings and Backup Compression


Let me set the scene, one of our internal IT SQL Servers which stores a whole host of performance metrics has over the last few months’ experienced tremendous growth as we have started to monitor more metrics on more servers.  A routine we have in place to collect and report…

Read more

0 comments, 617 reads

Posted in SQL Server 365 on 8 August 2012

Database Tables


Today I was asked for "a list of all tables in all databases" on a particular instance of SQL Server.  Knowing what was actually required was all "User" tables in all "Accessible" "User" databases I wrote the script below . It will return the ServerName, DatabaseName, SchemaName and TableName of…

Read more

0 comments, 354 reads

Posted in SQL Server 365 on 13 June 2012

Rebuilding System Databases


Today’s post is something I thought I would share as there is an awful lot of incorrect commands I have seen (and some even tried) in the past around rebuilding system databases.  Now first off let me explain that rebuilding system databases is no straight forward task.  I would avoid…

Read more

1 comments, 280 reads

Posted in SQL Server 365 on 2 April 2012

Why I don’t like maintenance plans


If you create a maintenance plan (SQL 9.0.3042) to backup databases and select All databases as below;


















Then at some point in the future if one of the databases is taken offline the job created by the maintenance plan will fail.

From what I have seen the job will still…

Read more

0 comments, 323 reads

Posted in SQL Server 365 on 16 March 2012

How Resilient Is Your Recovery Plan?


In this modern age of technology DBA’s face an ever increasing demand from businesses; our databases must perform, be secure, highly available and scalable and equally as important recoverable.  There is an obsession with the 5 9’s within the industry, and rightly so, but just how resilient is your recovery…

Read more

0 comments, 278 reads

Posted in SQL Server 365 on 14 March 2012

A Script A Day Finished!

Well that's it, my "A Script A Day" series is finished.  I hope you found the scripts I provided useful, I've used all the scripts in real world DBA tasks.  I tried to provide a variety of scripts covering a number of different areas.  This series I feel will appeal more to…

Read more

0 comments, 282 reads

Posted in SQL Server 365 on 3 March 2012

A Script A Day - Day 29 - The Importance of Being Idle

Today’s script is also one I used in my migration on Wednesday.  It again uses string manipulation to generate a script, this time the restore database script.  Now granted this quick script wouldn't work if there are any secondary data files and is reliant on the logical file names and file locations…

Read more

0 comments, 232 reads

Posted in SQL Server 365 on 2 March 2012

A Script A Day - Day 28 - String Manipulation

Today’s script is one that I used earlier this week.  On Thursday I migrated a server from SQL Server 200 to SQL Server 2008 R2.  Now I love migrations, I don’t think I’m weird but I buzz off the addrenaline rush when working under pressure and I get a great…

Read more

0 comments, 231 reads

Posted in SQL Server 365 on 2 March 2012

A Script A Day - Day 27 - Missing Database Backups

Today’s script is one I have used many times in the past to check for missing backups.  The script will return the database name and the last full backup date of all databases that are in the FULL recovery model and have not had a FULL database backup in the…

Read more

0 comments, 647 reads

Posted in SQL Server 365 on 29 February 2012

A Script A Day - Day 26 - RESTART a Database Restore

Today’s script is another one based on database restores.  There is a little known clause of the RESTORE DATABASE command called RESTART.  The name of this clause is deceptive, it does not RESTART anything and should actually be called RESUME or CONTINUE.  What it allows you to do is to…

Read more

0 comments, 710 reads

Posted in SQL Server 365 on 29 February 2012

A Script A Day - Day 25 - Performance Counters

Today’s script is based on performance counters and in particular the sys.dm_performance_counters DMV.  There are many ways in which to view and collect performance counters the most common of which is to use perfmon.  Powershell is another method, I am currently working on a project where I will be collecting…

Read more

0 comments, 772 reads

Posted in SQL Server 365 on 29 February 2012

A Script A Day - Day 24 - Object Qualification

Today’s script is one I use as an example to explain that there is method behind my standards that some people initially see as madness.  I’m sure some people think I am trying to make their job harder and that I get a kick out of telling them to “go…

Read more

0 comments, 498 reads

Posted in SQL Server 365 on 28 February 2012

A Script A Day - Day 23 - Find an Object In Job Steps

Today’s script is one which saves me a lot of time on occasion.  On large systems with lets say more than 100 jobs it is esential to manage them properly and the smallest thing like naming conventions help a lot.  So what if you want to check if an object…

Read more

0 comments, 262 reads

Posted in SQL Server 365 on 27 February 2012

A Script A Day - Day 22 - Database Backup

Today’s script follows on from Day 16’s script which was about database restores.  In a backwards way the script is a simple backup database script with two backup commands.  For all my production servers I have custom maintenance routines which take care of transaction log and full backups along with…

Read more

0 comments, 241 reads

Posted in SQL Server 365 on 27 February 2012

A Script A Day - Day 21 - The HAVING Clause

Today’s post is about the HAVING clause which specifies a search condition for a group or an aggregate. HAVING is typically used in a GROUP BY clause and the two biggest uses I have for HAVING are SUM() for reporting and COUNT() for hunting down invalid data.  In the script…

Read more

0 comments, 186 reads

Posted in SQL Server 365 on 27 February 2012

A Script A Day - Day 20 - User Database VLF Count

Today’s script will execute DBCC LOGINFO for all user databases.  This is a script I use to monitor the number of Virtual Log Files (VLF’s).  Kimberly Tripp has a great article on VLF’s here.

/*
      -----------------------------------------------------------------
      User Database VLF Count
      -----------------------------------------------------------------
     
      For more SQL…

Read more

0 comments, 733 reads

Posted in SQL Server 365 on 25 February 2012

A Script A Day - Day 19 - Remove Virtual Subscriptions

Today’s script is to help replication performance.  It was something I learned from my resident replication expert Paul Anderton.  Below is a description of virtual subscriptions.

If Immediate_Sync is set when a publication is created then virtual subscriptions can occur.  These can affect the "Distribution Clean Up: distribution" SQL job…

Read more

0 comments, 800 reads

Posted in SQL Server 365 on 25 February 2012

A Script A Day - Day 18 - Viewing System Configuration

Today’s script is something I’ve learned today, it’s cool learning new stuff!  When viewing server configurations in the past I’ve used the below;

EXEC sp_configure 'show advanced options',1;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure;
GO

This is all fine when making changes to the…

Read more

0 comments, 250 reads

Posted in SQL Server 365 on 23 February 2012

A Script A Day - Day 17 - Possible Poor Indexes

Today’s script is one I’ve taken from a job I use to collect possible poor indexes.  I’ve tweeked it slightly so you can choose the database to run it against. 

It goes without saying that you should never just remove an index without some considerable investigation doesn't it???!!!

/*
      -----------------------------------------------------------------
     …

Read more

0 comments, 232 reads

Posted in SQL Server 365 on 23 February 2012

A Script A Day - Day 16 - Database Restore

Today’s script is one I have used more times that I care to remember.  As a DBA database backups and restores are your bread and butter, they are second nature (or should be;).  By this I mean good old T-SQL not using SSMS, I can honestly say I have never…

Read more

0 comments, 224 reads

Posted in SQL Server 365 on 22 February 2012

Newer posts

Older posts