如何导出特定时间点的Azure数据库备份?
Hey there! I get it—tracking down and exporting an older automated backup can feel frustrating when the standard docs only cover current data exports. Let’s break down exactly how to get that 2-day-old hourly backup exported:
Step 1: Confirm Your Backup Retention Policy First
Before diving in, make sure your database’s automated backup retention period actually covers the 2-day window you need. Azure SQL Database’s default retention varies by tier (7 days for Basic, 35 days for Standard/Premium), but it might have been customized:
- Head to your Azure SQL Database in the Azure Portal
- Open the Backup tab in the left-hand menu
- Check the Retention policy section to verify 2 days falls within the allowed timeframe
Step 2: Restore the Hourly Backup to a Temporary Database
You can’t directly export a historical automated backup—instead, you first restore it to a temporary database, then export that temp copy:
- In the Azure Portal, go to your original SQL Database > Backup > Restore
- Under Restore source, select Point-in-time restore
- Use the date picker to jump back exactly 2 days, then select the specific hour you need from the timeline
- Name your temporary database (e.g.,
MyDB_Temp_Restore_2DaysAgo) and finish the restore process—wait time depends on your database size, but it’s usually a few minutes
Step 3: Export the Restored Temporary Database
Now that you have the restored copy, you can use the export workflow you’re familiar with, but apply it to this temp DB:
- Navigate to the temporary database you just created
- Open the Export tab in the left-hand menu
- Configure your export settings:
- Pick a target Azure Storage account and container to save the export file
- Enter the SQL admin credentials for the temp database
- Choose your preferred export format (BACPAC is the standard choice)
- Click Export—you can monitor the job’s progress in the Notifications panel or under Export/Import history
Alternative: Scripted Workflow with PowerShell (Optional)
If you prefer automation, use Azure PowerShell to handle the restore and export in one go:
# Restore the 2-day-old point-in-time backup to a temp DB Restore-AzSqlDatabase -ResourceGroupName "YourResourceGroup" -ServerName "YourSQLServer" ` -DatabaseName "OriginalDatabase" -PointInTime (Get-Date).AddDays(-2) ` -TargetDatabaseName "MyDB_Temp_Restore" # Export the restored temp DB to Azure Storage Export-AzSqlDatabase -ResourceGroupName "YourResourceGroup" -ServerName "YourSQLServer" ` -DatabaseName "MyDB_Temp_Restore" -StorageKeyType "StorageAccessKey" ` -StorageKey "YourStorageAccountAccessKey" -StorageUri "https://yourstorage.blob.core.windows.net/container/export_2daysago.bacpac" ` -AdministratorLogin "SQLAdminUsername" -AdministratorLoginPassword "SQLAdminPassword"
Quick Tips
- Once you’ve downloaded the export file, delete the temporary database to avoid extra costs
- Use a storage account in the same region as your SQL database for faster export speeds
- Make sure you have the
SQL DB Contributorrole or equivalent permissions to perform restores and exports
内容的提问来源于stack exchange,提问作者Ashkan S

