配置报表服务器数据库连接(报表服务器配置管理器)Configure a Report Server Database Connection (Report Server Configuration Manager)

适用对象:APPLIES TO: SQL Server 2016 Reporting Services 及更高版本 Power BI 报表服务器适用对象:APPLIES TO: SQL Server 2016 Reporting Services 及更高版本 Power BI 报表服务器

有关与以前版本的 SQL Server Reporting Services (SSRS) 相关的内容,请参阅 SQL Server 2014 Reporting ServicesFor content related to previous versions of SQL Server Reporting Services (SSRS), see SQL Server 2014 Reporting Services.

每个报表服务器实例都需要连接到存储由服务器管理的报表、共享数据源、资源和元数据的报表服务器数据库。Each report server instance requires a connection to the report server database that stores reports, shared data sources, resources, and metadata managed by the server. 如果要安装默认配置,则可以在报表服务器安装过程中创建初始连接。The initial connection can be created during a report server installation if you are installing the default configuration. 多数情况下,可以在安装程序完成之后使用 Reporting ServicesReporting Services 配置工具配置连接。In most cases, you will use the Reporting ServicesReporting Services Configuration tool to configure the connection after Setup is complete. 您可以随时修改连接,以更改帐户类型或重置凭据。You can modify the connection at any time to change the account type or reset credentials. 有关如何创建数据库并配置连接的分步说明,请参阅创建本机模式报表服务器数据库(报表服务器配置管理器)For step-by-step instructions on how to create the database and configure the connection, see Create a Native Mode Report Server Database (Report Server Configuration Manager).

如果出现下列情况,则必须配置报表服务器数据库连接:You must configure a report server database connection in the following circumstances:

  • 为首次使用配置报表服务器。Configuring a report server for first use.

  • 配置报表服务器以使用不同的报表服务器数据库。Configuring a report server to use a different report server database.

  • 更改数据库连接所使用的用户帐户或密码。Changing the user account or password that is used for the database connection. 当帐户信息存储在 RSReportServer.config 文件中时,您只需要更新数据库连接。You only need to update the database connection when the account information is stored in the RSReportServer.config file. 如果使用服务帐户进行连接(该帐户使用 Windows 集成安全性作为凭据类型),则不会存储密码,从而无需更新连接信息。If you are using the service account for the connection (which uses Windows integrated security as the credential type), the password is not stored, eliminating the need to update the connection information. 有关更改帐户的详细信息,请参阅配置报表服务器服务帐户(报表服务器配置管理器)For more information about changing accounts, see Configure the Report Server Service Account (Report Server Configuration Manager).

  • 配置报表服务器扩展部署。Configuring a report server scale-out deployment. 配置扩展部署时,您需要创建多个到报表服务器数据库的连接。Configuring a scale-out deployment requires that you create multiple connections to a report server database. 有关如何执行此多步操作的详细信息,请参阅配置本机模式报表服务器横向扩展部署(报表服务器配置管理器)For more information about how to perform this multi-step operation, see Configure a Native Mode Report Server Scale-Out Deployment (Report Server Configuration Manager).

Reporting Services 如何连接到数据库引擎How Reporting Services Connects to the Database Engine

报表服务器根据凭据和连接信息以及对使用该数据库的报表服务器实例有效的加密密钥来访问报表服务器数据库。Report server access to a report server database depends on credentials and connection information, and on encryption keys that are valid for the report server instance that uses that database. 拥有有效的加密密钥对于存储和检索敏感数据是必要的。Having valid encryption keys is necessary for storing and retrieving sensitive data. 首次配置数据库时,会自动创建加密密钥。Encryption keys are created automatically when you configure the database for the first time. 创建密钥之后,如果更改报表服务器服务标识,则必须更新这些密钥。After the keys are created, you must update them if you change the Report Server service identity. 有关使用加密密钥的详细信息,请参阅配置和管理加密密钥(报表服务器配置管理器)For more information about working with encryption keys, see Configure and Manage Encryption Keys (Report Server Configuration Manager).

报表服务器数据库为内部组件,只有报表服务器可以访问。The report server database is an internal component, accessed only by the report server. 为报表服务器数据库指定的凭据和连接信息专门由报表服务器使用。The credentials and connection information you specify for the report server database are used exclusively by the report server. 请求报表的用户不需要拥有报表服务器数据库的数据库权限或数据库登录名。Users who request reports do not require databases permissions or a database login for the report server database.

