I ran into a problem recently that really had me scratching my head for awhile: when I launched the Windows Store on Windows 8.1 with a new user, the store itself failed with an error. The error message in the Store app read, "We weren't able to connect to the Store. This might have happened because of a server problem or the network connection timed out. Please wait a few minutes and try again. (0x80004005)."
The annoying thing about this (besides it not working) was that it pretty clearly wasn't trying to access the store: the app itself was failing before even having the chance to time out.
This error persisted through reboots, and it only affected a new user. Creating another new user (local or MS account) had the same effect: the store errored out. New apps that attempted to install as part of a sync from another computer too, would fail in installing.
Saturday, November 30, 2013
Friday, September 27, 2013
Scripting SQL Server Error Log Location in TSQL Queries
While it's possible to view the SQL Server error log location in the SSMS GUI, sometimes you want to build a script that'll write a log to the same directory as the error log; we don't want to have to modify our script for every server it runs on.
Enter the ServerProperty function. There is at least one undocumented server property 'errorLogFilename' that will give us the full path to the SQL ERRORLOG. This is nice, as we can simply run this to return that:
Enter the ServerProperty function. There is at least one undocumented server property 'errorLogFilename' that will give us the full path to the SQL ERRORLOG. This is nice, as we can simply run this to return that:
SELECT SERVERPROPERTY('ErrorLogFileName');
Labels:
scripting,
SQL Server
Wednesday, September 25, 2013
Executing SQL Server Batch Statements Within One Exec(sql) Call
When you need to GO in your batch
Sometimes you'll run into a situation where you want to script a series of SQL batch statements dynamically. For instance, you might want to create a schema, then create a user to use that schema, then populate that schema with tables, and do that in each database that runs on a SQL instance.If you weren't wanting to do this dynamically, you'd simply do something like this:
use [dbname]; go Create schema [schema_name]; go create user [username] for login [loginname] with default_schema=[schema_name]; go
That's not that big of a deal, really. But if we want to create a cursor to loop through all databases and run this SQL dynamically, we have a problem: we can't have the create schema statement in the same batch as the USE command, so we don't end up creating the schema in the correct database.
Labels:
scripting,
SQL Server
Monday, April 1, 2013
Configuring a SQL Server Email Alert for SA Login Failures
SA Login
SA Login authentication failures, essentially, should never happen. Mostly that's because we generally shouldn't be using the SA account, but rather should have dedicated application logins with appropriate privileges. Having those logins use Windows authentication instead of SQL authentication further removes SQL Server from the authentication process, which is even better.So if the SA account isn't disabled, I want to know when there's an SA login failure.
[Generally, I want to know when there's an SA login success, as well, but we'll focus on the failures, here, because it's really low-hanging fruit.]
SQL Server Alerts
SQL Server Alerts are a very light-weight notification tool for lots of SQL Server events. Brent Ozar has a nice run-down of some basic alerts that you ought to consider implementing; we'll add this one as another.It's possible--and frequent--to address this problem by using login triggers. That is certainly a valid, functional, and well-worn method. Login triggers can introduce problems, though, especially when we have forgotten that they exist. Moreover, this is what alerts are for, and there's something appealing to the simplicity of it all.
Subscribe to:
Posts (Atom)