无法使用 T-SQL 从 blob 容器恢复数据库
Not able to restore databases from blob container using T-SQL
我正在将我的数据库备份到 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
我收到这个错误:
Msg 3225, Level 16, State 1, Line 1
Use of WITH CREDENTIAL syntax is not valid for credentials containing a Shared Access Signature.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
你能帮忙吗?
您的凭据有误,请按此link至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
我正在将我的数据库备份到 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
我收到这个错误:
Msg 3225, Level 16, State 1, Line 1
Use of WITH CREDENTIAL syntax is not valid for credentials containing a Shared Access Signature.Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
你能帮忙吗?
您的凭据有误,请按此link至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