[AlwaysOn] 建立SQL Server高可用性組T-SQL語法:DATABASE子句

cow977發表於2019-08-16

DATABASE database_name

指定本地SQL Server例項(即建立可用性組的伺服器例項)上一個或多個使用者資料庫的列表。Specifies a list of one or more user databases on the local SQL Server instance (that is, the server instance on which you are creating the availability group). 可以為一個可用性組指定多個資料庫,但每個資料庫只能屬於一個可用性組。You can specify multiple databases for an availability group, but each database can belong to only one availability group. 有關可用性組可以支援的資料庫型別的資訊,請參閱“永不停機的可用性組(SQL Server)”的前提條件、限制和建議。For information about the type of databases that an availability group can support, see . 要找出哪些本地資料庫已經屬於某個可用性組,請參閱sys.databases目錄檢視中的replica_id列。To find out which local databases already belong to an availability group, see the replica_id column in the catalog view.

DATABASE 子句是可選的。The DATABASE clause is optional. 如果省略了它,則新的可用性組為空。If you omit it, the new availability group is empty.

建立可用性組之後,請連線到承載輔助副本的每個伺服器例項,然後準備每個輔助資料庫並將其加入到可用性組中。After you have created the availability group, connect to each server instance that hosts a secondary replica and then prepare each secondary database and join it to the availability group. 有關詳細資訊,請參閱在始終開啟的輔助資料庫(SQL Server)上啟動資料移動。For more information, see .

註釋 Note

稍後,您可以在承載當前主副本的伺服器例項上向可用性組新增符合條件的資料庫。Later, you can add eligible databases on the server instance that hosts the current primary replica to an availability group. 還可以從可用性組中刪除資料庫。有關詳細資訊,請參閱alter availability group(Transact-SQL)。You can also remove a database from an availability group. For more information, see .


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-2653853/,如需轉載,請註明出處,否則將追究法律責任。

相關文章