Cross Subscription Copying of Databases on Windows Azure SQL Database

后端 未结 7 812
北恋
北恋 2020-12-24 13:13

We are about to split our testing and production instances in Windows Azure into two separate subscriptions. Currently we have 3 Windows Azure SQL Database instances that r

相关标签:
7条回答
  • 2020-12-24 13:46

    You can do this in SSMS on the target server using

    CREATE DATABASE db1 AS COPY OF sourcesrv.db1
    

    to copy from sourcesrv.database.windows.net which is in a different subscription.

    However, you must first check you can connect in SSMS to the SOURCE server too, or you will get a totally confusing error message which hides the actual problem.

    The source server may be one you regularly connect to, but not from the IP address you're currently on. In that case you must add the IP to the server's firewall rules. This is easily done using the dialog that appears when you try to connect from SSMS:

    Leave the default radiobutton checked ("Add my client IP") and press OK.

    If you omit this check and it fails to authenticate you, instead of telling you the correct reason as above, it tells you you can't make a copy on the SOURCE server!

    --In SSMS connected to targetsrv:
    
    CREATE DATABASE db1 AS COPY OF sourcesrv.db1
    
    --Here it should say, "Your client IP address does not have access" to sourcesrv, like when
    --you try to connect in SSMS. Instead, it says you can't copy to the SOURCE, even though you 
    --told it to copy FROM the source to the TARGET:
    
    --Msg 45137, Level 16, State 1, Line 7
    --Insufficient permission to create a database copy on server 'sourcesrv'.
    

    Note that at the time of writing, the two servers need to be configured with the same admin credentials, otherwise the CREATE DATABASE command will fail with this same confusing error message.

    0 讨论(0)
提交回复
热议问题