State Service 應用程式未定義資料庫 (SharePoint Server)A State Service Application has no database defined (SharePoint Server)

摘要:瞭解如何解決 SharePoint Health Analyzer 規則「某個 State Service 應用程式未定義資料庫」。Summary: Learn how to resolve the SharePoint Health Analyzer rule "A State Service Application has no database defined."

規則名稱: 某個 State Service 應用程式未定義資料庫Rule Name: A State Service Application has no database defined

摘要: 某個 State Service 服務應用程式未定義 State Service 資料庫,可能導致使用 InfoPath 網頁瀏覽器表單和 Microsoft SharePoint Server 圖表網頁組件等一些 SharePoint 元件時發生錯誤。Summary: A State Service service application has no State Service database defined. This may result in errors when using some SharePoint components such as InfoPath Web browser forms and the Microsoft SharePoint Server Chart Web Part.

原因: 可能原因包括下列一或多項:Cause: One or more of the following might be causing this:

  • 伺服器陣列管理員已刪除與 State Service 服務應用程式相關聯的所有資料庫。The farm administrator deleted all databases associated with the State Service service application.

  • 伺服器陣列管理員從未建立資料庫,或從未建立資料庫與 State Service 服務應用程式的關聯。The farm administrator never created or associated a database with the State Service service application.

解決方案:使用 Microsoft PowerShell 為 State Service 服務應用程式建立新資料庫,或使用現有的資料庫Resolution: Create a new database or use an existing database for the State Service service application by using Microsoft PowerShell

  1. 確認您具備下列成員身分:Verify that you have the following memberships:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。securityadmin fixed server role on the SQL Server instance.

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。db_owner fixed database role on all databases that are to be updated.

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。Administrators group on the server on which you are running the PowerShell cmdlets.

      系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint 2013 產品 Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint 2013 Products cmdlets.

      注意

      如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdminIf you do not have permissions, contact your Setup administrator or SQL Server administrator to request permissions. For additional information about PowerShell permissions, see Add-SPShellAdmin.

  2. 啟動 SharePoint 管理命令介面。Start the SharePoint Management Shell.

    如需如何與 Windows Server 2012 互動的詳細資訊,請參閱<Windows 的常見管理工作及瀏覽方式>。For more information about how to interact with Windows Server 2012, see Common Management Tasks and Navigation in Windows.

  3. 如果尚未存在您可以使用的資料庫,請在 PowerShell 命令提示字元處,輸入下列命令:If no database already exists that you can use, type the following command at the PowerShell command prompt:

    New-SPStateServiceDatabase -Name <DatabaseName> -DatabaseServer <ServerName> [-DatabaseCredentials <Credential>] [-ServiceApplication <ID>]
    

    其中:Where:

    • <DatabaseName> 是以字串表示的資料庫名稱。<DatabaseName> is name of the database as a String.

    • <ServerName> 是資料庫伺服器的名稱。<ServerName> is name of the database server.

    • <Credential> 是資料庫的 SQL Server 驗證認證。如果未使用此參數,將會使用 Windows 驗證。<Credential> is SQL Server authentication credentials for the database. If this parameter is not used, Windows authentication will be used.

    • <ID> 是以字串或 GUID 表示的 State Service 服務應用程式識別碼。如果只有一個 State Service 服務應用程式,則不需要指定此參數。<ID> is the identifier for the State Service service application as a string or a GUID. If there is only one State Service service application, you do not have to specify this parameter.

  4. 在某些環境中,您必須連線至現有的空白 SQL 資料庫。在此情況下,請於 Windows PowerShell 命令提示字元處,輸入下列命令:In some environments, you must connect to an existing, empty SQL database. In this case, type the following command at the Windows PowerShell command prompt:

    Mount-SPStateServiceDatabase -Name <DatabaseName> -DatabaseServer <ServerName> [-DatabaseCredentials <Credential>] [-ServiceApplication <ID>]
    

    其中:Where:

    • <DatabaseNname> 是以字串表示的資料庫名稱。<DatabaseNname> is name of the database as a String.

    • <ServerName> 是資料庫伺服器的名稱。<ServerName> is name of the database server.

    • <Credential> 是資料庫的 SQL Server 驗證認證。如果未使用此參數,將會使用 Windows 驗證。<Credential> is the SQL Server authentication credentials for the database. If this parameter is not used, Windows authentication will be used.

    • <ID> 是以字串或 GUID 表示的 State Service 服務應用程式識別碼。如果只有一個 State Service 服務應用程式,則不需要指定此參數。<ID> is the identifier for the State Service service application as a string or a GUID. If there is only one State Service service application, you do not have to specify this parameter.

如需詳細資訊,請參閱 Mount-SPStateServiceDatabaseNew-SPStateServiceDatabaseFor more information, see Mount-SPStateServiceDatabase or New-SPStateServiceDatabase.