Thursday, August 5, 2010

Wednesday, August 4, 2010

How to truncate transaction log file via sql statement

Sometimes you wish to truncate transaction log file via SQL statement. you don't want to create mess as you would have 24x7 (online) production database and recovery model would also be set to full.

Solution available before SQL SERVER 2005 was very simple. Just run below line and you have achieved your desired results.
backup log dbname with truncate_only

But in SQL SERVER 2005 and above, previous statement generates syntax error as it is no more supported in SQL SERVER 2005 and above. Then what is solution for SQL SERVER 2005 and above. Solution is very simple, a regular BACKUP LOG to a backup device is sufficient. That truncates the log. Use below statements in order to get your desired output
use master
alter database dbname set recovery simple
go
dbcc shrinkdatabase(dbname )
go
alter database dbname set recovery full

go

I hope it will solve your problem

Tuesday, August 3, 2010

Open Source Project Management Tools

Here is list of available project management tools which are currently available for your usage.

  1. Open Proj
  2. Open Workbench
  3. GanTT Project
  4. Trac
  5. Dot Project
  6. Redmine
  7. Achievo
  8. Projectivity
  9. eHour


Find the Most Time Consuming Code in your SQL Server Database

I liked this article. I hope you will also get valuable information from it.

Viewing tempdb Size and Growth Parameters

You can view the size and file growth parameters of the tempdb data or log files by using one of the following methods

SELECT
name AS FileName,
size*1.0/128 AS FileSizeinMB,
CASE max_size
WHEN 0 THEN 'Autogrowth is off.'
WHEN -1 THEN 'Autogrowth is on.'
ELSE 'Log file will grow to a maximum size of 2 TB.'
END,
growth AS 'GrowthValue',
'GrowthIncrement' =
CASE
WHEN growth = 0 THEN 'Size is fixed and will not grow.'
WHEN growth > 0 AND is_percent_growth = 0
THEN 'Growth value is in 8-KB pages.'
ELSE 'Growth value is a percentage.'
END
FROM tempdb.sys.database_files;
GO


Similarly, If the version store is using a lot of space in tempdb, you must determine what is the longest running transaction. Use this query to list the active transactions in order, by longest running transaction.

SELECT transaction_id
FROM sys.dm_tran_active_snapshot_database_transactions
ORDER BY elapsed_time_seconds DESC;

Wednesday, July 7, 2010

Top Ten Questions and Answers on Data

I hope you will love this information posted by Microsoft on MSDN.

Thursday, June 17, 2010

http://gmailblog.blogspot.com/2010/06/tip-5-things-you-may-not-know-you-can.html

http://gmailblog.blogspot.com/2010/06/tip-5-things-you-may-not-know-you-can.html

Monday, June 14, 2010

Extension methods

I liked above article. I hope you will also like it :)

Tuesday, February 2, 2010