-
When was the statistics last refreshed
Working with a few clients, I’ve noticed some issues with statistics in Sql Server 2005 not being updated frequently, even if auto stats is turned on at the database level and table level. I’ve noticed this often enough for me to cook up a quick script. Initially I thought that sys.stats catalog view might have…
-
BCP In automation script
A while ago I wrote an article on code generation using Sql. The script I gave in that article can generate BCP (in and out) scripts automatically. I helped out a friend recently, and thought I would share the WMI/VBScript I cooked up with you. This script assumes that all files within a folder need…
-
Bring back the mirror when the principal blows up and there is no witness
Here is the script you can use to bring the mirroring database out of its “Restoring…” coma: alter database MyDb set partner off restore database MyDb with recovery This is useful when you have high performance mirroring setup, your principal blows up, and there is no witness present. At this point, you will have to…
-
Database mirroring on a clustered Sql Server instance
Mirroring is a high availability feature introduced in Sql Server 2005. Combining it with Sql Server cluster, it can buy an insurance policy for your high availability needs, if you will, in that cluster provides one layer of protection, and mirroring provides another layer. You can create a clustered Sql Server instance, which provides protection…
-
Rebuild master database
Recently, the default instance of Sql Server 2005 on my laptop refused to start. Here is the message in the Windows event log: The SQL Server (MSSQLSERVER) service terminated with service-specific error 3417 (0xD59). Here is the message in the Sql Server error log: The log scan number (253:272:1) passed to log scan in database…