Wednesday, May 26, 2010

SQL 2005 Transaction Logs

The transaction log is really a circular file—as long as the log records at the start of the transaction log have been truncated (or cleared).




A log record is no longer needed in the transaction log if all of the following are true:
 The transaction of which it is part has committed.
 The database pages it changed have all been written to disk by a checkpoint.
 The log record is not needed for a backup (full, differential, or log).
 The log record is not needed for any feature that reads the log (such as database mirroring or replication).

A log record that is still needed is called active, and a VLF that has at least one active log record is also called active. Every so often, the transaction log is checked to see whether all the log records in a full VLF are active or not; if they are all inactive, the VLF is marked as truncated (meaning the VLF can be overwritten once the transaction log wraps). When a VLF is truncated, it is not overwritten or zeroed in any way—it is just marked as truncated and can then be reused.
This process is called log truncation—not to be confused with actually shrinking the size of the transaction log. Log truncation never changes the physical size of the transaction log—only which portions of the transaction log are active or not.



The check whether log truncation can take place under either of the following circumstances:

 When a checkpoint occurs in the SIMPLE recovery model or in other recovery models when a full backup has never been taken. (This implies that a database will remain in a pseudo-SIMPLE recovery model after being switched out of SIMPLE until a full database backup occurs.)
 When a log backup completes.



There are two common issues that can prevent log truncation:
 A long-running active transaction. The entire transaction log since the first log record from the oldest active transaction can never be truncated until that transaction commits or aborts.
 Switching to the FULL recovery model, taking a full backup, and then never taking any log backups. The entire transaction log will remain active, waiting to be backed up by a log backup.

Thursday, May 20, 2010

Changing Database COLLATION

1. Litespeed uninstall.

2. set Password and collation execute the following.

D:\Installs\SQL2005ENTSELX64dvd\Servers>start /wait setup.exe /qb INSTANCENAME=MSSQLSERVER REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=******* SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS

3. APPLY CU3

Friday, May 7, 2010

SQL 2005 execute permissions

SQL2005

SQL Server 2005 improves on the current situation by making the EXECUTE permission grantable at the database scope. This means that we can issue a statement like the example below and this will GRANT execute permissions on all existing stored procedures and scalar functions AND all subsequently created ones. Thus it acts very much like the current fixed database roles such as db_datareader

/* CREATE A NEW ROLE */
CREATE ROLE db_executor

/* GRANT EXECUTE TO THE ROLE */
GRANT EXECUTE TO db_executor

Good Website

http://www.jenunderwood.com/resources.htm

Not able to Add Windows Global Group to SQL SERVER 2005

Problem : Not able to Add Windows Global Group to SQL SERVER 2005
Solution : Make sure that net logon service is running