Friday, October 29, 2010

Deploying SQL Server 2005 with SAN #1

Microsoft  recommendation is to use RAID 10 both for logs and data/index files. When cost is an issue you could allocate data and index files on RAID 5 or equivalent; however, keep logs on RAID 10.

RAID 10 offers better availability than RAID 5 and better performance especially for write-intensive applications. Some of our customers have reported up to 50% adverse impact on write intensive work load when moving to RAID 5. The impact on performance of RAID 5 is dependent on the hardware vendor’s implementation of RAID 5 and the characteristics of your particular work load. You should not assume that you will get a 50% adverse impact – it could be higher or lower.

Monday, October 25, 2010

SQL Server Error Logs

View SQL Server Error Logs in Query
EXEC xp_readerrorlog   -- (current error log file)
EXEC xp_readerrorlog 3 -- (error log file number #3)

You can re-cycle the error log by executing the DBCC ERRORLOG command (or) the sp_cycle_errorlog system procedure.

Saturday, October 23, 2010

How to Enable the Lock Pages in Memory Option on Windows Server

The Windows policy Lock Pages in Memory option is disabled by default. This privilege must be enabled to configure Address Windowing Extensions (AWE). This policy determines which accounts can use a process to keep data in physical memory, preventing the system from paging the data to virtual memory on disk. On 32-bit operating systems, setting this privilege when not using AWE can significantly impair system performance. Locking pages in memory is not normally required on 64-bit operating systems. You will need to enable this right on 64-bit operating systems only when using Large Page Memory support or to configure SQL Server such that the Buffer Pool memory does not get paged out. Use the Windows Group Policy tool (gpedit.msc) to enable this policy for the account used by SQL Server 2005 Database Engine. You must be a system administrator to change this policy.

To enable the lock pages in memory option

1.On the Start menu, click Run. In the Open box, type gpedit.msc.
The Group Policy dialog box opens.
2.On the Group Policy console, expand Computer Configuration, and then expand Windows Settings.
3.Expand Security Settings, and then expand Local Policies.
4.Select the User Rights Assignment folder.
The policies will be displayed in the details pane.
5.In the pane, double-click Lock pages in memory.
6.In the Local Security Policy Setting dialog box, click Add.
7.In the Select Users or Groups dialog box, add an account with privileges to run sqlservr.exe.

Monday, October 18, 2010

Login failed for user 'DomainName\SQLAdmin'. (.Net SqlClient Data Provider)

Login failed for user 'DomainName\SQLAdmin'. (.Net SqlClient Data Provider)

Go to Start, Programs, SQL Management Studio -- Right Click on that and say Run as Administrator. Now pass your credentials.
This will allow to you open SSMS for your login(SQLAdmin).

But if you need to fix permanently The user SQLAdmin must be part of Local administrator group of the server and should have full rights to access SQL server installation path like C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER

Thursday, October 14, 2010

Find the Database is set for snapshot_isolation

SELECT name,snapshot_isolation_state,
snapshot_isolation_state_desc AS Descriptions FROM sys.databases

Check the Merge Replication Generation by date wise

select convert(varchar(12),coldate)as Dates , count(*) as generation
from MSmerge_genhistory (nolock)
where year(convert(varchar(12),coldate))= '2010'
group by convert(varchar(12),coldate)
order by convert(varchar(12),coldate)

Tuesday, October 12, 2010

Monitor Replication in SQL 2005

The following list of sps really useful to get more information from distribution database to monitor replication.

use distribution

select * from MSPublisher_databases

Check Merge Replication Confilicts 2005

CREATE PROCEDURE [dbo].[DBA_MonitorMergeConflicts]
Purpose : Check Merge Replication Confilicts and send
an email notification to DBA
Declare @iCnt int
Select @iCnt = count(*) from NorthWind.dbo.MSmerge_conflicts_info
--Print @iCnt

If @iCnt > 0
 EXEC msdb.dbo.sp_notify_operator
 @profile_name = N'DBAMail',
 @name = N'dba',
 @subject = N'Merge Conflicts Notification',
 @body = N'There are Merge Replication Conflicts Please check the  View Conflicts to Resolve' ;

Friday, October 08, 2010

Find SQL Server Information


Find Linked Server Details


Transfer Backup File to another server do not use xp_cmdshell

By default in SQL Server 2005 and 2008 xp_cmdshell is disabled for security reason.

Instead of using xp_cmdshell you can create batch file to transfer bak file copy to another server

The TransferBackupFile contains the following line of command

Copy E:\mssql\backup\mydb.bak \\ServerName\E$\MSSQL\Backup  /y

The merge process was unable to deliver the snapshot to the Subscriber

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\ReplData

Solution : Change default snapshot folder settings to full qualified network name
\\SRVSQL001\C$\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\ReplData

Remove Distribution Database

-- In SQL 2005
exec sp_dropdistributor @no_checks =1, @ignore_distributor = 1;


Find Replicated Database

--SQL 2005/2008

--SQL 2000
select name, databasepropertyex (name,'IsMergePublished') from
select name, databasepropertyex (name,'IsPublished') from