Berhijrah ke Sidang Kemuncak Inovasi:
Ketahui cara berhijrah dan memodenkan ke Azure boleh meningkatkan prestasi, daya tahan dan keselamatan perniagaan anda, membolehkan anda menerima AI sepenuhnya.Daftar sekarang
Pelayar ini tidak lagi disokong.
Naik taraf kepada Microsoft Edge untuk memanfaatkan ciri, kemas kini keselamatan dan sokongan teknikal yang terkini.
In this quickstart, you'll use SQL Server Management Studio (SSMS) to restore a database from Azure Blob Storage to Azure SQL Managed Instance. The quickstart restores the Wide World Importers sample database from a publicly available backup file using a SAS.
Use the restore wizard to restore from a backup file
In SSMS, take the steps in the following sections to restore the Wide World Importers database to SQL Managed Instance by using the restore wizard. The database backup file is stored in a preconfigured Blob Storage account.
Open the restore wizard
Open SSMS and connect to your SQL managed instance.
In Object Explorer, right-click the Databases folder of your SQL managed instance, and then select Restore Database to open the restore wizard.
Select the backup source
In the restore wizard, select the ellipsis (...) to select the source of the backup set to restore.
In Select backup devices, select Add. In Backup media type, URL is the only option that's available because it's the only source type supported. Select OK.
In Select a Backup File Location, choose from one of three options to provide information about the location of your backup files:
Select a preregistered storage container from the Azure storage container list.
Enter a new storage container and a shared access signature. A new SQL credential will be registered for you.
Select Add to browse more storage containers from your Azure subscription.
To restore the Wide World Importers sample database from publicly accessible read-only storage, provide the value https://mitutorials.blob.core.windows.net/examples/ and for the Shared Access Signature field, provide any value, such as SAS.
Browse Azure subscription storage containers
Nota
These steps aren't necessary to restore the WideWorldImporters sample database from the publicly-accessible read-only Azure blob storage, but are necessary to restore databases from your own Azure blob storage.
In Connect to a Microsoft Subscription, select Sign in to sign in to your Azure subscription.
Sign in to your Microsoft Account to initiate the session in Azure.
Select the subscription of the storage account that contains the backup files.
Select the storage account that contains the backup files.
Select the blob container that contains the backup files.
Enter the expiration date of the shared access policy and select Create Credential. A shared access signature with the correct permissions is created. Select OK.
Restore the database
Now that you've selected a storage container, you should see the Locate Backup File in Microsoft Azure dialog.
In the left pane, expand the folder structure to show the folder that contains the backup files. In the right pane, select all the backup files that are related to the backup set that you're restoring, and then select OK. For example, the following screenshot shows the publicly accessible read-only blob storage containing the WideWorldImporters sample database.
SSMS validates the backup set. This process takes at most a few seconds. The duration depends on the size of the backup set.
If the backup is validated, you need to specify a name for the database that's being restored. By default, under Destination, the Database box contains the name of the backup set database. To change the name, enter a new name for Database. Select OK.
The restore process starts. The duration depends on the size of the backup set.
When the restore process finishes, a dialog shows that it was successful. Select OK.
In Object Explorer, check for the restored database by selecting Refresh.
Use T-SQL to restore from a backup file
As an alternative to the restore wizard, you can use T-SQL statements to restore a database. In SSMS, follow these steps to restore the Wide World Importers database to SQL Managed Instance by using T-SQL. The database backup file is stored in a preconfigured Blob Storage account.
Open SSMS and connect to your SQL managed instance.
In Object Explorer, right-click your SQL managed instance and select New Query to open a new query window.
Run the following T-SQL statement, which uses publicly available preconfigured storage container and a shared access signature key to create a credential in your SQL managed instance.
Penting
CREDENTIAL must match the container path, begin with https, and can't contain a trailing forward slash.
IDENTITY must be SHARED ACCESS SIGNATURE.
SECRET must be the shared access signature token and can't contain a leading ?.
In this example, SECRET is omitted because the storage account is publicly available. If you use a storage account that isn't publicly available, you must provide a shared access signature token.
The credential path in the previous example provides access to a single file. You can also create a shared access signature token to a folder path, for example:
If you receive Error: 3201 or Operating system error 86(The specified network password is not correct.), it is likely because your SAS credential (created in previous steps) is incorrectly created. DROP CREDENTIAL and recreate, review the credential name, identity, and secret.
Run the following statement to track the status of your restore process.
SQL
SELECT session_id as SPID, command, a.text ASQuery, start_time, percent_complete
, dateadd(second,estimated_completion_time/1000, getdate()) as estimated_completion_time
FROM sys.dm_exec_requests r
CROSSAPPLY sys.dm_exec_sql_text(r.sql_handle) a
WHERE r.command in ('BACKUP DATABASE','RESTORE DATABASE');
When the restore process finishes, view the database in Object Explorer. You can verify that the database is restored by using the sys.dm_operation_status view.
Nota
A database restore operation is asynchronous and retryable. You might get an error in SSMS if the connection fails or a time-out expires. SQL Managed Instance keeps trying to restore the database in the background, and you can track the progress of the restore process by using the sys.dm_exec_requests and sys.dm_operation_status views.
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.