Reporting ServicesReporting Services 使用 System.Data.SqlClient 连接到承载报表服务器数据库的 数据库引擎Database Engineuses System.Data.SqlClient to connect to the 数据库引擎Database Engine that hosts the report server database. 如果使用的是 数据库引擎Database Engine的本地实例,报表服务器将使用共享内存建立连接。If you are using a local instance of the 数据库引擎Database Engine, the report server will establish the connection using shared memory. 如果使用的是报表服务器数据库的远程数据库服务器,则可能必须根据所使用的版本启用远程连接。If you are using a remote database server for the report server database, you might have to enable remote connections depending on the edition you are using. 如果使用的是 Enterprise Edition,则默认情况下会启用 TCP/IP 远程连接。If you are using the Enterprise edition, remote connections are enabled for TCP/IP by default.

若要验证实例是否接受远程连接,请依次单击“开始”、“所有程序”、Microsoft SQL ServerMicrosoft SQL Server、“配置工具”、“SQL Server 配置管理器”,然后确认为每个服务启用了 TCP/IP 协议 。To verify that the instance accepts remote connections, click Start, click All Programs, click Microsoft SQL ServerMicrosoft SQL Server, click Configuration Tools, click SQL Server Configuration Manager, and then verify that the TCP/IP protocol is enabled for each service.

启用远程连接时,也会启用客户端协议和服务器协议。When you enable remote connections, the client and server protocols will also be enabled. 若要确认协议已启用,请依次单击 “开始”“所有程序”Microsoft SQL ServerMicrosoft SQL Server“配置工具”“SQL Server 配置管理器”“SQL Server 网络配置” ,再单击 “MSSQLSERVER 协议”To verify the protocols are enabled, click Start, click All Programs, click Microsoft SQL ServerMicrosoft SQL Server, click Configuration Tools, click SQL Server Configuration Manager, click SQL Server Network Configuration, and then click Protocols for MSSQLSERVER. 有关详细信息,请参阅在 SQL ServerSQL Server启用或禁用服务器网络协议For more information, see Enable or Disable a Server Network Protocol in SQL ServerSQL Server.

定义报表服务器数据库连接Defining a Report Server Database Connection

若要配置连接,您必须使用 Reporting ServicesReporting Services 配置管理器工具或 rsconfig 命令行实用工具。To configure the connection, you must use the Reporting ServicesReporting Services Configuration Manager tool or the rsconfig command line utility. 报表服务器需要以下连接信息:A report server requires the following connection information:

  • 承载报表服务器数据库的 数据库引擎Database Engine 实例的名称。Name of the 数据库引擎Database Engine instance hosting the report server database..

  • 报表服务器数据库的名称。Name of the report server database. 首次创建连接时,可以创建新的报表服务器数据库,或选择现有数据库。When creating a connection for the first time, you can create a new report server database or select an existing database. 有关详细信息,请参阅创建报表服务器数据库(报表服务器配置管理器)For more information, see Create a Report Server Database;Report Server Configuration Manager).

  • 凭据类型。Credential type. 可以使用服务帐户、Windows 域帐户或 SQL ServerSQL Server 数据库登录名。You can use the service accounts, a Windows domain account, or a SQL ServerSQL Server database login.

  • 用户名和密码(仅在使用 Windows 域帐户或 SQL ServerSQL Server 登录名时需要)。User name and password (required only if you are using Windows domain account or a SQL ServerSQL Server login).

必须为所提供的凭据授予访问报表服务器数据库的权限。The credentials that you provide must be granted access to the report server database. 如果使用 Reporting ServicesReporting Services 配置工具,则此步骤会自动执行。If you use the Reporting ServicesReporting Services Configuration tool, this step is performed automatically. 有关访问数据库所需权限的详细信息,请参阅本主题中的“数据库权限”一节。For more information about the permissions required to access the database, see the "Database Permissions" section in this topic.

存储数据库连接信息Storing Database Connection Information

Reporting ServicesReporting Services 在下列 RSreportserver.config 设置中存储和加密连接信息。stores and encrypts the connection information in the following RSreportserver.config settings. 必须使用 Reporting ServicesReporting Services 配置工具或 rsconfig 实用工具为这些设置创建加密值。You must use the Reporting ServicesReporting Services Configuration tool or rsconfig utility to create encrypted values for these settings.

并非所有的值都针对每一种连接类型进行了设置。Not all of the values are set for every type of connection. 如果使用默认值配置连接(即使用服务帐户建立连接),则 <LogonUser>、<LogonDomain> 和 <LogonCred> 将为空,如下所示:If you configure the connection using the default values (that is, using the service accounts to make the connection), <LogonUser>, <LogonDomain>, and <LogonCred> will be empty, as follows:

<Dsn></Dsn>  
<ConnectionType></ConnectionType>  
<LogonUser></LogonUser>  
<LogonDomain></LogonDomain>  
<LogonCred></LogonCred>  

