Archive for August 2013

TSQL to help with mirroring failover

We ran a mock fail-over from our staging cluster to an offsite mirror server today. Here’s a few queries I used to help me get this done. I first took a backup of the SQL Agent jobs status on each server so I could easily return the jobs to their previous status on each server. […]


Have you ever tried using INFORMATION_SCHEMA.ROUTINES in SQL Server for searching for all procs referencing a specific object? Perhaps something like this; ?View Code TSQLSELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE ‘%table_name%’; Has this ever bitten you? If not then you’ve been lucky so far. The ROUTINE_DEFINITION column is limited to 4000 characters so you […]

Twitter lists with Tweet-SQL 3.6

Here’s a quick post about viewing Twitter lists with Tweet-SQL 3.6. First you can view your lists by running; ?View Code TSQLEXEC dbo.tweet_lists_list null, null, null; This will show the lists followed by the authenticating user. To work with specific list tweets copy the appropriate @list_id into the script below and execute it. ?View Code […]

The job failed. Unable to determine if the owner (sa) of job has server access.

If you have failing SQL Agent jobs with the following error; The job failed. Unable to determine if the owner (sa) of job has server access. and the following is logged in the SQL Server Log; Message [298] SQLServer Error: 15281, SQL Server blocked access to procedure ‘dbo.sp_sqlagent_has_server_access’ of component ‘Agent XPs’ because this component […]

Moving user databases the TSQL way

Here’s a few queries I built to construct the commands needed to move user database files in SQL Server 2208 R2. The queries are based on the procedure outlined here. As with all scripts on the Internet take care with this. It worked fine for my circumstances but may not in yours. Be careful and […]