0

I've been asked to write a stored procedure to restore one Azure SQL database from the current copy of a different database. Up until now I've been achieving this with Powershell, as such:

# Restore database from latest geo-redundant backup into existing server 
$GeoBackup = Get-AzureRmSqlDatabaseGeoBackup -ResourceGroupName "Search_Group1" -ServerName "DataT" -DatabaseName "db_master"

Restore-AzureRmSqlDatabase -FromGeoBackup `
    -ResourceGroupName "Search_Group1" `
    -ServerName "DataT" `
    -TargetDatabaseName "db_search" `
    -ResourceId $GeoBackup.ResourceID `
    -Edition "Standard" `
    -ServiceObjectiveName "S3"

So in the above, we take our existing database called db_master, and use it's latest backup to create an exact copy called db_search.

Is is possible to create a stored procedure that does this? I was attempting to use the Restore Database UI inside SSMS from which I could then script to T-SQL, but the option to Restore in SSMS is not even present for Azure SQL databases.

1 Answer 1

1

No. You can restore an Azure SQL database using Portal, PowerShell, REST API, ARM template or CLI, but not T-SQL.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your assistance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.