When a server is set up with SQL Clustering, generation of SQLDIAG output may require additional steps. This article describes how to connect to and execute SQLDIAG.exe against clustered SQL Server 7.0 installations and clustered SQL Server 2005 instances or clustered SQL Server 2000 instances locally and remotely.
SQL Server 7.0 EnterpriseTo retrieve SQLDIAG and WINMSD information from a clustered SQL Server 7.0 server, follow these steps:
- Connect to the virtual server using Query Analyzer.
- Run the following command to obtain the SQL Server information:
xp_cmdshell 'shared drive\mssql7\binn\sqldiag -E -O local drive\SQLdiag.txt'
- Run the following from a command prompt to get the system information: Executing the code creates a file named Nodename.txt in the directory from which WINMSD was executed. For more information about WINMSD parameters, run the following from a command prompt:
winmsd \\<nodename> /a /fOn a computer that is running Microsoft Windows 2000, the correct syntax for WINMSD is:
winmsd /computer mycomputer /report myreport.txt
SQL Server 2000 Enterprise EditionThis articles presents three options for for running the SQLDIAG utility on a clustered SQL Server 2000 instance.
Option 1To run the SQLDIAG utility on a clustered SQL Server 2000 instance, follow these steps:
- Connect to the virtual SQL Server by using Query Analyzer.
- Run the following command to obtain the SQL Server information: Note Omit the -I option to connect to the default clustered instance of SQL Server.
xp_cmdshell 'full path for the Binn folder\sqldiag.exe -Iinstancename -Ooutputfile –E -C'
For more information about the SQLDIAG utility and its arguments, see the "sqldiag Utility" topic in SQL Server Books Online.
The advantage to running the SQLDIAG utility by using the xp_cmdshell extended stored procedure is that you do not have to be logged on locally to the active node of the cluster. For example, assume that you have a named virtual SQL Server 2000 server: VSQL2\INST2 (where the SQL Network Name is VSQL2 and the SQL Server instance name is INST2). The full path to the BINN folder is C:\Program Files\Microsoft SQL Server\MSSQL$INST2\Binn. To run the SQLDIAG utility, open Query Analyzer. Connect to VSQL2\INST2, and then run the following command:
exec master..xp_cmdshell ' "C:\Program Files\Microsoft SQL Server\MSSQL$INST2\Binn\sqldiag.exe" -I INST2 -E -C'
- Open a DOS command window on the node on which the clustered SQL Server 2000 instance is running.
- Move to the BINN folder. By default, the BINN folder for a clustered SQL Server 2000 default instance is C:\Program Files\Microsoft SQL Server\MSSQL\BINN. The default BINN folder for a named instance is C:\Program Files\Microsoft SQL Server\MSSQL$NAMEDINSTANCE\BINN.
- Type set _CLUSTER_NETWORK_NAME_=SQL NETWORK NAME, and then press ENTER.
Note The SQL NETWORK NAME is the SQL Server virtual name for a named instance. This is only the first part of the name. For example, if the instance name is VSQL2\INST2, the SQL NETWORK NAME is VSQL2.
- Type sqldiag -Iinstancename -Ooutputfile -E -C, and then press ENTER. If your Windows account is not mapped to the sysadmin role in SQL Server, you can replace -E with –Uuser_name -Ppassword and pass in an account that is mapped to the sysadmin role.
Note Omit the -I option to connect to the default clustered SQL Server 2000 instance. For more information about the SQLDIAG utility and its arguments, see the "sqldiag Utility" topic in SQL Server Books Online.
For this example, assume that your SQL Network Name is VSQL2, and that the SQL Server instance name is INST2. To run the SQLDIAG utility on your clustered SQL Server 2000 named instance, follow these steps:
- Open a DOS window.
- Type the following commands on separate lines:
CD C:\Program Files\Microsoft SQL Server\MSSQL$INST2\Binn
sqldiag –I INST2 –Oc:\sqldiag_INST2.txt -E -C
To run SQLDIAG and connect to a specific virtual server, you must add the program to the disk group that owns that instance of SQL Server. Additionally, because SQLDIAG runs in a command window, the resource is started on the node that owns it. If no output is generated, SQLDIAG might be connecting through a local pipe. If the cluster has failed over to another node before running SQLDIAG, the local pipe connection fails and you do not get any SQL Server information.
Option 2To run SQLDIAG on a clustered SQL Server 2000 instance, follow these steps:
- Open Cluster Administrator.
- Create a New Resource. To create a New Resource, follow these steps:
- Right-click the Disk Group that has the SQL Server instance, point to New, and then click Resource.
- Type a name in the Name box.
- You can type a description in the Description box. However, the description is optional.
- In the Resource Type box, click to select Generic Application.
- In the Group box, click to select the Disk Group that owns the SQL instance.
- Clear the Run this resource in a separate Resource Monitor check box.
- Click Next.
- The Possible Owners dialog box appears. By default, both nodes are available to bring the new resource on line. If this is not the case, it is a possible indicator of a problem node. When satisfied with possible owners, click Next.
- In the Dependencies dialog box, select SQL Network Name (Desired Instance) from the Available Resources list. Click Add to add the selected resource as a dependency, and then click Next.
- In the Generic Application Parameters dialog box, type Cmd.exe in the Command line box.
- Type the following in the Current Directory text box:
Current Directory = %WINDIR%\System32Note You must enter the actual path of the windows directory.
- Click to select the Allow application to interact with desktop check box.
- Check the Use Network Name for computer name check box.
- Click Next.
- In the Registry Replication dialog box, click Finish.
- After you save the resource, you can edit the properties for the resource. On the Advanced tab for the resource, click Do not restart.
- Bring the generic application online. To bring the resource online, right-click and then click Bring Online. A command shell (command prompt) will open in the background. If the New Generic Application starts online without a command window, make sure that you are on the node that owns the SQLDIAG resource, and that the Allow application to interact with desktop option is selected in the Properties of the generic application.
- Locate SQLDIAG.exe. To do so, in the command shell window, change to the %SQL_DIR%\BINN folder. By default, the path is Program Files\Microsoft SQL Server\MSSQL$%INSTANCE_NAME%\BINN.
- Run SQLDIAG.exe. To run SQLDIAG.exe, in the command shell window, type the following, and then press ENTER:sqldiag -Iinstancename -Ooutputfile -Uuser –PpasswordNote Omit the -I option to connect to the default clustered SQL Server 2000 instance.
Option 3Terminal services does not currently support the remote execution of a Microsoft Windows NT command shell that interacts with the desktop. Therefore, you must use additional measures to generate the SQLDIAG output from a remote location. One solution is to create a command file to run SQLDIAG by using the options you want, and to then host it as a generic application on the cluster. Use these steps to create and host a command file to run SQLDIAG from a remote source:
- Create a directory and a new text file that is named SQLDIAG.cmd on the clustered drive that hosts the instance of SQL Server you want. For example, S:\sqldiag.
- Include the following contents, and edit as appropriate (any paths or options) that are required for your environment:Sqldiag.exe /I%instancename% /E /O%output path and filename%
- In cluster administrator, create the generic application by using steps 1through 2j under "Option 2." For step 2j, use the following parameters:
- Command line = cmd.exe /k s:\sqldiag\sqldiag.cmd
- Current directory = C:\Program Files\Microsoft SQL Server\MSSQL$VINST01\Binn
After you save the resource, edit the properties for the resource. To do so, on the Advanced tab for the resource, click to select Do not restart.
SQL Server 2005 Enterprise EditionFor information about how to connect to and run SQLDIAG.exe against clustered SQL Server 2005 instances locally and remotely, search for "SQLdiag Utility" in SQL Server 2005 Books Online.
SQL Server Books Online; search on: "SQLDiag parameters"
ID članka: 233332 - posljednja izmjena: 10. srp 2008. - verzija: 1