Posts

Timeout Quest

I was on an interesting quest today. I had to troubleshoot why some long-running SSRS reports time out after a fixed period of time. An SSRS report can time out for at least three different reasons. First, the dataset query could have been set to time out (see DataSet Query tab). The default query timeout is 30 seconds. You can set the query timeout to 0 to prevent the query from timing out.

Second, the entire report may be set to time out . By default (see the Site Settings page in the Report Manager), all reports are set to time out after 1,800 seconds (30 minutes) but the report timeout can be overridden at the report level by using the report execution properties. When the report timeout is up, the Report Server simply terminates the report.

Finally, if your application calls down to the RS Web service to run a report (the Render API), the web service call may timeout. That’s because in .NET, the web service proxy has a Timeout property.

As usual, as one of the first step of troubleshoot an SSRS issue, I fired up the SysInternals DebugView tracer to watch the output from the Report Server. It turned out that the reports would time out after exactly three minutes. When this happened, the Report Server would gently complain that the ASP.NET thread had terminated without throwing an exception. This led me to believe that this issue was outside the Report Server. After further digging, it turned out that the proxy Timeout was set to 180 seconds. Setting it to -1 solved the problem. Keep in mind though that the IIS could also terminate a long-running report, e.g. if the IIS 6.0 application pool is set to terminate long-running threads.

Swapping the RS Catalog

Sometimes, you may need to swap the RS catalog database. For example, you may need to clone the catalog database from a production machine to troubleshoot an issue. One way to do so is to replicate the report items (report definitions, data sources, images, etc.). Another, and perhaps faster, way is to copy the report catalog database and redirect the Report Server temporarily to the new catalog by using the handy Reporting Services Configuration Manager (new with RS 2005). The following steps worked for me to redirect my local SSRS instance (SP1+hotfix) to a different catalog (from SSRS 2005 RTM).

  1. Use the SQL Server Management Studio to create a new database, e.g. ReportServerTest.
  2. Create a new database ReportServerTestTemp to serve as the Report Server Temp database.
  3. Back up the production database you need to troubleshoot.
  4. Restore the production database to ReportServerTest. Make sure to rename the database files by flipping to the Options tab (e.g. rename the files to ReportServerTempDB.mdf and ReportServerTempDB_log.mdf)
  5. Back up the production instance of the ReportServerTemp database and restore it to ReportServerTestTemp (again rename the database files).

Note: As its name suggests, the ReportServerTemp database is just a temporary database used by the Report Server for session caching. Since you don't need its data, you can restore (copy) it from any RS temp database.

  1. Open the Reporting Services Configuration Manager (Microsoft SQL Server 2005 program group -> Configuration Tools -> Reporting Services Configuration) and switch to the Database Setup tab (see attached screenshot). 
  2. Enter the name of the new Report Server database (ReportServerTest) and hit Apply. If your SSRS instance is newer version of SSRS 2005 (e.g. SP1), you will be prompted to upgrade. If all is well and you don't see error and warning messages, the Report Server will be re-configured to use the new database. If at this point you try to connect to the Report Server (e.g. /reportserver/) you will get the rsReportServerNotActivated error. The reason for this is that the Report Server cannot decrypt the content of the new catalog with its encryption key.
  3. In the Reporting Services Configuration Manager, flip to the Initialization tab. You should have two report two rows (see attached file) in the grid corresponding to your local computer name (initialized) and the computer which hosted the report catalog you restored. Let's assume you don't have connectivity to the remote machine and you cannot connect to it.
  4. Open the command prompt and execute:

     "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\RsKeyMgmt.exe" -d

This will effectively remove any encrypted content, including connection and subscription credentials.

Note: If you have a backup of the encryption keys from the source server, to prevent losing the encrypted content you can restore the encryption keys on the target server by executing the following commands in the order shown: rskeymgmt –e, rskeymgmt –r, and then rskeymgmt –a.   

  1. At this point the Report Server should be initialized. You may need to go back to the Initialization tab and click Initialize (you should have only row with your computer name).
  2. You can now open the Report Manager and change the connection strings for the data sources .
  3. Once you done testing, go back to Reporting Services Configuration Manager and flip the catalog database to the original ReportServer database.

Cumulative hotfix package (build 2153) for SQL Server 2005 is available

Microsoft has released a post-SP1 hotfix which addresses various bugs and issues in SQL Server 2005 and its add-on services.  

Custom Report Items (When You Are Too Sexy For Standard Report Items)

