Source DB
- The following permissions are mandatory for the source user in both cutover and non-cutover migrations.
Note: These steps should be done by an existing db_owner of this particular db.USE db_name;
CREATE USER dbreplicator_user FOR LOGIN dbreplicator_user;
ALTER ROLE [db_owner] ADD MEMBER dbreplicator_user;
GRANT VIEW DATABASE STATE to dbreplicator_user ;
USE master;
GRANT VIEW SERVER STATE TO dbreplicator_user;Note: Replace <dbreplicator_user> with your desired username and <db_name> with your db to be migrated. - Check this section for other configurations required for cutover migration.
Target DB
- If the target DB server is an AWS RDS instance, the default master use can be provided for the migration.
- In case the target DB server is not an AWS RDS Instance, strictly follow the following guidelines in order to achieve an accurate migration:
- In the target DB server, create the desired target DB (to be used for the migration) ‘YourDatabase’, using your default login (who now becomes the dbo of this DB).
- Now follow the following steps (only in the target DB server):
Use YourDatabase;
GO
CREATE LOGIN NewAccountName WITH PASSWORD= 'NewAccountPassword';
GO
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'NewAccountName')
BEGIN
CREATE USER [NewAccountName] FOR LOGIN [NewAccountName]
EXEC sp_addrolemember N'db_owner', N'NewAccountName'
END;
GONote: Replace `YourDatabase` with your migration target database; 'NewAccountName' with the desired account name; 'NewAccountPassword' with a desired password for the new account]
- Please provide this new login’s username and password in the target DB user field, while starting the migration.
Important note: This user should not have the 'sysadmin' role.
Live migration (cutover required) prerequisite
- Enable Distribution in your source server.
- Follow this documentation for enabling replication on the server.
- Follow this documentation to enable CDC for individual databases and/or tables.