Wednesday, January 19, 2011

Change File Name in SSRS

SSRS Report File Name.
There are two options for subscription on the SSRS one for email and one for file share, on the file share you can customize the name of the file, but the physical excel file need to be save on the system, this file will not be automatically emailed to the user. To do this you need to create SSIS job to email the file.

On the other hand the email subscription option does not provide the option to customize the name of the file for eg excel file.

Conclusion
We need to split the report into number of subscriptions needed or use the file share option and create SSIS job to email them.

Wednesday, January 5, 2011

Reduce MSDB File

To reduce the file size of msdb, one of checks is to check the sysjobhistory in msdb database. This will grow with large number of records. This can be purged using the below syntax

sp_purge_jobhistory { [ @job_name = ] 'job_name' [ @job_id = ] job_id } [ , [ @oldest_date = ] oldest_date ]

USE msdb ;
GO
EXEC dbo.sp_purge_jobhistory
@job_id = N'93B30316-FF0E-42C7-80C7-7CBAA98817DB'
GO

or

USE msdb ;
GO
EXEC dbo.sp_purge_jobhistory
@oldest_date = N '2010-07-01'
GO


SELECT COUNT(*) FROM dbo.sysjobhistory
USE msdb
EXEC sp_delete_backuphistory '01/20/98'

USE msdb
select count(*) from backupset with (nolock) where backup_start_date < '2011-01-01'
USE msdb
SELECT [Size in MB] = SUM(IDX.reserved)/128, [Object Name] = OBJ.name FROM msdb.dbo.sysindexes IDX JOIN msdb.dbo.sysobjects OBJ ON OBJ.id = IDX.id WHERE IDX.indid IN (0, 1, 255) GROUP BY IDX.id, OBJ.name ORDER BY 1 DESC