One of the most exciting (but not well known and documented) extensibility areas of SSRS 2005 is custom report items (CRI). As its name suggests, custom report items allow you to implement your own reporting controls when the standard SSRS report items (textbox, chart, table, matrix, etc.) are not enough. For example, the attached screenshot shows a report that uses a CRI I wrote to show a KPI value graphically.


If you have experience in developing Windows Forms .NET controls, you will feel immediately at home with CRI. In fact, I dare say that you can take the GDI+ source code of any Windows Forms.NET control and convert it easily to an SSRS CRI. As you can imagine, it won’t be long before third-party vendors come up with all sorts of cool SSRS widgets.


If you want to learn more about CRI, check out the PolygonsCRI sample which Chris Hays wrote. It is included with the latest refresh of the SQL Server 2005 samples. I have an article in the works for MSDN Magazine that explains the implementation details of a progress tracker CRI.. I will post an update here when the article is available (most likely July-August issue of MSDN Magazine).

Phantom Data Extensions

There are two “shy” data extensions that come with RS 2005 but you won’t see when you create a data source.


The first one (SSIS data extension) enables interesting integration scenarios with SQL Server 2005 Integration Services. It allows you to author reports that use data generated by running an Integration Services (SSIS) package. The second one is the SAP data extension for integrating SSRS with mySAP Business Suite.


By default, these extensions are disabled and commented in the rsreportserver.config file:
<!– <Extension Name=”SSIS” Type=”Microsoft.SqlServer.Dts.DtsClient.DtsConnection,Microsoft.SqlServer.Dts.DtsClient, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91″/> –>
<!– <Extension Name=”SAP” Type=”Microsoft.Adapter.SAP.SAPConnection,Microsoft.Adapter.SAP.SAPProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/> –>


Why are these extensions doomed to obscurity, you may ask? The reason is that they have setup dependencies. It could have been nice if the SQL Server 2005 setup program could verify these dependencies (e.g. if SSIS is selected for install) and enables the extensions accordingly so the users know about their existence but this feature was cut out due to time constrains. Assuming that you install the required components, you can just comment out the extension to enable it.

Join me in the "hub"

I’ve just learned that I’ve been selected to present at TechEd 2006 US in Boston! I’ve been honored to present Reporting Services for three consecutive years at TechEd. This time, I will change things a bit and instead of focusing on the development area, I will talk about integrating Reporting Services and Analysis Services. As of now, the main topics I am planning to include are:


1. SSAS report actions
2. MDX Query Designer
3. Server aggregates
4. Building data mining reports
5. Ad-hoc reporting
6. CLR integration


See you in the “hub”!

Building Report-enabled Applications with the New ReportViewer Controls (Part 2 of 2)

In the first part of this article, you saw how to use the Windows Forms version of the ReportViewer control. The second installment walks you through the differences and discusses the process for using the Web version of the control.

SQL Server Express Advanced Services Beta Announced

Euan Garden (Product Unit Manager for SQL Server) tells us that SQL Server Express Advanced Services (which includes Reporting Services Express) has reached a beta stage. I emphasized the importance of choosing the right RS edition in one of my previous blogs.

Building Report-enabled Applications with the New ReportViewer Controls (Part 1 of 2)

DevX has just published Part 1 of my article Building Report-enabled Applications with the Windows Forms ReportViewer. Part 2 (ASP.NET ReportViewer) should be out by the end of February.

Reporting is an integral part of every complete application. The Report Viewer controls greatly reduce the development effort required to report-enable .NET applications. Part one of this two-part article shows you how you can leverage the Windows Forms ReportViewer to integrate your Windows Forms .NET applications with Reporting Services 2005.  

Logging Report Builder Queries

As you probably know, the RS 2005 Report Builder lets business users create ad-hoc reports. Behind the scenes, the Query Translator converts the report metadata to the native queries supported by the relational data source (SQL Server and UDM with RS 2005 only). If you want to see the underlying queries, you have two choices:


1. You can use the SQL Server Profiler and examing its trace.


2. You can log the queries to the RS log files or watch them realtime by attaching a trace listener (e.g. the SysInternals DbgView). To enable this option, open the Report Server web.config file and change the Components element as follows:


<add name=”Components” value=”all,RunningJobs:3,SemanticQueryEngine:2,SemanticModelGenerator:2″ />


<add name=”Components” value=”all,RunningJobs:3,SemanticQueryEngine:3,SemanticModelGenerator:2″ />


Alternatively, you can omit the SemanticQueryEngine element whatsoever. The net effect of doing so will be escalating the trace switch to 4.


You may find this article useful in case you need to learn more about the Report Builder architecture.