Cloud SQL using Database
Migration Service | Migrating
On-premises MySQL Using a
Continuous Database
Migration Service Job| Task 6.
Test the continuous
migration of data from the
source to the destination
instance| 500+ expert
curated questions and
answers | GUARANTEED
SUCCESS
Level:Introductory
Time: 1hr 30 min
GSP859
,Task 6 - Testing Continuous Data Migration
Objective
This guide provides a step-by-step framework to validate continuous data
migration from a source MySQL instance to a Cloud SQL replica, ensuring
learners can:
1. Add test data to the source database
2. Verify replication to Cloud SQL
3. Troubleshoot common synchronization issues
4. Document the migration validation process
Pre-Task Checklist
✅ Ensure both source (Compute Engine) and destination (Cloud SQL)
instances are running
✅ Confirm you have SSH access to dms-mysql-training-vm-v2
✅ Verify Cloud Shell is enabled in your project
✅ Note the current record count in both databases (should be 5,030)
Step-by-Step Assessment
Phase 1: Source Data Modification
1. Connect to Source MySQL
bash
Copy
# Via Cloud Console SSH or gcloud command:
gcloud compute ssh dms-mysql-training-vm-v2
# Access MySQL:
,mysql -u admin -p
# Password: changeme
2. Insert Test Records
sql
Copy
USE customers_data;
INSERT INTO customers
(customerKey, addressKey, title, firstName, lastName, birthdate, gender,
maritalStatus, email, creationDate)
VALUES
('9365552000000-999', '9999999', 'Ms', 'Magna', 'Ablorem', '1953-07-28',
'FEMALE', 'MARRIED', '', NOW()),
('9965552000000-9999', '99999999', 'Mr', 'Arcu', 'Abrisus', '1959-07-28',
'MALE', 'MARRIED', '', NOW());
3. Verify Source Changes
sql
Copy
-- Count check (should increase by 2)
SELECT COUNT(*) FROM customers; -- Expected: 5,032
-- Data validation
SELECT * FROM customers
ORDER BY lastName
LIMIT 10; -- First record should now be "Ablorem"
Assessment Criteria:
✔ Successfully added 2 test records
✔ Confirmed record count increased to 5,032
✔ Verified sort order reflects new data
, Phase 2: Replication Validation
1. Connect to Cloud SQL
bash
Copy
gcloud sql connect mysql-cloudsql --user=root --quiet
# Password: supersecret!
2. Validate Replicated Data
sql
Copy
USE customers_data;
-- Count verification
SELECT COUNT(*) FROM customers; -- Must match 5,032
-- Data consistency check
SELECT * FROM customers
ORDER BY lastName
LIMIT 10; -- Should show "Ablorem" as first record
Assessment Criteria:
✔ Cloud SQL count matches source (5,032)
✔ New records appear in correct sort position
✔ All field values preserved during replication
Advanced Validation Techniques
1. Replication Lag Analysis
sql
Copy
-- On Cloud SQL:
SHOW SLAVE STATUS\G