:::: MENU ::::

Posts Categorized / dbDigger

  • Oct 03 / 2013
  • 0
dbDigger, Monitoring and Analysis, Reporting Services SSRS, T-SQL Scripts

Scripts for SSRS reports usage analysis

Here are some handy and useful scripts that may be used to analyze the report usage of your SSRS report server. All these are select scripts and are using NOLOCK hint. So feel free to add filters and customize according to your specific requirements.
To get the last Time a Report was generated we have following script. Further filters may be applied if required.

 SELECT DISTINCT C.NAME AS [Report Name]  
   ,MAX(EL.TIMESTART) AS [LAST START TIME]  
 FROM REPORTSERVER.DBO.EXECUTIONLOG(NOLOCK) EL  
 INNER JOIN REPORTSERVER.DBO.CATALOG (NOLOCK) C ON EL.REPORTID = C.ITEMID  
 GROUP BY C.NAME  
 ORDER BY C.NAME  

If you want to analyze that how many reports were viewed on a specific day then we have following script. It generates report usage Stats by Date. It is advisable to insert the name of the account that runs SSRS. The reason is that if you have a report that is run off of cache or has subscription, the counts will show here. So if you want to see reports that have been run by users only then filter out the account that runs the SSRS service.

SELECT CONVERT(VARCHAR(25), TIMESTART, 101) AS [SPECIFIC DATE]  
   ,COUNT(*) AS [Gneerated Number]  
 FROM REPORTSERVER.DBO.EXECUTIONLOG(NOLOCK)  
 --WHERE USERNAME NOT IN  
 GROUP BY CONVERT(VARCHAR(25), TIMESTART, 101)  
 ORDER BY CONVERT(VARCHAR(25), TIMESTART, 101) DESC  

Get the report server usage during the hours.

SELECT DATEPART(HOUR, TIMESTART) AS HOUR  
   ,COUNT(*) AS [Gneerated Number]  
 FROM REPORTSERVER.DBO.EXECUTIONLOG(NOLOCK)  
 --WHERE USERNAME NOT IN  
 GROUP BY DATEPART(HOUR, TIMESTART)  
 ORDER BY DATEPART(HOUR, TIMESTART)  

To get the reports generated by users we have following script.

SELECT EL.USERNAME  
   ,C.NAME  
   ,COUNT(1) AS [Gneerated Number]  
 FROM REPORTSERVER.DBO.EXECUTIONLOG(NOLOCK) EL  
 INNER JOIN REPORTSERVER.DBO.CATALOG (NOLOCK) C ON EL.REPORTID = C.ITEMID  
 GROUP BY EL.USERNAME  
   ,C.NAME  
 ORDER BY EL.USERNAME  
   ,C.NAME  
  • Oct 03 / 2013
  • 0
Learn from the community behind Microsoft products
dbDigger, SQL Server Training

Learn from the community behind Microsoft products

We all are involved with Microsoft products and MS has shown wonderful improvement in all its products. Obviously a very dedicated teamwork is behind all this improvement. And what if you get a chance to learn from those skillful and handwork resources who are part of products success. It will be a great deal of course. So here is a link that will lead you to lot of quality and focused videos on various Microsoft products and technologies. Watch online or download the short videos.

  • Oct 01 / 2013
  • 0
dbDigger, SQL Server Training

Want to improve your SQL Server Query Tuning skills then watch these videos

If you are new to DBA career or did not spend enough time on SQL Server Query Tuning skills then here is a right stuff to start with. As licensing models are changing and adding hardware also associates the licensing costs along with the hardware cost itself so fine tuning the queries and procedures is a required skill for DBAs.

You can download about 6 hours of training videos related to SQL Server Query Tuning skills. Videos are equipped with theory and demos side by side. These training videos are prepared for SQL Sentry by

Click here to download the videos from SQL Sentry TV .

  • Sep 26 / 2013
  • 0
dbDigger, Linked Servers and remote data

Concerns to keep in mind and analyze before going for linked servers

