Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie prüfen können, ob Ihre migrierten Daten vollständig und korrekt sind. Sie sollten mindestens SQL-Anweisungen ausführen, um zu prüfen, ob Ihre Tabellen in der migrierten AlloyDB for PostgreSQL-Datenbank vorhanden sind. Für einen genaueren Datenvergleich zwischen der Quell- und der Zieldatenbank können Sie
das Open-Source-Datenvalidierungstool verwenden.
Zieldaten mit SQL-Anweisungen prüfen
Sie können SQL-Anweisungen ausführen, um zu prüfen, ob Ihre Tabellen in der migrierten AlloyDB for PostgreSQL-Datenbank vorhanden sind. Gehen Sie dazu so vor:
Stellen Sie mit einem Tool, mit dem Sie SQL-Befehle für Ihre migrierten Datenbanken ausführen können, eine Verbindung zu Ihrer Cloud SQL for PostgreSQL-Instanz her.
Weitere Informationen zum Herstellen einer Verbindung zu Cloud SQL-Instanzen finden Sie in der Cloud SQL-Dokumentation unter Verbindungsoptionen.
Führen Sie SQL-Befehle aus, um die migrierten Daten zu überprüfen. Beispiel:
Alle Tabellen in der Datenbank auflisten:
SELECT*FROMpg_catalog.pg_tables;
Prüfen Sie den Tabelleninhalt:
SELECT*FROMTABLE_NAME';
Mit dem Datenvalidierungstool bestätigen
Mit dem
Open-Source-Tool zur Datenvalidierung können Sie sehr genaue Datenvergleiche zwischen zwei Datenbanken durchführen. Dazu müssen Sie jedoch Netzwerkverbindungen zu Ihren Quell- und Zieldatenbanken herstellen.
Die folgenden Schritte zeigen ein minimales Beispiel:
Stellen Sie eine VM mit Zugriff auf Quelle und Ziel bereit oder verwenden Sie eine solche VM.
Erstellen Sie auf der virtuellen Maschine einen Ordner, in dem Sie das Data Validation Tool installieren.
Rufen Sie diesen Ordner auf.
Verwenden Sie pip, um das Datenvalidierungstool zu installieren.
pip install google-pso-data-validator
Verbindungen zur Oracle-Quelldatenbank und zur AlloyDB for PostgreSQL-Zieldatenbank erstellen:
Wir empfehlen, diese Validierung während der Replikation auszuführen, um eine relative Konsistenz zu gewährleisten. Abfragen für große Tabellen können während eines kurzen Angebotszeitraums zu lange dauern. Verwenden Sie in solchen Fällen das Tool zur Datenvalidierung, um Filter hinzuzufügen, die die Laufzeit verkürzen, oder bereiten Sie die Tabellenliste so vor, dass sie eine Teilmenge von Tabellen für die endgültige Validierung enthält.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-01 (UTC)."],[[["\u003cp\u003eThis guide details how to verify the successful migration of data from a source database to a Cloud SQL destination instance.\u003c/p\u003e\n"],["\u003cp\u003eYou can perform initial verification by checking for the existence of the migrated database instance and its tables in Cloud SQL.\u003c/p\u003e\n"],["\u003cp\u003eThe Data Validation Tool, an open-source utility, can be used to confirm the accuracy of data between the source and destination databases.\u003c/p\u003e\n"],["\u003cp\u003eTo use the Data Validation Tool, you must first install it on a virtual machine that has access to both the source and destination databases and then create the corresponding connections.\u003c/p\u003e\n"],["\u003cp\u003eThe Data Validation tool can also be used during replication to ensure relative data consistency.\u003c/p\u003e\n"]]],[],null,["# Verify a migration\n\nThis page describes how to confirm that your migrated data is complete and\naccurate. At a minimum, you should run SQL statements to verify that your tables\nexist in the migrated AlloyDB for PostgreSQL database. For a more precise\ndata comparison between the source and destination database,\nyou can\n[try using the open-source Data Validation Tool](#verify-dvt).\n\nVerify destination data with SQL statements\n-------------------------------------------\n\nYou can run SQL statements to verify that your tables\nexist in the migrated AlloyDB for PostgreSQL database. Do the following:\n\n1. Connect to your Cloud SQL for PostgreSQL instance with a tool where you can run SQL commands against your migrated databases. For more information on connecting to Cloud SQL instances, see\n [Connection options](/sql/docs/postgres/connect-overview#tools_for_connecting_to)\n in Cloud SQL documentation.\n\n2. Run SQL commands to verify your migrated data. For example:\n\n - List all tables in the database: \n\n ```sql\n SELECT * FROM pg_catalog.pg_tables;\n ```\n - Verify the table contents: \n\n ```sql\n SELECT * FROM TABLE_NAME';\n ```\n\nVerify using the Data Validation Tool\n-------------------------------------\n\nThe [open-source Data Validation Tool](https://github.com/GoogleCloudPlatform/professional-services-data-validator) lets you perform very precise\ndata comparisons between two databases, but it requires creating network\nconnections to your source and destination databases.\n\nThe following steps show a minimal example:\n\n1. Deploy or use a virtual machine with access to both the source and the destination.\n\n2. In the virtual machine, create a folder in which to install the Data Validation Tool.\n\n3. Navigate to this folder.\n\n4. Use [`pip`](https://pip.pypa.io/en/stable/) to install the Data Validation Tool.\n\n ```\n pip install google-pso-data-validator\n ```\n5. Create connections to the source Oracle database and the destination AlloyDB for PostgreSQL database:\n\n ```\n data-validation connections add -c source Oracle --host 'ip-address' --port port --user username --password pswd --database database-name\n data-validation connections add -c target Postgres --host 'ip-address' --port port --user username --password pswd --database database-name\n ```\n\n For example: \n\n ```\n data-validation connections add -c source Oracle --host '10.10.10.11' --port 1521 --user system --password pswd --database XE\n data-validation connections add -c target Postgres --host '10.10.10.12' --port 5432 --user postgres --password pswd --database postgres\n ```\n6. Create or generate a list of tables to compare data between the source and destination databases:\n\n ```\n export TABLES_LIST=$(data-validation find-tables --source-conn source --target-conn target --allowed-schemas schema-name)\n ```\n\n For example: \n\n ```\n export TABLES_LIST=$(data-validation find-tables --source-conn source --target-conn target --allowed-schemas public)\n ```\n7. Run full validation against all tables:\n\n ```\n data-validation validate column --source-conn source --target-conn target --tables-list \"${TABLES_LIST}\"\n ```\n\nWe suggest that you run this validation during replication to ensure relative\nconsistency. Large table queries may take too long to run during a small promotion\nwindow. In such cases, use the Data Validation Tool to add filters to reduce\nruntime or prepare the table list to include a subset of tables for the final\nvalidation."]]