Monday, September 12, 2011

Backup & Restores of the SQL Server Databases by using Lite Speed


Here are the some of Queries for taking the SQL Server Databases backups & Restore  by using the Lite Speed

Full & Diffencial backup
================
EXEC master.dbo.xp_backup_database @database='DBname'
,@filename='C:\DR_DIFF.BAK'
, @init= 1
, @with = 'DIFFERENTIAL'



T-log backup
========
EXEC master.dbo.xp_backup_log @database = 'DBname'
,@filename='C:\DR_LOG.BAK'
,@init = 1

Restore the database
----------
exec master.dbo.xp_restore_database @database = N'test' ,
@filename = N'Q:\Backup\Test_20130308.bak',
@filenumber = 1,
@with = N'STATS = 10',
@with = N'MOVE N''Test'' TO N''M:\data\Test.mdf''',
@with = N'MOVE N''Test_log'' TO N''H:\logs\Test_log.ldf''',
@affinity = 0,
@logging = 0
GO

Thanks&regards
As Reddy

Thursday, September 1, 2011

SQL Server Service Pack Version numbers



SQL Server 2000
----------------

SQL Server 2005
--------------------
-----------------

SQL 2008
----------

finding HIGH CPU using Query in SQL Server

finding the how CPU usage in SQL Server.which Query using high CPU usage..


SELECT st.text, r.cpu_time FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st
ORDER BY cpu_time DESC