Transact-SQL Example
The following example prepares a secondary database. This example uses the AdventureWorks2012 sample database, which uses the simple recovery model by default.
To use the AdventureWorks2012 database, modify it to use the full recovery model:

USE master;
GO
ALTER DATABASE MyDB1
SET RECOVERY FULL;
GO

On the server instance that hosts the primary replica (INSTANCE01), create a full backup of the primary database as follows:

BACKUP DATABASE MyDB1
TO DISK = ‘C:\MyDB1.bak’
WITH FORMAT
GO

Copy the full backup to the server instance that hosts the secondary replica.
Restore the full backup, using RESTORE WITH NORECOVERY, onto the server instance that hosts the secondary replica. The restore command depends on whether the paths of primary and secondary databases are identical.

On the computer that hosts the secondary replica, restore the full backup as follows:

RESTORE DATABASE MyDB1
FROM DISK = ‘C:\MyDB1.bak’
WITH NORECOVERY
GO