在 SharePoint Server 中新增內容資料庫Add content databases in SharePoint Server

摘要: 了解如何將內容資料庫新增至 SharePoint Server 2016 和 SharePoint 2013 伺服器陣列。Summary: Learn how to add a content database to your SharePoint Server 2016 and SharePoint 2013 farm.

您可以使用 SharePoint 管理中心網站或 Microsoft PowerShell 將內容資料庫新增至 SharePoint Server 伺服器陣列。所使用的工具會視已部署的環境類型、排程需求以及與組織建立的服務等級協定而定。You can add a content database to a SharePoint Server farm by using the SharePoint Central Administration website or Microsoft PowerShell. The tool that you use depends on the kind of environment that you have deployed, your schedule requirements, and service level agreements that you have made with your organization.

開始之前Before you begin

您可以新增內容資料庫,或從備份檔案附加現有的內容資料庫。You can add a new content database or attach an existing content database from a backup file.

開始這項作業之前,請先檢閱下列先決條件的相關資訊:Before you begin this operation, review the following information about prerequisites:

  • 執行此作業的使用者帳戶必須是 SharePoint 伺服器陣列管理員群組的成員。The user account that is performing this operation must be a member of the Farm Administrators SharePoint group.

  • 如果使用 Windows 驗證連線到 SQL Server,則使用者帳戶必須也是資料庫建立所在 SQL Server 執行個體上的 dbcreator 固定伺服器角色成員。If you use Windows authentication to connect to SQL Server, the user account must be a member of the dbcreator fixed server role on the SQL Server instance where the database is to be created.

新增內容資料庫至 SharePoint Server Web 應用程式Adding a content database to a SharePoint Server web application

您可以使用本文所述的程序,建立新的內容資料庫並附加至 Web 應用程式。如果要使用 Windows 驗證連線到 SQL Server,則使用者帳戶必須也是資料庫建立所在 SQL Server 執行個體上的 SQL Server dbcreator 固定伺服器角色成員。如果要使用 SQL 驗證連線到 SQL Server,則建立內容資料庫時所指定的 SQL 驗證帳戶在資料庫建立所在的 SQL Server 執行個體上必須具有 dbcreator 權限。You can use the procedures that are described in this article to create a new content database and attach it to a web application. If you are using Windows authentication to connect to SQL Server, the user account must also be a member the SQL Server dbcreator fixed server role on the SQL Server instance where the database will be created. If you are using SQL authentication to connect to SQL Server, the SQL authentication account that you specify when you create the content database must have dbcreator permission on the SQL Server instance where the database will be created.

使用管理中心將內容資料庫新增至 Web 應用程式To add a content database to a web application by using Central Administration

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

  2. 啟動管理中心。Start Central Administration.

  3. 在 SharePoint 管理中心網站中,按一下 [應用程式管理]*On the SharePoint Central Administration website, click *Application Management.

  4. 在 [資料庫]**** 區段中,按一下 [管理內容資料庫]*In the *Databases section, click Manage content databases.

  5. 在 [管理內容資料庫]**** 頁面中,按一下 [新增內容資料庫]*On the *Manage Content Databases page, click Add a content database.

  6. 在 [新增內容資料庫]**** 頁面上,執行下列動作:On the Add Content Database page:

    • 為新的資料庫指定 Web 應用程式。Specify a web application for the new database.

    • 指定主控新資料庫的資料庫伺服器。Specify a database server to host the new database.

    • 指定新資料庫將使用的驗證方法,並視需要提供帳戶名稱及密碼。Specify the authentication method that the new database will use and supply an account name and password, if they are necessary.

      重要

      帳戶名稱及密碼必須以 SQL Server 登入的形式存在。The account name and password must already exist as a SQL Server login.

    • 指定容錯移轉資料庫伺服器的名稱 (如果有此類伺服器存在的話)。Specify the name of the failover database server, if one exists.

    • 指定在發出警告前可以建立的頂層網站數目。預設為 2,000 個。Specify the number of top-level sites that can be created before a warning is issued. By default, this is 2,000.

    • 指定可以在資料庫中建立的頂層網站總數。預設為 5,000 個。Specify the total number of top-level sites that can be created in the database. By default, this is 5,000.

  7. 按一下 [確定]*Click *OK.

使用 PowerShell 將內容資料庫新增至 Web 應用程式To add a content database to a web application by using 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 Server Cmdlet 的權限。An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server 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 管理命令介面Open SharePoint Management Shell.

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

    New-SPContentDatabase -Name <ContentDbName> -WebApplication <WebApplicationName>
    

    其中:Where:

    • <ContentDbName> 是要建立之內容資料庫的名稱。<ContentDbName> is the name of the content database to create.

    • <WebApplicationName> 是附加新資料庫的 Web 應用程式名稱。<WebApplicationName> is the name of the web application to which the new database is attached.

如需詳細資訊,請參閱<New-SPContentDatabase>。For more information, see New-SPContentDatabase.

注意

若要將現有的內容資料庫附加至 web 應用程式,請使用 Microsoft PowerShell cmdlet Mount-SPContentDatabase。如需詳細資訊,請參閱 Mount-SPContentDatabaseTo attach an existing content database to a web application, use the Microsoft PowerShell cmdlet Mount-SPContentDatabase. For more information, see Mount-SPContentDatabase.

注意

建議您在執行命令列管理工作時使用 Windows PowerShell。Stsadm 命令列工具已過時,但為與舊版產品相容,仍會隨附提供。We recommend that you use Microsoft PowerShell when performing command-line administrative tasks. The Stsadm command-line tool has been deprecated, but is included to support compatibility with previous product versions.

請參閱See also

概念Concepts

在 SharePoint Server 中附加或卸離內容資料庫Attach or detach content databases in SharePoint Server

在 SharePoint Server 的資料庫間移動網站集合Move site collections between databases in SharePoint Server