Thursday, June 21, 2012

Terminology

RTM means Release to Manufacturing. It is the original, released build version of the product, i.e. what you get on the DVD or when you download the iso file from MSDN.
A Hotfix is designed to fix a single issue, usually after a case has been escalated through Microsoft CSS to the SQL Server Product Team.
Cumulative Update is a cumulative package of hotfixes (usually 20-40) that also includes all previous cumulative updates for that Service Pack. Cumulative Updates are not fully regression tested. Cumulative Updates are released every eight weeks.
Service Pack is a much larger collection of hotfixes that have been fully regression tested. Service Packs are typically released every 12-18 months.

Difference between....

What is difference between database Mirroring and Replication

1. In Replication we can do object level copying where Mirroring is databse level.

2. There is no automatic fail over in Replication where as in Mirroring it is possible

3. We can maintain as many as subscription server in Replication in Mirroring there is only one primary server and one Mirror.

Difference between lazy writer and checkpoint ?
Lazy Writer
Lazy writer finds dirty pages in the buffer pool and write them to disk and drop out those pages from cache. It does this to keep certain amount of free pages available with in the buffer pool for data that may be requested by other queries.The pages that it writes out are 'older pages' , ones that haven't been used for a while.
If there are lot of available buffers, the lazy writer will be doing relatively little work and the number of pages written to disk will be quite low. If the lazy writer's consistently writing lot of data, it may indicate that there is memory bottleneck. In short lazy writer concentrates on clearing out older buffer pages.
Checkpoint
The checkpoint process also writes dirty pages to disk but there it has no interest in keeping available buffers or memory pressure.The job of the checkpoint is to keep the potential time needed to recover the database to a small value.

What is the difference between Checkpoint_duration and Recovery_interval ?
Checkpoint_duration is how long the checkpoint can run for. Recovery_interval affects how often it runs.
Using checkpoint duration to force the checkpoint to run in less time will increase IO, because it’s forcing the X amount of writes to be done in a shorter time than SQL would be default.
Using recovery interval to make the checkpoint run more often will reduce IO, because it has less to do each time it runs.

Wednesday, June 13, 2012

Script to see only errors in SQL error log

When we encouter some issue in SQL , first we check SQL errorlog. As lot of other information is also present in errorlog sometimes it takes time to reach to actual error.Here is small script which you can use to efficiently fetch errors from errorlog.

CREATE TABLE #errorlog_info
  (
     logdate     DATETIME,
     processinfo VARCHAR(30),
     text_data   VARCHAR(MAX)
  )
INSERT INTO #errorlog_info
EXEC Sp_readerrorlog
SELECT *
FROM   #errorlog_info
WHERE  processinfo != 'backup'
       AND text_data LIKE '%error%'
DROP TABLE #errorlog_info

Monday, June 4, 2012

Ghost Records

When you delete data in your database, SQL Server can mark those objects as "ghosts" (meaning that deletion is pending) and clean them up later by using a background task. This process is called Ghost Record Cleanup. Ghost Record Cleanup improves the performance of the DELETE command because SQL Server doesn't have to deal with the physical cleanup right away.