Azure

Copy Database From One Azure subscription to One other

Step 1

Create login and consumer within the grasp database of the supply server.

CREATE LOGIN migrationuser WITH PASSWORD = 'XXXXXXXXXX'
GO
CREATE USER migrationuser FOR LOGIN migrationuser WITH DEFAULT_SCHEMA=[dbo];
GO
ALTER ROLE dbmanager ADD MEMBER migrationuser;
GO

Step 2

Create the consumer within the supply database and grant dbowner permission to the database.

CREATE USER migrationuser FOR LOGIN migrationuser WITH DEFAULT_SCHEMA=[dbo];
GO
ALTER ROLE db_owner ADD MEMBER migrationuser;
GO

image

Step 3

Seize the SID of the consumer “loginname” from grasp database

SELECT [sid] FROM sysusers WHERE [name] = 'migrationuser';

Consequence – 0x0106000000000064000000000000000070189A02C0E2E446B0034C6FD13AC46F

Step 4

Connect with Vacation spot server. –Create login and consumer within the grasp database, identical as of the supply server.

CREATE LOGIN migrationuser WITH PASSWORD = 'XXXXXXXX', SID = 0x0106000000000064000000000000000070189A02C0E2E446B0034C6FD13AC46F;
GO
CREATE USER migrationuser FOR LOGIN migrationuser WITH DEFAULT_SCHEMA=[dbo];
GO
ALTER ROLE dbmanager ADD MEMBER migrationuser;
GO

Step 5

Execute the copy of database script from the vacation spot server utilizing the credentials created

CREATE DATABASE supply
AS COPY OF [copy-sql-source].[source];

image

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button