You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure that the database you add to the availability group is in the full recovery model and has a valid log backup. If this is a test database or a newly created database, take a database backup. On the primary [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)], run the following Transact-SQL script to create and back up a database called `db1`:
13
+
Ensure that the database you add to the availability group is in the full recovery model and has a valid log backup. If your database is a test database or a newly created database, take a database backup. On the primary [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)], run the following [!INCLUDE [tsql-md](../../includes/tsql-md.md)] (T-SQL) script to create and back up a database called `db1`:
14
14
15
15
```sql
16
16
CREATE DATABASE [db1];
17
-
ALTERDATABASE [db1] SET RECOVERY FULL;
17
+
GO
18
+
19
+
ALTERDATABASE [db1]
20
+
SET RECOVERY FULL;
21
+
GO
22
+
18
23
BACKUP DATABASE [db1]
19
-
TO DISK = N'/var/opt/mssql/data/db1.bak';
24
+
TO DISK = N'/var/opt/mssql/data/db1.bak';
20
25
```
21
26
22
-
On the primary [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] replica, run the following Transact-SQL script to add a database called `db1` to an availability group called `ag1`:
27
+
On the primary [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] replica, run the following T-SQL script to add a database called `db1` to an availability group called `ag1`:
23
28
24
29
```sql
25
-
ALTER AVAILABILITY GROUP [ag1] ADD DATABASE [db1];
30
+
ALTER AVAILABILITY GROUP [ag1]
31
+
ADD DATABASE [db1];
26
32
```
27
33
28
34
### Verify that the database is created on the secondary servers
29
35
30
36
On each secondary [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] replica, run the following query to see if the `db1` database was created and is synchronized:
0 commit comments