- "Description": "Adds database(s) to an Availability Group on a SQL Server instance.\n\nAfter checking for prerequisites, the commands runs these five steps for every database:\nStep 1: Setting seeding mode if needed.\n If -SeedingMode is used and the current seeding mode of the replica is not in the desired mode, the seeding mode of the replica is changed.\n The seeding mode will not be changed back but stay in this mode.\n If the seeding mode is changed to Automatic, the necessary rights to create databases will be granted.\nStep 2: Running backup and restore if needed.\n Action is only taken for replicas with a desired seeding mode of Manual and where the database does not yet exist.\n If -UseLastBackup is used, the restore will be performed based on the backup history of the database.\n Otherwise a full and log backup will be taken at the primary and those will be restored at the replica.\nStep 3: Add the database to the Availability Group on the primary replica.\n This step is skipped, if the database is already part of the Availability Group.\nStep 4: Add the database to the Availability Group on the secondary replicas.\n This step is skipped for those replicas, where the database is already joined to the Availability Group.\nStep 5: Wait for the database to finish joining the Availability Group on the secondary replicas.\n\nUse Test-DbaAvailabilityGroup with -AddDatabase to test if all prerequisites are met.\n\nIf you have special requirements for the setup for the database at the replicas,\nperform the backup and restore part with Backup-DbaDatabase and Restore-DbaDatabase in advance.\nPlease make sure that the last log backup has been restored before running Add-DbaAgDatabase.",
0 commit comments