如果将连接配置为使用特定的 Windows 帐户或数据库登录名,则在随后更改帐户或登录名时必须更新已存储的值。If you configure the connection to use a specific Windows account or database login, you must remember to update the values that are stored if you subsequently change the account or login.

选择凭据类型Choosing a Credential Type

可以在报表服务器数据库连接中使用三种类型的凭据:There are three types of credentials that can be used in a connection to a report server database:

  • 使用报表服务器服务帐户的 Windows 集成安全性。Windows integrated security using the Report Server service account. 由于报表服务器作为单个服务实现,因此只有运行服务的帐户需要数据库访问。Because the report server is implemented as a single service, only the account under which the service runs requires database access.

  • Windows 用户帐户。A Windows user account. 如果报表服务器和报表服务器数据库安装在同一台计算机上,则可以使用本地帐户。If the report server and the report server database are installed on the same computer, you can use a local account. 否则,必须使用域帐户。Otherwise, you must use a domain account.

  • SQL ServerSQL Server 登录名。A SQL ServerSQL Server login.

备注

不能使用自定义身份验证扩展插件来连接到报表服务器数据库。A custom authentication extension cannot be used to connect to a report server database. 自定义身份验证扩展插件只能用来对报表服务器的主体进行身份验证。Custom authentication extensions are used only to authenticate a principal to a report server. 它们不会影响报表服务器数据库的连接,也不会影响为报表提供内容的外部数据源的连接。They do not affect connections to the report server database or to external data sources that provide content to reports.

如果 数据库引擎Database Engine 实例配置为使用 Windows 身份验证且与报表服务器计算机位于同一个域或可信域中,则可将连接配置为使用通过 Reporting ServicesReporting Services 配置工具作为连接属性进行管理的服务帐户或域用户帐户。If the instance of the 数据库引擎Database Engine is configured for Windows Authentication and is in the same domain or a trusted domain with the report server computer, you can configure the connection to use the service account or a domain user account that you manage as a connection property through the Reporting ServicesReporting Services Configuration tool. 如果数据库服务器位于另一个域中,或者您使用的是工作组安全性,则必须将连接配置为使用 SQL ServerSQL Server 数据库登录名。If the database server is in a different domain or if you are using workgroup security, you must configure the connection to use a SQL ServerSQL Server database login. 在这种情况下,一定要对连接进行加密。In this case, be sure to encrypt the connection.

备注

使用 Azure SQL 托管实例承载报表服务器数据库时,SQL Server 身份验证是唯一受支持的凭据类型。When using Azure SQL Managed Instance to host report server databases, SQL Server authentication is the only supported credential type. 此外,请注意,托管实例无法承载报表服务器实例。In addition, please note that Managed Instance cannot host report server instance.

使用服务帐户和集成安全性Using Service Accounts and Integrated Security

可以使用 Windows 集成安全性通过报表服务器服务帐户进行连接。You can use Windows integrated security to connect through the Report Server service account. 已为此帐户授予了登录报表服务器数据库的权限。The account is granted login rights to the report server database. 如果以默认配置安装 Reporting ServicesReporting Services ,这将是安装程序选择的默认凭据类型。This is the default credential type chosen by Setup if you install Reporting ServicesReporting Services in the default configuration.

此服务帐户为可信帐户,此帐户提供一种低维护方法来管理报表服务器数据库连接。The service account is a trusted account that provides a low-maintenance approach to managing a report server database connection. 由于此服务帐户使用 Windows 集成安全性来建立连接,因此无需存储凭据。Because the service account uses Windows integrated security to make the connection, the credentials do not have to be stored. 但是,如果以后要更改服务帐户密码或标识(例如从内置帐户切换到域帐户),请确保使用 Reporting ServicesReporting Services 配置工具进行更改。However, if you subsequently change the service account password or identity (for example, switching from a built-in account to a domain account), be sure to use the Reporting ServicesReporting Services Configuration tool to make the change. 该工具会将数据库权限自动更新为使用修改后的帐户信息。The tool automatically updates the database permissions to use the revised account information. 有关详细信息,请参阅配置报表服务器服务帐户(报表服务器配置管理器)For more information, see Configure the Report Server Service Account (Report Server Configuration Manager).

将数据库连接配置为使用服务帐户时,如果报表服务器数据库位于远程计算机上,则帐户必须拥有网络权限。If you configure the database connection to use the service account, the account must have network permissions if the report server database is on a remote computer. 如果报表服务器数据库位于不同的域中,并且位于防火墙之后,或者您使用的是工作组安全性而非域安全性,则不要使用服务帐户。Do not use the service account if the report server database is on a different domain, behind a firewall, or if you are using workgroup security instead of domain security. 请改用 SQL ServerSQL Server 数据库用户帐户。Use a SQL ServerSQL Server database user account instead.

