开发者

What is wrong in sql2k8 cluster ?? SMO is failing to get Network instances in cluster Machine...?

I have created SQL Server 2008 cluster(TestMachine1-->Name of Computer).and i have written a c# program to retrieve all the n开发者_C百科/w instances in the lan.

When i run the exe from TestMachine1(where SQLCluster is installed ) i am not getting the instances.when i Debug i am getting Null to the data table rows.

the same exe when i run from TestMachine2(The Machine in the same n/w but standalone machine where Sql standalone installation is there) i get the result??

i dont know what z wrong in cluster?? Cluster is successfully installed without errors and sql also installed without errors...

Here is the code:

        DataTable dt1 = SmoApplication.EnumAvailableSqlServers(false);
        Console.WriteLine("Total Rows in DataTable " + dt1.Rows.Count);
        foreach (DataRow dr in dt1.Rows)
        {
            foreach (DataColumn dc in dt1.Columns)
            {
                Console.WriteLine("{0} = {1}", dc.ColumnName, dr[dc]);
            }
            Console.WriteLine("============================");
        }

        Console.Read();

for cluster setup i am getting "Total rows in Datatable=0 " where as in non cluster machine i am getting "7".what is wrong ???

Any help is greately appreciated.


A cluster instance is will respond to the virtual resource name is installed on, not on any of the nodes that compose the cluster.


As Remus was getting at, it will only find SQL installed locally...Basically it's using the local hosts name because you didn't give it a name, and under the local host name, SQL cluster won't respond. So you need to connect to the virtual name directly...You can find the virtual cluster name from the registry..

HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

if you have the default installed, you'll see it will say something like (depending on the version):

MSSQL10_50.MSSQLSERVER

If you go up to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server

You'll see there is a node called by that instance name, in this case:

MSSQL10_50.MSSQLSERVER)

In there you'll find Cluster which has a ClusterName key...Which has a value of the cluster name...

Edit: I just did some testing in powershell...

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null microsoft.sqlserver.management.smo.smoapplication]::enumavailablesqlservers($false)

(PS: missing [above because stackoverflow is being weird) I got a bunch of stuff, which was sort of random... the MSDN docs state:

The computer running the instance SQL Server might not receive responses to the EnumAvailableSqlServers method in a timely manner. The returned list might not show all the available instances of SQL Server on the network. When you call the EnumAvailableSqlServers method in subsequent tries, more servers might become visible on the network.

http://msdn.microsoft.com/en-us/library/ms210334.aspx

I have to say, I probably wouldn't use this method unless you are just trying to display the results to end users...I wouldn't use it to find a cluster name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