This article will guide you on steps to restore a #database in alwayson availability group.
If you receive an #error that the database is in use, try to set the user to single user mode: USE master; GO ALTER DATABASE Database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE; Then try the restore with #recovery command again. Also, make sure you are on the latest service pack or cumulative update.
Creating a #SQL #Server AlwaysOn Availability Group.
Open SQL Server Management Studio and connect to the SQL Server instance. Expand the AlwaysOn High Availability folder in the Object Explorer. Right-click on the Availability Groups folder and select the New Availability Group Wizard.
To Restore a Database in a SQL Server AlwaysOn Availability Group:
1. Make the secondary server from which the backups were taken the primary server.
2. Remove the database to be restored from the AlwaysOn Availability Group.
3. Restore the database.
4. Add the database back into the Always Availability Group.