Tuesday, November 25, 2014

SQL daily HealthCheck - My Reference


SQL daily Healthcheck

CPU - System CPU, SQL CPU, max CPU, avg CPU
SQL Log Size > 40%? -dbcc sqlperf(LOGSPACE)
SQL Connection  - How many connection
SQL Active Connection
Blocking ? any blocking, what is the blocking header?
Deadlock?  any deadlock?
Long Run Queries? 
Any SQL Job fail?
Last IO Error?
SQL Error log that need attention
DB Size 
Disk size
SQL 2005 - mirroring status
SQL 2012/SQL 2014/SQL 2016 : AGL Status

Wednesday, September 03, 2014

SQL Related error


SQL IO related error
1. check SQL Server error log
2. Check OS application error log
3. Check if all the drive on line and writeable
4. Try restart SQL Server if drive back online


OS Application Log
Event ID :833
Source    : MSSQLSERVER
SQL Server has encountered <n> occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [<full path of file>] in database [<database name.>] (<dbid>). The OS file handle is <file handle>. The offset of the latest long I/O is: <offset in hexadecimal>
SQL Server logs "Msg 833" when I/O delay problems occur

Event ID : 17053
SQLServerLogMgr::LogWriter: Operating system error 1167(The device is not connected.) encountered.

Event ID :3314
During undoing of a logged operation in database '%', an error occurred at log record ID (53970:95872:3). Typically, the specific failure is logged previously as an error in the Windows Event Log service.
Restore the database or file from a backup, or repair the database

Event ID :9001
The log for database '%' is not available. Check the event log for related error messages.
Resolve any errors and restart the database.


Event ID :3449
SQL Server must shut down in order to recover a database (database ID 2). The database is either a user database that could not be shut down or a system database. Restart SQL Server.
If the database fails to recover after another startup, repair or restore the database.

Event ID:823
The operating system returned error %ls to SQL Server during a %S_MSG at offset % in file '%ls'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

How to troubleshoot a Msg 823 error in SQL Server

Friday, August 29, 2014

Replication - sp_replcmds; Execution of filter stored procedure % failed.

Replication fail with

From Publisher
Replication Monitor
Replication - publisher to Distribution History, we have the below error :
The process could not execute 'sp_replcmds' on '. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011)
Get help: http://help/MSSQL_REPL20011
Execution of filter stored procedure 1820181880 failed. See the SQL Server errorlog for more information. (Source: MSSQLServer, Error number: 18764)
Get help: http://help/18764
The Log-Scan Process failed to construct a replicated command from log sequence number (LSN) {00026ef8:00039201:0004}. Back up the publication database and contact Customer Support Services. (Source: MSSQLServer, Error number: 18805)
Get help: http://help/18805
The process could not execute 'sp_replcmds' on ''. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037)
Get help: http://help/MSSQL_REPL22037


Publisher SQL Server - Error Log
No error

From Publisher, publisher database
run the below query. That might some error in replication filtering.
Select * from sysarticles where filter=1014603790

From SQLServer-> Replication->Local Publication->ReplicationName-> right click -> Properties-> Filter Rows
Check the condition as well

Friday, August 15, 2014

Tuesday, February 11, 2014

SQL 2012 - new function

SQL 2012 - new function

Conversion functions
• PARSE
• TRY_CONVERT
• TRY_PARSE

Date and time functions
• DATEFROMPARTS
• DATETIME2FROMPARTS
• DATETIMEFROMPARTS
• DATETIMEOFFSETFROMPARTS
• EOMONTH
• SMALLDATETIMEFROMPARTS
• TIMEFROMPARTS

Logical functions
• CHOOSE
• IIF

String functions
• CONCAT
• FORMAT

Reference : Programmability Enhancements (Database Engine)