如何重建/重新安装ssrs(reportserver,reportservertempdb)数据库?

时间:2013-06-04 23:29:02

标签: sql sql-server tsql ssrs-2008 sql-server-2012

我们的服务器崩溃了。我们重新启动并运行,但提到的数据库已损坏。

是否有重建或重新安装SSRS数据库的程序/自动方式?

如果不是:

  1. 由于我们仍然可以从数据库选择* ,如何获取不同报告的权限和角色?
  2. 我们如何检索订阅信息?

1 个答案:

答案 0 :(得分:1)

1

您可以使用带有setup.exe的.ini文件自动执行SQL的初始安装。在那之后,您应该备份数据库。但似乎你可能没有。

如果您仍想重建数据库,可以删除然后使用SSRS配置工具重新创建它们。

如果您想自动执行该操作,则需要编写db drop,创建,角色创建(RSExecRole)脚本,然后运行此处的Catalog.sql和CatalogTempDB.sql脚本,但我不认为你应该这样做,只是备份 - 方式更容易!

X:\ Program Files \ Microsoft SQL Server \ MSRS10.X \ Reporting Services \ ReportServer

2

我使用RSScripter来移动需要运行Web服务的对象。您似乎只能访问数据库,这使您的工作更加困难。您需要确定哪些表包含订阅数据并将该数据移动到新数据库。您还需要将旧报告ID转换为新报告ID,因为它们将在新安装中更改 - 这可以通过匹配报告名称(如果它们是唯一的)来完成。如果可能的话我会尝试手工重建它们。

这是我用来查看订阅的查询,也许它会有所帮助......

USE ReportServer
go


WITH
[Sub_Parameters] AS
(
SELECT 
[SubscriptionID],
[Parameters] = CONVERT(XML,a.[Parameters])
FROM [Subscriptions] a
),
[MySubscriptions] AS
(
SELECT DISTINCT
[SubscriptionID],
[ParameterName] = QUOTENAME(p.value('(Name)[1]', 'nvarchar(max)')),
[ParameterValue] = p.value('(Value)[1]', 'nvarchar(max)')
FROM 
[Sub_Parameters] a
CROSS APPLY [Parameters].nodes('/ParameterValues/ParameterValue') t(p)
),
[SubscriptionsAnalysis] AS
(
SELECT
a.[SubscriptionID],
a.[ParameterName],
[ParameterValue] = 
(SELECT
STUFF(( 
SELECT [ParameterValue] + ', ' as [text()]
FROM [MySubscriptions]
WHERE 
[SubscriptionID] = a.[SubscriptionID]
AND [ParameterName] = a.[ParameterName]
FOR XML PATH('')
),1, 0, '')
+'')
FROM [MySubscriptions] a
GROUP BY a.[SubscriptionID],a.[ParameterName]
)
SELECT
a.[SubscriptionID],
c.[UserName] AS Owner, 
b.Name,
b.Path,
a.[Locale], 
a.[InactiveFlags], 
d.[UserName] AS Modified_by, 
a.[ModifiedDate], 
a.[Description], 
a.[LastStatus], 
a.[EventType], 
a.[LastRunTime], 
a.[DeliveryExtension],
a.[Version],
e.[ParameterName],
LEFT(e.[ParameterValue],LEN(e.[ParameterValue])-1) as [ParameterValue],
SUBSTRING(b.PATH,2,LEN(b.PATH)-(CHARINDEX('/',REVERSE(b.PATH))+1)) AS ProjectName
FROM 
[Subscriptions] a 
INNER JOIN [Catalog] AS b
ON a.[Report_OID] = b.[ItemID]
LEFT OUTER JOIN [Users] AS c
ON a.[OwnerID] = c.[UserID]
LEFT OUTER JOIN [Users] AS d
ON a.MODIFIEDBYID = d.Userid
LEFT OUTER JOIN [SubscriptionsAnalysis] AS e 
ON a.SubscriptionID = e.SubscriptionID

ORDER BY projectname