It may be that you are trying to move your DB from on premise to Azure and using ALTER DATABASE command. Once you make the metadata change using ALTER DATABASE and then move the physical file to AZURE, the DB fails to come online with the following error message:
2014-05-15 04:31:59.370 spid26s Error: 5120, Severity: 16, State: 142.
2014-05-15 04:31:59.370 spid26s Unable to open the physical file "https://ifxx.blob.core.windows.net/iftpoc/xxx.mdf". Operating system error 12150: "12150(failed to retrieve text for this error. Reason: 317)".
2014-05-15 04:31:59.420 spid26s Error: 17207, Severity: 16, State: 1.
2014-05-15 04:31:59.420 spid26s FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'https://ifxx.blob.core.windows.net/iftpoc/xx_log.ldf'. Diagnose and correct the operating system error, and retry th
2014-05-15 04:31:59.420 spid26s File activation failure. The physical file name "https://ifxx.blob.core.windows.net/ifxxc/xx_log.ldf" may be incorrect.
There are two issue here:
1. When you have moved the files, the files have been moved as block BLOB and not as page Blob. To remove this restriction, you have to make use of API mentioned by PG team to move the files.
2. There are already files with the same name on the blob container which we have created.
The best option to move the database is to take a backup and then restore it with the move command:
RESTORE DATABASE TestDB3Restore
FROM DISK = 'C:\BACKUP\TestDB3Restore.bak'
MOVE 'TestDB3Restore' TO 'https://ifxx.blob.core.windows.net/iftpoc/TestDB3Restore.mdf',
MOVE 'TestDB3Restore_log' TO 'https://ifxx.blob.core.windows.net/iftpoc/TestDB3Restore_log.ldf';
Happy Learning & Troubleshooting!!
Disclaimer: Everything here, is my personal opinion and is not read or approved by Microsoft before it is posted. No warranties or other guarantees will be offered as to the quality of the opinions or anything else offered here.