Readme for Activity Viewer Sample

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.

The Activity Viewer sample is a tool that displays users, connections, and processes for an instance of Microsoft SQL Server Analysis Services. You can use this tool to retrieve a list of these items and, if you want to, to stop a process.

Scenario

Functionality similar to SQL Server stored procedure sp_who and kill command in Transact-SQL.

Languages

C#

Features

The Activity Viewer sample uses the following SQL Server features:

Application Area Features

Overall

AMO, ADOMD.NET

Prerequisites

Before you run this sample, make sure that the following software is installed:

  • Analysis Services

  • Business Intelligence Development Studio

    Note

    Business Intelligence Development Studio is not supported on computers that run the Itanium-based operating system; the 64-bit development environment is supported on x64-based operating systems. SQL Server samples can be modified and run on computers that run either x86 or x64-based operating systems when the databases used by the samples are deployed on an Itanium-based operating system.

  • The AdventureWorks AS database.
    You can download this sample database from the Microsoft SQL Server Samples and Community Projects web site. For more information about how to download and install sample databases, see Installing SQL Server Samples and Sample Databases in SQL Server Books Online.

  • The Activity Viewer sample.
    You can download this sample from the Microsoft SQL Server Samples and Community Projects web site. For more information about how to download and install sample databases, see Installing SQL Server Samples and Sample Databases in SQL Server Books Online.

  • .NET Framework SDK 2.0 or Microsoft Visual Studio 2005.
    The .NET Framework SDK is available free of charge. For more information, see Installing the .NET Framework SDK in SQL Server Books Online.

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.

To generate a strong name key file

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

    -- or --

    Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.

    Note

    To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.

  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk

    Important

    For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.

After you have a strong name key file, you can build the sample using the following procedure.

To build the sample

  1. Compile the sample using one of the following methods:

    • In Microsoft Visual Studio 2005, compile the sample by using the provided Visual Studio solution
      — or —
    • Compile the sample by using MSBuild, which is included in the Microsoft .NET Framework SDK 2.0. At the command prompt, run commands similar to the following command:
      msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS\ActivityViewer\ActivityViewer.csproj
  2. Make sure that the AdventureWorks AS database is installed. Alternatively, create the database where you want to install the samples.

Running the Sample

To run the sample, follow these steps.

To run the sample

  1. Run either bin\Release\ActivityViewer.exe or bin\Debug\ActivityViewer.exe.

    Running either of these executables will show the Analysis Services groups and servers that are registered in SQL Server Management Studio.

  2. To connect or disconnect, right-click a server.

  3. To see details, click the Connection/Session/Transaction/Locks node. You can also right-click the node and select Refresh.

  4. Right-click a connection to see its sessions. Right-click Sessions to see its transactions. Right-click a transaction to see its locks.

  5. To cancel a connection or session, right-click the connection or session, and then select Cancel. Canceled connections and session activities are logged to a tab-delimited text file. By default, the file is located in the same directory as the executable and the file is named Activity.log. You can specify the file name and path in ActivityViewer.exe.config file. Also, you can change the value of TraceActivity property; possible values are as follows: 0= off/no logging, 1=Errors, 2=Warnings, 3=Informational, 4=Verbose. The default value is Verbose = 4.

See Also

Other Resources

SQL Server Analysis Services Samples

Help and Information

Getting SQL Server 2008 Assistance