Search This Blog

Wednesday, March 16, 2011

SQL DBA - Error on Integration Services on SQL 2008 failover cluster

Error Details :

While Creating the SSIS Packages the Following Error Occurs.
TITLE: Microsoft SQL Server Management Studio
------------------------------
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
The SQL Server instance specified in SSIS service configuration is not present or is not available. This might occur when there is no default instance of SQL Server on the computer. For more information, see the topic "Configuring the Integration Services Service" in Server 2008 Books Online.
Login timeout expired
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
Named Pipes Provider: Could not open a connection to SQL Server [2]. (MsDtsSrvr)
------------------------------
Login timeout expired
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
Named Pipes Provider: Could not open a connection to SQL Server [2]. (Microsoft SQL Server Native Client 10.0)
------------------------------

Solution :-
Open the SSIS's "MsDtsSrvr.ini.xml" configure file, by default, it is stored at C:\Program Files\Microsoft SQL Server\100\DTS\Binn, then check if the SQL Server instance name is invalid and you can logon it at the tag


<ServerName > Replace your Virtual Server Name here. </ServerName >


After you modify the SQL Server Name in the configure file, you must restart the service to use the updated service configuration.

SQL DBA - Backup ALL your SQL Server 2005 databases using ONE script

DECLARE @DBName varchar(255)

DECLARE @DATABASES_Fetch int

DECLARE DATABASES_CURSOR CURSOR FOR

select

DATABASE_NAME = db_name(s_mf.database_id)

from

sys.master_files s_mf

where

-- ONLINE

s_mf.state = 0

-- Only look at databases to which we have access

and has_dbaccess(db_name(s_mf.database_id)) = 1

-- Not master, tempdb or model

and db_name(s_mf.database_id) not in ('Master','tempdb','model')

group by s_mf.database_id

order by 1

OPEN DATABASES_CURSOR

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

WHILE @@FETCH_STATUS = 0

BEGIN

declare @DBFileName varchar(256)

set @DBFileName = datename(dw, getdate()) + ' - ' +

replace(replace(@DBName,':','_'),'\','_')

exec ('BACKUP DATABASE [' + @DBName + '] TO DISK = N''c:\db backup\' +

@DBFileName + ''' WITH NOFORMAT, INIT, NAME = N''' +

@DBName + '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD, STATS = 100')

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

END

CLOSE DATABASES_CURSOR

DEALLOCATE DATABASES_CURSOR

Monday, March 7, 2011

SQL DBA - Recovery model, log reuse wait description, log file size, log usage size and compatibility level for all databases on instance

SELECT db.[name] AS [Database Name] ,

db.recovery_model_desc AS [Recovery Model] ,

db.log_reuse_wait_desc AS [Log Reuse Wait Description] ,

ls.cntr_value AS [Log Size (KB)] ,

lu.cntr_value AS [Log Used (KB)] ,

CAST(CAST(lu.cntr_value AS FLOAT) / CAST(ls.cntr_value AS FLOAT)

AS DECIMAL(18,2)) * 100 AS [Log Used %] ,

db.[compatibility_level] AS [DB Compatibility Level] ,

db.page_verify_option_desc AS [Page Verify Option]

FROM sys.databases AS db

INNER JOIN sys.dm_os_performance_counters AS lu

ON db.name = lu.instance_name

INNER JOIN sys.dm_os_performance_counters AS ls

ON db.name = ls.instance_name

WHERE lu.counter_name LIKE 'Log File(s) Used Size (KB)%'

AND ls.counter_name LIKE 'Log File(s) Size (KB)%' ;

SQL DBA - Quick TempDB Summary

SELECT SUM(user_object_reserved_page_count) * 8.192 AS [UserObjectsKB] ,

SUM(internal_object_reserved_page_count) * 8.192 AS [InternalObjectsKB] ,

SUM(version_store_reserved_page_count) * 8.192 AS [VersonStoreKB] ,

SUM(unallocated_extent_page_count) * 8.192 AS [FreeSpaceKB]

FROM sys.dm_db_file_space_usage ;

SQL DBA - Get Free Space in TempDB

SELECT SUM(unallocated_extent_page_count) AS [free pages] ,

( SUM(unallocated_extent_page_count) * 1.0 / 128 ) AS [free space in MB]

FROM sys.dm_db_file_space_usage ;

SQL DBA - List unused indexes

SELECT OBJECT_NAME(i.[object_id]) AS [Table Name] ,

i.name

FROM sys.indexes AS i

INNER JOIN sys.objects AS o ON i.[object_id] = o.[object_id]

WHERE i.index_id NOT IN ( SELECT s.index_id

FROM sys.dm_db_index_usage_stats AS s

WHERE s.[object_id] = i.[object_id]

AND i.index_id = s.index_id

AND database_id = DB_ID() )

AND o.[type] = 'U'

ORDER BY OBJECT_NAME(i.[object_id]) ASC