Tuesday, April 28, 2009

How to search error from SQL Server error log or SQL Server Agent Log?

How to search error from SQL Server error log or SQL Server Agent Log?


We can find the particular error or information from error log by passing below parameters to XP_ReadErrorLog extended procedure.




EXEC 
sys.xp_readerrorlog @p1,@p2,@p3,@p4

@P1 = Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc...


@P2 = Log file type: 1 or NULL = error log, 2 = SQL Agent log


@P3 = Search string 1: String one you want to search for


@P4 = Search string 2: String two you want to search for to further refine the results


Please note all the parameters are optional.

Thursday, April 23, 2009

Error 18456, Severity 14: Login Failed States









































































Error 18456, Severity 14: Login Failed States 
Login Failed states summary
StateDescription
1Only state returned in SQL 2000. Server is in Single-User Mode (2005).
2 and 5Invalid User Id
6Attempt to use a windows login name with SQL Authentication
7Login disabled and password mismatch
8Password mismatch
9Invalid Password
10Read Ref Link #2
11 and 12Valid login but server access failure; Default Database access failure. Or Initial database connection failure in connection string.
13SQL Server service paused
16User doesn't have permission to target database
18Change password required
23Server in process of shutting down, and user attempted to login.
27Initial database could not be determined for session
38Initial database could not be determined for session (SQL 2008)
40Default database could not be accessed (SQL 2008)