A migração contínua (por vezes, referida como em curso ou online) é um fluxo contínuo de alterações de uma origem para um destino que segue uma transferência e um carregamento completos iniciais. No caso de uma migração, quando chegar a altura de mudar para usar o destino para leituras e escritas, execute uma operação promote. A promoção significa que a instância do Cloud SQL de destino é desligada da origem e é promovida de uma instância de réplica para uma instância principal.
A migração contínua segue estes passos:
Inicialmente, é tirado um instantâneo da base de dados de origem.
Isto incorre num bloqueio curto (inferior a 10 segundos) nas tabelas da base de dados, uma de cada vez, à medida que o despejo é criado. A origem pode continuar a aceitar escritas.
Após a obtenção da descarga inicial, esta é carregada no destino.
Após a conclusão do carregamento, as restrições, como chaves principais, chaves externas e índices, são recriadas na instância.
Depois de as restrições serem recriadas, as alterações em curso (também conhecidas como captura de dados de alterações ou CDC) são processadas.
Quando chegar a altura de mudar para a utilização do destino, pare de escrever na origem e inicie uma promoção. Isto permite que a aplicação leia e
escreva na base de dados de destino.
As aplicações dependentes podem sofrer tempo de inatividade durante, pelo menos, o período de atraso na replicação no momento da decisão de promoção.
Migração única
Este tipo de migração é um único resumo da base de dados num determinado momento,
retirado da origem e aplicado ao destino. Trata-se essencialmente de um despejo e carregamento, em que o destino está pronto a ser usado quando o carregamento estiver concluído. As aplicações que dependem da base de dados de origem podem sofrer indisponibilidade durante o processo de migração, uma vez que não podem ser feitas novas gravações nesta base de dados enquanto a migração estiver em curso.
A migração única segue estes passos:
Pare de escrever na base de dados de origem.
Inicie uma descarga da base de dados de origem.
Após a conclusão da descarga, esta é carregada para o destino. Quando o carregamento estiver concluído, é iniciada automaticamente uma promoção. A base de dados de destino passa a ser a base de dados principal e as aplicações dependentes devem ler e escrever nela.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-21 UTC."],[[["\u003cp\u003eContinuous migration involves a continuous flow of changes from the source to the destination, following an initial full dump and load, and ends with a \u003ccode\u003epromote\u003c/code\u003e operation that disconnects the destination from the source.\u003c/p\u003e\n"],["\u003cp\u003eThe continuous migration process includes taking a snapshot of the source, loading it into the destination, recreating constraints, processing ongoing changes, and finally promoting the destination when ready.\u003c/p\u003e\n"],["\u003cp\u003eOne-time migration is a single, point-in-time snapshot of the database from the source applied to the destination, with the destination becoming ready after the load is complete, meaning no new writes can occur while the migration is in progress.\u003c/p\u003e\n"],["\u003cp\u003eOne-time migration involves stopping writes to the source, dumping the source, and loading the dump into the destination, after which the destination becomes the primary database, and a promotion is automatically initiated.\u003c/p\u003e\n"]]],[],null,["# Types of migration\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n[MySQL](/database-migration/docs/mysql/migration-types \"View this page for the MySQL version of Database Migration Service.\") \\| PostgreSQL \\| [PostgreSQL to AlloyDB](/database-migration/docs/postgresql-to-alloydb/migration-types \"View this page for the PostgreSQL to AlloyDB version of Database Migration Service.\")\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nOverview\n--------\n\n### Continuous migration\n\nContinuous (sometimes referred to as ongoing or online) migration is a continuous flow of changes from a source to a destination that follows an initial full dump and load. In the case of a migration, when the time comes to switch to use the destination for reads and writes, perform a `promote` operation. Promotion means that the destination Cloud SQL instance is disconnected from the source, and is promoted from a replica instance to a primary instance.\n\nContinuous migration follows these steps:\n\n1. Initially, a snapshot is taken of the source database.\n This incurs a short (under 10 seconds) lockout on the database tables, one at\n a time, as the dump is created. The source can continue accepting writes.\n\n \u003cbr /\u003e\n\n2. After the initial dump is taken, it's loaded into the destination.\n\n3. After the load is completed, constraints such as primary keys, foreign keys,\n and indexes are recreated on the instance.\n\n4. After the constraints are recreated, the ongoing changes (also known as change data capture or CDC) are processed.\n\n | The delay between when a write occurs on the source and the current time is known as the `Replication delay`.\n\n \u003cbr /\u003e\n\n5. When the time comes to switch to using the destination, stop writing to the\n source and initiate a promotion. This allows the application to read and\n write against the destination database.\n\n6. Dependent applications can experience downtime for at least the\n duration of the replication delay at the time of the decision to promote.\n\n### One-time migration\n\nThis type of migration is a single point-in-time snapshot of the database,\ntaken from the source and applied to the destination. This is essentially a dump\nand load, where the destination is ready to be\nused when the load completes. Any applications that depend on the source database\ncan experience downtime during the migration process because there can be no new\nwrites to this database while the migration is in progress.\n\nOne-time migration follows these steps:\n\n1. Stop writing to the source database.\n\n2. Initiate a dump of the source database.\n\n3. After the dump is complete, it's loaded into the destination. When the load\n is completed, a promotion is initiated automatically. The\n destination database now becomes the primary database, and dependent\n applications should read and write to it."]]