我正在将数据库备份到Azure Blob存储。我能够从维护计划中备份和还原。但是,我无法使用脚本还原数据库。以下是我正在使用的T-SQL:
RESTORE DATABASE database_name
FROM URL = 'https://StorageAccount.blob.core/Container/FileName.bak'
WITH CREDENTIAL = 'https://StorageAccount.blob.core.windows.net/Container', STATS = 10
我收到此错误:
3225级1号线1行的消息32
使用WITH CREDENTIAL语法对包含共享访问签名的凭据无效。消息3013,第16级,状态1,第1行
RESTORE DATABASE异常终止。
可以请您帮忙吗?
答案 0 :(得分:0)
您的凭据有误,请点击此链接至create a credential。
CREATE CREDENTIAL mycredential
WITH IDENTITY= 'msftutorialstorage', -- this is the name of the storage account you specified when creating a storage account
SECRET = '<storage account access key>' -- this should be either the Primary or Secondary Access Key for the storage account
然后在您的还原代码中,使用此凭据,如下所示:
RESTORE DATABASE AdventureWorks2016
FROM URL = 'https://msftutorialstorage.blob.core.windows.net/sql-backup/AdventureWorks2016.bak'
WITH CREDENTIAL = 'mycredential',
STATS = 5 -- use this to see monitor the progress
GO