刪除 SharePoint Server 中的服務應用程式Delete a service application in SharePoint Server

摘要: 了解如何在 SharePoint Server 2016 和 SharePoint 2013 中刪除服務應用程式。Summary: Learn how to delete a service application in SharePoint Server 2016 and SharePoint 2013.

您可以使用SharePoint 管理中心網站或使用 Microsoft PowerShell Cmdlet 刪除 SharePoint Server服務應用程式。You can delete a SharePoint Server service application by using the SharePoint Central Administration website or by using Microsoft PowerShell cmdlets.

警告

刪除服務應用程式的動作為永久性,您無法復原此作業。The act of deleting a service application is permanent — you cannot undo this operation.

刪除服務應用程式之前,請先確認移除它不會對使用者造成不好的影響。建議您確定目前沒有 Web 應用程式正在使用您即將刪除的服務應用程式。如需如何從 Web 應用程式將服務應用程式中斷連線的資訊,請參閱從 SharePoint Server 的 Web 應用程式新增或移除服務應用程式連線Before you delete a service application, verify that its removal won't adversely affect users. We recommend, that you ensure that no web applications are currently consuming the service application that you are going to delete. For information about how to disconnect a service application from a web application, see Add or remove service application connections from a web application in SharePoint Server.

刪除服務應用程式時,您也可以刪除服務應用程式資料庫。部分服務應用程式沒有資料庫。如果您打算在未來重新建立服務應用程式,請不要刪除服務應用程式資料庫。如果是暫時的服務應用程式,您應該會想要在此作業期間刪除資料庫。When you delete a service application, you have the option of also deleting the service application database. Some service applications don't have databases. If you plan to create the service application again in the future, don't delete the service application database. If the service application is temporary, you'll most likely want to delete the database during this operation.

為了確保未來仍可使用服務應用程式,請考慮在刪除它之前先行備份。如需詳細資訊,請參閱在 SharePoint Server 中備份服務應用程式在 SharePoint Server 中還原服務應用程式To ensure that the service application is available for potential future use, consider backing up the service application before you delete it. For more information, see Back up service applications in SharePoint Server and Restore service applications in SharePoint Server.

使用管理中心刪除服務應用程式To delete a service application by using Central Administration

  1. 確認執行此程序的使用者帳戶為 SharePoint 伺服器陣列管理員群組的成員。Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.

  2. 在 SharePoint 管理中心網站上,依序按一下 [應用程式管理]、[管理服務應用程式]。On the SharePoint Central Administration website, click Application Management, and then click Manage service applications.

  3. 在「管理服務應用程式」頁面上,按一下包含要刪除服務應用程式的列。功能區隨即變為可用。On the Manage Service Applications page, click the row that contains the service application that you want to delete. The ribbon becomes available.

  4. 在功能區上,按一下 [刪除]。On the ribbon, click Delete.

  5. 在確認對話方塊中,如果想要刪除服務應用程式資料庫,請選取 [刪除與服務應用程式相關聯的資料] 旁的核取方塊;如果想要保留該資料庫,請勿選取此核取方塊。In the confirmation dialog box, select the check box next to Delete data associated with the Service Applications if you want to delete the service application database. If you want to retain the database, leave this check box cleared.

  6. 按一下 [確定]**** 刪除服務應用程式,或按一下 [取消]**** 停止此作業。Click OK to delete the service application, or click Cancel to stop the operation.

使用 PowerShell 刪除服務應用程式To delete a service application by using PowerShell

  1. 確認您是否符合下列基本需求:Verify that you meet the following minimum requirements:

    • 您必須具有 SQL Server 執行個體上 securityadmin 固定伺服器角色中的成員資格You must have membership in the securityadmin fixed server role on the SQL Server instance

    • 您必須具備所有待更新資料庫之 db_owner 固定資料庫角色中的成員資格。You must have membership in the db_owner fixed database role on all databases that are to be updated.

    • 您必須是正在執行 PowerShell Cmdlet 之伺服器上的系統管理員群組成員。You must be a member of the Administrators group on the server on which you're running the PowerShell cmdlet.

      注意

      如果未符合這些權限,請連絡設定系統管理員或 SQL Server 系統管理員以要求這些權限。If these permissions aren't satisfied, contact your Setup administrator or SQL Server administrator to request these permissions.

      如需 PowerShell 權限的其他資訊,請參閱權限Add-SPShellAdminFor additional information about PowerShell permissions, see Permissions and Add-SPShellAdmin

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

  3. 在 PowerShell 命令提示字元處,輸入下列命令。At the PowerShell command prompt, type the following commands.

  4. 若要擷取您要刪除的服務應用程式,請輸入下列命令:To retrieve the service application that you want to delete, type the following command:

    $spapp = Get-SPServiceApplication -Name "<Service application display name>"
    

    其中的 <Service application display name> 是您要刪除之服務應用程式的顯示名稱。Where <Service application display name> is the display name of the service application that you want to delete.

    服務應用程式資訊會儲存在 $spapp 變數中。The service application information will be stored in the $spapp variable.

    重要

    您必須在引號之間輸入顯示名稱,且必須輸入正確的服務應用程式顯示名稱 (包括大小寫)。我們建議您不要建立擁有相同顯示名稱的多個服務應用程式。如果您的情形是這樣,可以使用 Get-SPServiceApplication 列出所有服務應用程式。接著您可以使用服務應用程式 GUID 及 -Identity 參數,指定您要刪除的服務應用程式。如需詳細資訊,請參閱< Get-SPServiceApplication>。You have to type the display name within quotation marks, and you have to type the exact service application display name. This includes capitalization. We recommend that you don't create multiple service applications that have the same display name. If you do have this situation, you can use the Get-SPServiceApplication cmdlet to list all service applications. You can then use the service application GUID and the -Identity parameter to specify the service application that you want to delete. For more information, see Get-SPServiceApplication.

  5. 若要刪除選取的服務應用程式,請執行下列其中一個命令。在這兩個情形中,系統都會提示您確認刪除。To delete the selected service application, run either of the following commands. In both cases, you are prompted to confirm the deletion.

    • 若要刪除選取的服務應用程式而不移除服務應用程式資料庫,請輸入下列命令:To delete the selected service application without removing the service application database, type the following command:
    Remove-SPServiceApplication $spapp
    
    • 若要刪除選取的服務應用程式且一併刪除服務應用程式資料庫,請輸入下列命令:To delete the selected service application and also delete the service application database, type the following command:
    Remove-SPServiceApplication $spapp -RemoveData
    

範例Example

$spapp = Get-SPServiceApplication -Name "Contoso BDC Service"
Remove-SPServiceApplication $spapp -RemoveData

在本範例中,服務應用程式 "Contoso BDC Service" 資訊儲存在 $spapp 變數中。確認動作之後,就會永久刪除服務應用程式及其資料庫。In this example, the service application "Contoso BDC Service" information is stored in the $spapp variable. After the action is confirmed, the service application and its database are permanently deleted.

如需詳細資訊,請參閱 Get-SPServiceApplicationRemove-SPServiceApplicationFor more information, see Get-SPServiceApplication and Remove-SPServiceApplication.

另請參閱See also

其他資源Other Resources

Remove-SPServiceApplicationProxyGroupRemove-SPServiceApplicationProxyGroup