SQL Server-Datenbanken zu Cloud SQL for SQL Server migrieren
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Ihre SQL Server-Datenbanken mit dem Database Migration Service zu einer Cloud SQL for SQL Server-Instanz migrieren.
Der Migrationsprozess umfasst die folgenden Aufgaben:
Exportieren Sie die vollständige Datenbanksicherung und die Transaktionsprotokolldateien aus der Quell-SQL Server-Instanz.
Sie können auch die optionale differenzielle Datenbanksicherung während der Migration verwenden.
Hochladen der Sicherungsdateien in einen Cloud Storage-Bucket.
Cloud SQL for SQL Server-Zielinstanz erstellen
Erstellen und Ausführen des Migrationsjobs in Database Migration Service.
Fortschritt des Migrationsjobs mit den Observabilitätsfunktionen des Database Migration Service beobachten
Hochstufen des Migrationsjobs, nachdem die Daten vollständig migriert wurden.
Kosten
Für homogene Migrationen zu Cloud SQL wird der Database Migration Service kostenlos angeboten. Die Preise für Cloud SQL und Cloud Storage gelten jedoch für Netzwerkkosten sowie für Cloud SQL- und Cloud Storage-Entitäten, die zu Migrationszwecken erstellt wurden.
In diesem Dokument verwenden Sie die folgenden kostenpflichtigen Komponenten vonGoogle Cloud:
Cloud Storage
Cloud SQL
Mit dem Preisrechner können Sie eine Kostenschätzung für Ihre voraussichtliche Nutzung vornehmen.
Überlegen Sie, in welcher Region Sie die Zieldatenbank erstellen möchten.
Der Database Migration Service ist ein vollständig regionales Produkt. Das bedeutet, dass alle mit der Migration verbundenen Entitäten (Quell- und Zielverbindungsprofile, Migrationsjobs, Zieldatenbanken, Speicher-Buckets) in einer einzigen Region gespeichert werden müssen.
Wählen Sie in der Google Cloud Console auf der Seite für die Projektauswahl ein Google Cloud -Projekt aus oder erstellen Sie eines.
Bitten Sie Ihren Administrator, Ihnen die erforderlichen IAM-Rollen für Ihr Projekt für die folgenden
Konten zuzuweisen, die am Migrationsprozess beteiligt sind, um die Berechtigungen zu erhalten, die Sie für homogene SQL Server-Migrationen mit dem Database Migration Service benötigen.
Nutzerkonto, mit dem die Migration durchgeführt wird:
Weitere Informationen zum Zuweisen von Rollen finden Sie unter
Zugriff verwalten.
Diese vordefinierten Rollen enthalten die Berechtigungen, die zum Ausführen homogener SQL Server-Migrationen mit dem Database Migration Service erforderlich sind. Erweitern Sie den Abschnitt Erforderliche Berechtigungen, um die erforderlichen Berechtigungen anzuzeigen:
Erforderliche Berechtigungen
Die folgenden Berechtigungen sind erforderlich, um homogene SQL Server-Migrationen mit Database Migration Service durchzuführen:
Nutzerkonto, mit dem die Migration durchgeführt wird:
So bereiten Sie Ihre Quelldaten für die Migration vor:
Überlegen Sie sich eine Sicherungsstrategie für den Migrationsprozess.
Der Database Migration Service unterstützt die Verwendung einer Differenzsicherung und der Transaktionsprotokolldateien für die Migration von Daten, die nach der vollständigen Sicherung in Ihrer Datenbank angezeigt werden.
Cloud SQL for SQL Server-Zielinstanz erstellen und konfigurieren
Achten Sie darauf, dass Sie genügend Rechen- und Arbeitsspeicherressourcen für die Migration verwenden, und weisen Sie dem Dienstkonto der Instanz die Rolle „Storage-Administrator“ (roles/storage.admin) zu.
Wenn Sie den Migrationsjob starten, werden die Ziel-Cloud SQL for SQL Server-Datenbanken in den Wiederherstellungsmodus versetzt, in dem sie vollständig vom Database Migration Service verwaltet werden. Sie können die Zielinstanz aktivieren, sobald die Daten vollständig migriert wurden. Nachdem die Zielinstanz hochgestuft wurde, sind alle Datenbanken in dieser Instanz voll funktionsfähig. Außerdem erhalten Sie vollen Schreibzugriff auf diese Datenbanken.
Mit den Observabilitätsfunktionen des Database Migration Service können Sie den Migrationsfortschritt sowie den Zustand Ihrer Zielinstanz im Blick behalten. Weitere Informationen finden Sie unter
Messwerte für Migrationsjobs.
Laden Sie weiterhin neue Sicherungsdateien mit Transaktionslogs in den Cloud Storage-Bucket hoch.
Wenn Sie Daten abdecken möchten, die nach dem Export der vollständigen Sicherung in Ihrer Quelldatenbank angezeigt werden,
exportieren Sie Sicherungsdateien mit Transaktionslogs und laden Sie sie in den Speicher-Bucket hoch. Der Database Migration Service erkennt neue Dateien automatisch, liest ihren Inhalt und sendet die Daten an die Zielinstanz.
Weitere Informationen finden Sie unter
Automatische Transaktionslog-Exporte.
Migration abschließen
Wenn Sie Ihre Anwendung auf die neue Cloud SQL for SQL Server-Instanz umstellen möchten, führen Sie die Migration so ab:
Beenden Sie alle Schreibvorgänge in Ihren Quelldatenbanken. Sie können sie in den schreibgeschützten Modus umschalten, um die Betriebsfunktionen beizubehalten.
Erstellen Sie die letzte Sicherung des Transaktionslogs, laden Sie die Datei in Ihren Speicher-Bucket hoch und beenden Sie die inkrementelle Ladephase im Database Migration Service.
Sie haben folgende Möglichkeiten:
Optional können Sie eine Transaktionsprotokolldatei hochladen, deren Name auf .trn.final endet. Der Database Migration Service beendet kontinuierliche Ladevorgänge, wenn er eine Sicherungsdatei erkennt, deren Name der .trn.final-Suffixkonvention entspricht.
Wenn der Database Migration Service die Verarbeitung dieser Datei abgeschlossen hat, ändert sich der Status des Migrationsjobs zu Bereit zur Umstellung.
[[["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-05 (UTC)."],[[["\u003cp\u003eThis guide outlines the process of migrating SQL Server databases to Cloud SQL for SQL Server using Database Migration Service, involving exporting backups, uploading them to Cloud Storage, creating a destination instance, and running a migration job.\u003c/p\u003e\n"],["\u003cp\u003eThe migration process requires specific IAM roles for both the user account performing the migration and the Database Migration Service account, such as Database Migration Admin, Storage Admin, and Cloud SQL Editor, to ensure proper permissions.\u003c/p\u003e\n"],["\u003cp\u003ePreparing for the migration involves performing full backups of the source SQL Server database, configuring a Cloud Storage bucket for backup files, and establishing connection profiles for both the source and destination.\u003c/p\u003e\n"],["\u003cp\u003eDatabase Migration Service offers cost-effective homogenous migrations at no additional charge, but users should be aware of the costs associated with Cloud SQL and Cloud Storage usage, as well as potential network charges.\u003c/p\u003e\n"],["\u003cp\u003eFinalizing the migration includes stopping write operations on the source database, taking and uploading the last transaction log backup, stopping the incremental load, and promoting the migration job to switch to the new Cloud SQL for SQL Server instance.\u003c/p\u003e\n"]]],[],null,["# Migrate your SQL Server databases to Cloud SQL for SQL Server\n\nThis page describes how to migrate your SQL Server databases to\nCloud SQL for SQL Server instance with Database Migration Service.\n\nThe migration process involves the following tasks:\n\n1. Exporting full database backup, and transaction\n log files from the source SQL Server instance.\n\n You can also use the optional differential database backup in your migration\n process.\n2. Uploading your backup files to a Cloud Storage bucket.\n\n3. Creating the destination Cloud SQL for SQL Server instance.\n\n4. Creating and running the migration job in Database Migration Service.\n\n5. Monitoring the migration job progress with Database Migration Service observability\n features.\n\n6. Promoting the migration job after the data is fully migrated.\n\nCosts\n-----\n\nFor homogenous migrations to Cloud SQL, Database Migration Service is offered\nat no additional charge. However, Cloud SQL and Cloud Storage pricing\napplies for network charges as well as Cloud SQL and Cloud Storage\nentities created for migration purposes.\n\nIn this document, you use the following billable components of\nGoogle Cloud:\n\n- Cloud Storage\n- Cloud SQL\n\nTo generate a cost estimate based on your projected usage, use the\n[pricing calculator](/products/calculator).\n\nBefore you begin\n----------------\n\n1. Verify if this migration path can fully support your scenario. See [SQL Server\n Known limitations](/database-migration/docs/sqlserver/known-limitations).\n2. Consider in which region you want to create the destination database. Database Migration Service is a fully-regional product, meaning all entities related to your migration (source and destination connection profiles, migration jobs, destination databases, storage buckets) must be saved in a single region.\n3. In the Google Cloud console, on the project selector page, select or [create a Google Cloud project](/resource-manager/docs/creating-managing-projects).\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n4. Enable the Database Migration Service, Compute Engine, Cloud Storage, and Cloud SQL Admin APIs. [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com,datamigration.googleapis.com,sqladmin.googleapis.com,storage.googleapis.com)\n\n### Required roles\n\nTo get the permissions that you need to perform homogeneous SQL Server\nmigrations with Database Migration Service, ask your administrator to grant the\nrequired IAM roles on your project for the following\n[accounts involved in the migration process](/database-migration/docs/sqlserver/access-control)\n\n- User account that performs the migration:\n - [Database Migration Admin](/iam/docs/roles-permissions/datamigration#datamigration.admin) (`roles/datamigration.admin`)\n - [Storage Admin](/iam/docs/roles-permissions/storage#storage.admin) (`roles/storage.admin`)\n - [Cloud SQL Editor](/iam/docs/roles-permissions/cloudsql#cloudsql.editor) (`roles/cloudsql.editor`)\n- Database Migration Service service account:\n - [Database Migration Admin](/iam/docs/roles-permissions/datamigration#datamigration.admin) (`roles/datamigration.admin`)\n - [Storage Admin](/iam/docs/roles-permissions/storage#storage.admin) (`roles/storage.admin`)\n - [Cloud SQL Editor](/iam/docs/roles-permissions/cloudsql#cloudsql.editor) (`roles/cloudsql.editor`)\n - [Cloud SQL Studio User](/iam/docs/roles-permissions/cloudsql#cloudsql.studioUser) (`roles/cloudsql.studioUser`)\n\nFor more information about granting roles, see\n[Manage access](/iam/docs/granting-changing-revoking-access).\n\nThese predefined roles contain the permissions required to perform homogeneous\nSQL Server migrations with Database Migration Service. To see the exact permissions\nthat are required, expand the **Required permissions** section: \n\n#### Required permissions\n\nThe following permissions are required to perform homogeneous SQL Server\nmigrations with Database Migration Service:\n\n- User account that performs the migration:\n - `datamigration.* `\n - `resourcemanager.projects.get`\n - `resourcemanager.projects.list`\n - `cloudsql.operations.get`\n - `cloudsql.instances.create`\n - `cloudsql.instances.get`\n - `cloudsql.instances.list`\n - `cloudsql.instances.import`\n - `cloudsql.databases.get`\n - `cloudsql.databases.list`\n - `cloudsql.databases.delete`\n - `compute.machineTypes.list`\n - `compute.machineTypes.get`\n - `compute.projects.get`\n - `storage.buckets.create`\n - `storage.buckets.list`\n- Database Migration Service service account:\n - `datamigration.* `\n - `resourcemanager.projects.get`\n - `resourcemanager.projects.list`\n - `cloudsql.instances.create`\n - `cloudsql.instances.get`\n - `cloudsql.instances.list`\n - `cloudsql.instances.executeSql`\n - `storage.objects.create`\n - `storage.objects.list`\n\nYou might also be able to get these permissions with\n[custom roles](/iam/docs/creating-custom-roles) or other\n[predefined roles](/iam/docs/roles-permissions).\n\nPrepare your source data\n------------------------\n\nTo prepare your source data for migration, follow these steps:\n\n1. [Consider your backup strategy for the migration process](/database-migration/docs/sqlserver/supported-backup-files).\n Database Migration Service supports using a differential backup and the transaction log\n files for migrating data that appears in your database after you take the full\n backup.\n\n2. [Perform a full backup of your source SQL Server database](/database-migration/docs/sqlserver/export-backup-files).\n Make sure you use the correct naming pattern.\n\n3. [Prepare a Cloud Storage bucket and upload your backup files to it](/database-migration/docs/sqlserver/storage-buckets).\n Make sure you set up the necessary directory structure for each backup file type\n you want to use.\n\n4. [Create a source connection profile](/database-migration/docs/sqlserver/create-source-connection-profile) for the Cloud Storage bucket.\n\nPrepare your Cloud SQL for SQL Server destination instance\n----------------------------------------------------------\n\nTo configure your destination Cloud SQL instance, perform the following steps:\n\n1. [Create and configure your Cloud SQL for SQL Server destination instance](/database-migration/docs/sqlserver/create-cloud-sql-destination-instance).\n Make sure you use enough compute and memory resources to cover your migration needs,\n and assign the Storage Admin (`roles/storage.admin`) role to the instance's\n service account.\n\n2. [Create a destination\n connection profile](/database-migration/docs/sqlserver/create-destination-connection-profile) for your Cloud SQL instance.\n\nCreate and run the migration job\n--------------------------------\n\nTo configure and run your migration, perform the following steps:\n\n1. [Create and run the migration job](/database-migration/docs/sqlserver/create-migration-job).\n\n When you start the migration job, your destination Cloud SQL for SQL Server\n databases are put into recovery mode where they are fully managed by\n Database Migration Service. You can promote your destination instance\n when your data is fully migrated. After your destination instance is promoted,\n all the databases in that instance become fully operational. You also gain\n full write access to those databases.\n | **Note:** To you use a differential backup file in the migration process, you need to use a specific configuration when you create the migration job. You can upload the differential backup file at a later time- after you create the migration job, but before you start uploading transaction log files.\n\n You can monitor the migration progress, as well as your destination instance\n health with Database Migration Service observability\n features. See\n [Migration job metrics](/database-migration/docs/sqlserver/migration-job-metrics).\n2. Keep uploading new transaction log backup files to the Cloud Storage bucket.\n\n To cover data that appears in your source database after you perform\n the full backup export,\n [export transaction log backup files](/database-migration/docs/sqlserver/export-backup-files) and upload them to\n the storage bucket. Database Migration Service automatically detects new files,\n reads their contents, and pushes the data to your destination instance.\n See\n [Automate transaction log exports](/database-migration/docs/sqlserver/automate-backup-exports).\n\nFinalize the migration\n----------------------\n\nWhen you decide to switch your application to the new Cloud SQL for SQL Server\ninstance, finalize the migration by following these steps:\n\n1. Stop all write operations on your source databases. You can switch them to read-only mode to retain operational functionality.\n2. Take the last transaction log backup, upload the file to your storage bucket, and stop the incremental load phase in Database Migration Service. You can achieve this result by performing one of the following actions:\n - Stop your [automated backup file uploads](/database-migration/docs/sqlserver/automate-backup-exports), or upload the last transaction log file. Monitor the [unprocessed transaction log backups size](/database-migration/docs/sqlserver/migration-job-metrics) to determine when Database Migration Service finishes processing that file.\n - Optionally, you can upload a transaction log file whose name ends in `.trn.final` suffix. Database Migration Service stops continuous loads when it detects a backup file whose name matches the [`.trn.final` suffix convention](/database-migration/docs/sqlserver/export-backup-files).\n\n When Database Migration Service finishes processing that file, migration\n job status changes to\n [**Ready to promote**](/database-migration/docs/sqlserver/migration-job-statuses#ready-to-promote).\n3. [Promote the migration job](/database-migration/docs/sqlserver/finalize-migration).\n4. (Optional) [Verify migration data](/database-migration/docs/sqlserver/verify-migration) for completeness."]]