使用域用户帐户Using a Domain User Account

可以为报表服务器到报表服务器数据库的连接指定一个 Windows 用户帐户。You can specify a Windows user account for the report server connection to the report server database. 如果使用本地帐户或域帐户,则每次更改密码或帐户时,必须更新报表服务器数据库连接。If you use a local or domain account, you must update the report server database connection every time you change the password or the account. 请始终使用 Reporting ServicesReporting Services 配置工具来更新连接。Always use the Reporting ServicesReporting Services Configuration tool to update the connection.

使用 SQL Server 登录名Using a SQL Server Login

可以指定使用一个 SQL ServerSQL Server 登录名连接到报表服务器数据库。You can specify a single SQL ServerSQL Server login to connect to the report server database. 如果使用 SQL ServerSQL Server 身份验证并且报表服务器数据库位于远程计算机上,则可以使用 IPSec 来协助保护服务器之间的数据传输。If you use SQL ServerSQL Server authentication and the report server database is on a remote computer, use IPSec to help secure the transmission of data between the servers. 如果使用数据库登录名,则每次更改密码或帐户时,必须更新报表服务器数据库连接。If you use a database login, you must update the report server database connection every time you change the password or the account.

数据库权限Database Permissions

用来连接到报表服务器数据库的帐户被授予了以下角色:Accounts used to connect to the report server database are granted the following roles:

  • ReportServer 数据库的 publicRSExecRole 角色。public and RSExecRole roles for the ReportServer database.

  • mastermsdbReportServerTempDB 数据库的 RSExecRole 角色。RSExecRole role for the master, msdb, and ReportServerTempDB databases.

使用 Reporting ServicesReporting Services 配置工具创建或修改连接时,将自动授予这些权限。When you use the Reporting ServicesReporting Services Configuration tool to create or modify the connection, these permissions are granted automatically. 如果使用 rsconfig 实用工具并且要为该连接指定不同的帐户,则必须为该新帐户更新 SQL ServerSQL Server 登录名。If you use the rsconfig utility, and you are specifying a different account for the connection, you must update the SQL ServerSQL Server login for that new account. 可以在 Reporting ServicesReporting Services 配置工具中创建用来更新报表服务器的 SQL ServerSQL Server 登录名的脚本文件。You can create script files in the Reporting ServicesReporting Services Configuration tool that will update the SQL ServerSQL Server login for the report server.

验证数据库名称Verifying the Database Name

使用 Reporting ServicesReporting Services 配置工具可以确定特定报表服务器实例所使用的报表服务器数据库。Use the Reporting ServicesReporting Services Configuration tool to determine which report server database is used by a particular report server instance. 若要查找该名称,请连接到该报表服务器实例并打开“数据库安装”页。To find the name, connect to the report server instance and open the Database Setup page.

使用不同的报表服务器数据库或移动报表服务器数据库Using a Different Report Server Database or Moving a Report Server Database

可以通过更改连接信息将报表服务器实例配置为使用不同的报表服务器数据库。You can configure a report server instance to use a different report server database by changing the connection information. 切换数据库的一个常见示例是部署生产报表服务器。A common case for switching databases is when you deploy a production report server. 通常,生产服务器是通过从测试报表服务器数据库切换到生产报表服务器数据库来实现的。您还可以将报表服务器数据库移动到另一台计算机上。Switching from a test report server database to a production report server database is typically how production servers are rolled out. You can also move a report server database to another computer. 有关详细信息,请参阅在 SQL ServerSQL Server升级和迁移 Reporting ServicesFor more information, see Upgrade and Migrate Reporting Services in SQL ServerSQL Server.

将多个报表服务器配置为使用同一个报表服务器数据库Configuring Multiple Reports Servers to Use the Same Report Server Database

可以将多个报表服务器配置为使用同一个报表服务器数据库。You can configure multiple report servers to use the same report server database. 此部署配置称为扩展部署。This deployment configuration is called a scale-out deployment. 如果要在服务器群集中运行多个报表服务器,则此配置为必备条件。This configuration is a prerequisite if you want to run multiple report servers in a server cluster. 但是,如果要将服务应用程序分段,或者要测试新的报表服务器实例的安装和设置以将其与现有报表服务器安装进行比较,则也以可使用此配置。However, you can also use this configuration if you want to segment service applications or if you want to test the installation and settings of a new report server instance to compare it with an existing report server installation. 有关详细信息,请参阅配置本机模式报表服务器横向扩展部署(报表服务器配置管理器)For more information, see Configure a Native Mode Report Server Scale-Out Deployment (Report Server Configuration Manager).

后续步骤Next steps

更多疑问?More questions? 请访问 Reporting Services 论坛Try asking the Reporting Services forum