Monday, August 27, 2012

SQL Server MetaData Functions

fn_helpcollations() -- Lists all the collations supported by SQL Server
select * from sys.fn_helpcollations()

fn_servershareddrives() -- Lists all shared drives used by cluster
select * from fn_servershareddrives()

fn_virtualfilestats(DatabaseId, FileId) -- Displays I/O statistics for data and log files.
select * from fn_virtualfilestats(1,1)
select * from fn_virtualfilestats(DB_ID('kalyandb'),1)
select * from fn_virtualfilestats(DB_ID('kalyandb'),2)
select * from fn_virtualfilestats(Null,Null)

 fn_virtualserverfilemodes() -- Displays clustered instance nodes

Saturday, August 25, 2012

Recommended SQL Server files to be in anti-virus exclusions

Below SQL Server related files can be included in exclusion list of Anti-Virus, because the files may locked while scanning or sometimes anti-virus may prevent accessing them or we may face performance degradation while accessing them.

.Mdf -- SQL Server Primary Data File
.Ldf  -- SQL Server Transaction Log File
.Trn  -- Transaction Log Backup
.Bak -- Full Backup
.Diff  -- Differential Backup
.Ndf  -- SQL Server Secondar Data File
.Sql   -- SQL Script Files




Friday, August 24, 2012

Fix : Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration Manager

Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration Manager.
Invalid class [0x80041010]

When I am trying to open SQL Server 2012 configuration manager i got the above error, To fix this

1. search for the file "sqlmgmproviderxpsp2up.mof"  (usually it is located under shared folder under version folder).
2. After locating the file, open command prompt and run the below command
mofcomp C:\Program Files (x86)\Microsoft SQL Server\110\Shared\sqlmgmproviderxpsp2up.mof
Output
Microsoft (R) MOF Compiler Version 6.1.7600.16385
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: C:\Program Files (x86)\Microsoft SQL Server\110\Shared\sqlmgmp
roviderxpsp2up.mof
MOF file has been successfully parsed
Storing data in the repository...
Done!
3. After it is stored in the repository, close the SSMS if it already open
4. Now open SQL Configuration manager, it will work.