Linked Servers are used in SQL Server to get connect and retrieve the data from outside your local server instance. We may link to other SQL Server as well as non SQL Server DBMS. It is a mature and proven technology. Rather than discussing the configuration method i will discuss some concerns that should be analyzed and take care while implementing the Linked Server.

  • Joining the data between local and linked server databases will result in poor performance. And performace may go worst if link is on WAN.
  • Execution of procedure on remote server will leak memory on local server for each call from it. It is due to return status of procedure even if it is not used by the caller. This leak is very minimal about 40 Bytes per call but may accumulate over the time.
  • SQL variant data types also cause minor memory leaks for local server. Large character strings of this type may accumulate considerable memory leaks over the time.
  • Performance – Optimizing is always a challenge and distributed queries are even more difficult. An extra complication with linked servers is that to get statistics from the remote server, OLE DB runs DBCC SHOW_STATISTICS. But this command requires ‘sysadmin’ permission or membership in ‘db_owner’ or ‘db_ddladmin’, which is not expected from a regular user to have, no matter he accesses the linked server with his own credentials, or through a proxy account defined.
  • There are a number of SQL Server features that are not supported with linked servers
    • XML data type
    • Table-valued parameters
    • CLR User-defined data types
    • Cannot call table-valued functions with four-part notation
    • MAX parameters cannot be OUTPUT
    • BULK INSERT into linked server is not supported. More details here
  • Error messages with linked servers and distributed transactions are often very obscure. Often it includes an OLE DB error, which is difficult to understand. Also, the useful part of the error message is often only raised with level 10, so you cannot catch it. A prime example is when a remote call times out.
  • Distributed transactions – The MSDTC has following problems:
    • Cannot use SAVE TRANSACTION in a distributed transaction
    • Some errors when a distributed transaction fails are not catchable
    • Once you have rolled back locally, there is very little you can do, for instance you cannot call a stored procedure
  •  Security and permissions for linked servers will require extra effort and skill.
  • Sep 24 / 2013
  • 0
dbDigger, Reporting Services SSRS, T-SQL Scripts

Get scheduled job name for specific SSRS report subscription

I was required to rerun some failed SSRS subscriptions. As we know that SSRS subscriptions automatically create scheduled jobs in SQL Server agent. The problem is that job names are not readable and it is some UID. So first of all i got the list of failed subscriptions from execution logs and then i was required to get job name for each failed subscription so that it may be executed manually. For this purpose i found following piece of code and it worked fine for me. In following example i got the job name for a report named MyReport.

SELECT b.NAME AS JobName,e.NAME  ,e.path  ,d.description  ,a.SubscriptionID  
   ,laststatus  ,eventtype  ,LastRunTime  ,date_created  ,date_modified  
 FROM ReportServer.dbo.ReportSchedule a  
 JOIN msdb.dbo.sysjobs b ON a.ScheduleID = b.NAME  
 JOIN ReportServer.dbo.ReportSchedule c ON b.NAME = c.ScheduleID  
 JOIN ReportServer.dbo.Subscriptions d ON c.SubscriptionID = d.SubscriptionID  
 JOIN ReportServer.dbo.CATALOG e ON d.report_oid = e.itemid  
 WHERE e.NAME = 'MyReport'  
 and b.description = 'This job is owned by a report server process. Modifying this job could result in database incompatibilities. Use Report Manager or Management Studio to update this job.'   

Above piece of code may be found in full context here.

  • Sep 23 / 2013
  • 0
dbDigger, Linked Servers and remote data, System Administration, Windows Server

Copy paste not working during remote desktop sessions

I use Remote Desktop utility to get connect to the online servers if required. While using the remote desktop it enables us to share the clipboard among both the OS to copy the data. A couple of days back i noticed that i am no more able to copy data from or to my laptop from the server connected through remote desktop. It was problematic and first thing that came to mind was that i should verify the local resources settings in my remote desktop connection panel. It had following settings and nothing was wrong here

Data copy not working on remote desktop session

So now i had to google for any further clue and I found the reason in a minute by googling. I performed following steps to solve the issue.

  • Login to the remote server on Remote Desktop
  • Open task manager (by right clicking on taskbar)
  • Go to Processes tab
  • Search the process RDPClip.exe
  • End the process RDPClip.exe
  • Go to Applications tab in task manager
  • Click on New Task and start RDPClick.exe by entering in box

The issue is solved here. We may also implement the same  solution through following cmd commands for the same tasks
Taskkill.exe /im rdpclip.exe
Rdpclip.exe

Pages:12345678...84
Consult us to explore the Databases. Contact us