Sunday, October 23, 2011

Standardize SQL Server Installations with Configuration Files

ProblemIf you have a requirement to install multiple SQL Server instances with the same settings, you most likely want to do it without following the numerous manual installation steps. The below tip will guide you through how to install a SQL Server instance with less effort.

Solution
http://www.mssqltips.com/sqlservertip/2511/standardize-sql-server-installations-with-configuration-files/

Tuesday, October 18, 2011

Script to get the CPU and Memory Information

You can execute the below script to get the processor and memory information.

[sourcecode language="sql"]
-- Scritp to get Processor Info from Registry
EXEC xp_instance_regread
'HKEY_LOCAL_MACHINE',
'HARDWARE\DESCRIPTION\System\CentralProcessor\0',
'ProcessorNameString';

-- Script to get CPU and Memory Info
SELECT
cpu_count AS [Number of Logical CPU]
,hyperthread_ratio
,cpu_count/hyperthread_ratio AS [Number of Physical CPU]
,physical_memory_in_bytes/1048576 AS [Total Physical Memory IN MB]
FROM sys.dm_os_sys_info OPTION (RECOMPILE);
[/sourcecode]

Customizing the Status Bar for each SQL Server Instance registered in CMS

Problem:
Steps to distinguish production and non-production SQL Servers registered in CMS while executing the query. Below article will guide you how to use customize colors in CMS.

Solution
To identify the production and non-production SQL Instances registered in CMS within the same group; you can use the Custom Color feature. In this article I will guide how to use to the custom color feature of CMS.

Step 1: Connect to Central Management Server (CMS) from SSMS.



Step 2: Right click on the registered CMS server and select properties.


Step 3:Go to Connection Properties tab, checked the Use Custom color box and select the desired color. Click on Save to proceed.


Step 4: Right click on the SQL Instance and Open a new query window. You can see the blue color in the status bar. This way we can identify the production and non-production box. By specifying the custom colors.

Ouput Image of SSMS

Monday, October 10, 2011

T-SQL to Check SQL ErrorLog file location

At the start up of SQL Server records the startup parameter details into the error log.

You can query the error log to check the error log file physical location.

[sourcecode language="sql"]
USE master
GO
xp_readerrorlog 0, 1, N'Logging SQL Server messages in file', NULL, NULL, N'asc'
GO
[/sourcecode]