SQL Server-Lizenz zu einem vorhandenen Windows-Server hinzufügen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Windows
Mit Compute Engine können Sie SQL Server auf Windows-Instanzen installieren und „Pay as you go”-Lizenzen (PAYG-Lizenzen) verwenden. In diesem Dokument wird Folgendes beschrieben:
Nach dem Hinzufügen eines Lizenzstrings zum Bootlaufwerk der Windows-Instanz werden Ihnen die Kosten nach Preisen für SQL Server-Images berechnet.
Beschränkungen
Sie können PAYG-Lizenzen nur für die folgenden SQL Server-Versionen anhängen:
SQL Server Web Edition
SQL Server Standard Edition
SQL Server Enterprise Edition
SQL Server-Lizenz hinzufügen
Mithilfe von SQL Server-Lizenzmetadaten auf einem Bootlaufwerk kann Google Cloud die SQL Server-Lizenznutzung genau verfolgen, in Rechnung stellen und entsprechende Berichte erstellen. Diese Metadaten sind erforderlich, wenn Sie PAYG-SQL Server-Lizenzen verwenden. Fügen Sie einem vorhandenen Bootlaufwerk eine SQL Server-Lizenz hinzu. Gehen Sie dazu so vor:
Ermitteln Sie die Lizenz, die Sie einer Instanz hinzufügen möchten. Für SQL Server muss die Lizenz sowohl der Version als auch der Edition entsprechen, die Sie ausführen möchten. Eine Liste der gültigen SQL Server-Lizenzstrings finden Sie auf dem Tab Lizenzstrings im Dokument Betriebssystemdetails für SQL Server.
Beenden Sie die Instanz:
gcloud compute instances stop VM_NAME
Ersetzen Sie VM_NAME durch den Namen der Instanz, die beendet werden soll.
Ermitteln Sie das Bootlaufwerk:
gcloud compute instances describe VM_NAME
Ersetzen Sie VM_NAME durch den Namen der Instanz.
Überprüfen Sie, ob die Ausgabe in etwa so aussieht:
CLONED_BOOT_DISK_NAME: der Name, den Sie dem geklonten Bootlaufwerk geben möchten.
SQL_SERVER_LICENSE ist die SQL Server-Lizenz, die Sie dem Bootlaufwerk hinzufügen möchten. Informationen zu SQL Server-Lizenzen finden Sie auf dem Tab „Lizenz“ im Abschnitt SQL Server unter Windows.
BOOT_DISK_NAME: der Name des Quell-Bootlaufwerks, das Sie klonen möchten.
BOOT_DISK_ZONE: Die Zone des Quelllaufwerks.
CLONED_BOOT_DISK_ZONE: die Zone, in der Sie das geklonte Bootlaufwerk erstellen möchten.
Überprüfen Sie, ob das neue Laufwerk über die richtige Lizenz verfügt:
VM_INSTANCE_NAME: der Name der Instanz, an die Sie das SQL Server-Medienlaufwerk anhängen möchten
SQL_SERVER_MEDIA_DISK_NAME: der Name des SQL Server-Medienlaufwerks
SQL_SERVER_ZONE: Zone der Instanz
Nachdem das SQL Server-Medienlaufwerk an eine Instanz angehängt wurde, öffnen Sie auf Ihrem Windows-Computer die Seite Datenträgerverwaltung, um zu prüfen, ob dem Laufwerk ein Laufwerksbuchstaben zugewiesen ist. Wenn nicht, klicken Sie mit der rechten Maustaste auf das Laufwerk und wählen Sie Online aus, um es online zu stellen. Das SQL Server-Medienlaufwerk ist jetzt das Laufwerk D: auf der Seite Datenträgerverwaltung und in Windows Explorer.
Prüfen Sie, ob das Bootlaufwerk Ihrer Instanz mindestens 5 GB freien Speicherplatz hat, und kopieren Sie die SQL Server-Medien auf Ihr Bootlaufwerk:
SQL Server-Produktschlüssel auf eine Compute Engine-Instanz anwenden
Für ein Upgrade der SQL Server-Installationsmedien müssen Sie einen Produktschlüssel abrufen und auf die Compute Engine-Instanz anwenden, auf der der SQL Server installiert ist. So rufen Sie den Produktschlüssel ab und aktualisieren das SQL Server-Installationsmedium:
Rufen Sie den Produktschlüssel aus dem SQL Server-Installationsmedium ab:
C:\> type C:\sql_server_install\x64\DefaultSetup.ini
Stellen Sie mithilfe von Remote Desktop eine Verbindung zur Instanz her, auf der SQL Server installiert ist, und melden Sie sich mit Ihrem Domainnutzer an.
Klicken Sie mit der rechten Maustaste auf die Schaltfläche Start (oder drücken Sie Win + X) und wählen Sie Ausführen.
Bestätigen Sie die Eingabeaufforderung für erhöhte Rechte durch Klicken auf Ja.
[[["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-08-19 (UTC)."],[[["\u003cp\u003eCompute Engine allows you to install SQL Server on Windows virtual machines (VMs) with pay-as-you-go (PAYG) licensing, which is tracked and billed through license metadata on the boot disk.\u003c/p\u003e\n"],["\u003cp\u003eAdding a SQL Server license to a VM's boot disk involves stopping the VM, detaching the existing boot disk, cloning it with the new license, and reattaching the cloned disk as the new boot disk, noting that once a license is added, it cannot be removed.\u003c/p\u003e\n"],["\u003cp\u003eSQL Server installation media can be obtained by creating a new disk from a SQL Server image, attaching it to a VM, and then copying the installation files to the VM's boot disk, after which the SQL server media disk can be detached.\u003c/p\u003e\n"],["\u003cp\u003eUpgrading the SQL Server edition on a VM requires obtaining a new product key from the installation media and applying it through the SQL Server setup process.\u003c/p\u003e\n"],["\u003cp\u003ePAYG SQL Server licenses are available for Web, Standard, and Enterprise editions.\u003c/p\u003e\n"]]],[],null,["# Add a SQL Server license to an existing Windows server\n\nWindows\n\n*** ** * ** ***\n\nCompute Engine lets you install SQL Server on Windows instances and use\npay-as-you-go (PAYG) licenses. This document describes how you can perform the\nfollowing:\n\n1. [Add SQL Server license metadata to a boot disk](#add-sql-server-license)\n2. [Obtain SQL Server media and install SQL Server](#obtain-sql-server-media)\n3. [Apply a SQL server product key to a Compute Engine instance](#apply-sql-server-product-key)\n\nBilling\n-------\n\nAfter adding a license string to the Windows instance's boot disk, you are\nbilled according to the pricing of [SQL Server images](/compute/disks-image-pricing#sql_server_pricing).\n\nLimitations\n-----------\n\n- You can only add PAYG licenses for the following editions of SQL Server:\n\n - SQL Server Web edition\n - SQL Server Standard edition\n - SQL Server Enterprise edition\n\nAdd a SQL Server license\n------------------------\n\nSQL Server license metadata on a boot disk allows Google Cloud to accurately\ntrack, bill, and report on SQL Server license usage. This metadata is required\nwhen using PAYG SQL Server licenses. Add a SQL Server license to an existing boot\ndisk using the following procedure:\n| **Caution:** After you add a license to an instance, the license is bound to the instance and you cannot remove the license from the instance.\n\n1. Identify the license you want to add to an instance. For SQL Server, the\n license needs to match both the version and edition you want to run. For the\n list of valid SQL Server license strings, see the **License strings** tab in\n the [operating system details for SQL Server](/compute/docs/images/os-details#sql_server)\n document.\n\n2. Stop the instance:\n\n ```\n gcloud compute instances stop VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance to\n stop.\n3. Identify the boot disk:\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n4. Verify that the output is similar to the following:\n\n disks:\n - autoDelete: true\n boot: true\n deviceName: \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e\n diskSizeGb: '20'\n guestOsFeatures:\n - type: UEFI_COMPATIBLE\n index: 0\n interface: SCSI\n kind: compute#attachedDisk\n licenses:\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_LICENSE_STRING\u003c/var\u003e\n mode: READ_WRITE\n source: https://www.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_NAME\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/disks/\u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e\n type: PERSISTENT\n\n5. Detach the boot disk:\n\n ```\n gcloud compute instances detach-disk VM_NAME --disk=BOOT_DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the instance\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the boot disk\n6. Clone the boot disk and add the additional license:\n\n ```\n gcloud compute disks create CLONED_BOOT_DISK_NAME \\\n --licenses=SQL_SERVER_LICENSE \\\n --source-disk=BOOT_DISK_NAME \\\n --source-disk-zone=BOOT_DISK_ZONE \\\n --zone=CLONED_BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name you want to give the cloned book disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_LICENSE\u003c/var\u003e: the SQL Server license you want to add to the boot disk. For information on SQL Server licenses, see the License tab in section [SQL Server on Windows](/compute/docs/images/os-details#sql_server_on_windows)\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the source boot disk that you want to clone\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_ZONE\u003c/var\u003e: the zone of the source boot disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_ZONE\u003c/var\u003e: the zone in which you want to create the cloned boot disk\n7. Verify that the new disk has the correct license:\n\n ```\n gcloud compute disks describe CLONED_BOOT_DISK_NAME \\\n --zone=CLONED_BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name of the cloned book disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_ZONE\u003c/var\u003e: the zone of the cloned boot disk\n8. Attach the new disk as the boot disk for the instance:\n\n ```\n gcloud compute instances attach-disk VM_NAME \\\n --disk=CLONED_BOOT_DISK_NAME\n --boot\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the instance to which you want to attach the cloned boot disk\n - \u003cvar translate=\"no\"\u003eCLONED_BOOT_DISK_NAME\u003c/var\u003e: the name of the cloned book disk\n9. Verify that the instance's boot disk is the new cloned disk with SQL Server\n licensing.\n\n ```\n gcloud compute instances describe VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n10. Start the instance.\n\n ```\n gcloud compute instances start VM_NAME\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e with the name of the instance.\n11. (Optional) When you are sure that you don't want to revert back to the earlier\n boot disk, you can delete the disk.\n\n ```\n gcloud compute disks delete BOOT_DISK_NAME \\\n --zone=BOOT_DISK_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_NAME\u003c/var\u003e: the name of the boot disk that you want to delete\n - \u003cvar translate=\"no\"\u003eBOOT_DISK_ZONE\u003c/var\u003e: the zone of the boot disk\n\nObtain the SQL Server media and install SQL Server\n--------------------------------------------------\n\nTo obtain the SQL Server installation media and copy it to a Compute Engine\ninstance boot disk, do the following:\n\n1. Create a new disk containing the SQL Server installation media using any\n version of SQL server (for example, 2019 Enterprise):\n\n ```\n gcloud compute disks create SQL_SERVER_MEDIA_DISK_NAME \\\n --image-family=sql-ent-2019-win-2022 \\\n --image-project=windows-sql-cloud \\\n --zone=SQL_SERVER_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk that you want to create\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_ZONE\u003c/var\u003e: the zone in which you want to create the SQL Server media disk\n2. Attach the disk to any existing Compute Engine instance:\n\n ```\n gcloud compute instances attach-disk VM_INSTANCE_NAME \\\n --disk=SQL_SERVER_MEDIA_DISK_NAME\n --zone=SQL_SERVER_ZONE\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_INSTANCE_NAME\u003c/var\u003e: the name of the instance to which you want to attach the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_ZONE\u003c/var\u003e: the zone of the instance\n\n After the SQL Server media disk is attached to a instance, on your Windows\n machine, open the **Disk Management** page to see if the disk has a drive\n letter assigned to it. If not, right-click on the disk and select **Online**\n to bring it online. The SQL Server media disk is now the `D:` drive on the\n **Disk Management** page and in Windows Explorer.\n3. Verify that the boot disk of your instance has at least 5 GB of free disk\n space and copy the SQL Server media to your boot disk:\n\n ```\n robocopy /mir d:\\sql_server_install\\ c:\\sql_server_install\n ```\n4. Detach the SQL Server media disk from the instance:\n\n ```\n gcloud compute instances detach-disk VM_INSTANCE_NAME \\\n --disk=SQL_SERVER_MEDIA_DISK_NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eVM_INSTANCE_NAME\u003c/var\u003e: the name of the instance you from which you want to detach the SQL Server media disk\n - \u003cvar translate=\"no\"\u003eSQL_SERVER_MEDIA_DISK_NAME\u003c/var\u003e: the name of the SQL Server media disk that you want to detach from the instance\n\nFor more information, see [Microsoft SQL Server installation guide](https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server?view=sql-server-ver16#sql-server-installation).\n\nApply a SQL server product key to a Compute Engine instance\n-----------------------------------------------------------\n\nIn order to upgrade the SQL Server installation media, you must obtain and apply\na product key to the Compute Engine instance on which the SQL Server is\ninstalled. To obtain the product key and upgrade the SQL Server installation\nmedia, do the following:\n\n1. Obtain the product key from the SQL Server installation media:\n\n ```\n C:\\\u003e type C:\\sql_server_install\\x64\\DefaultSetup.ini\n ```\n2. Connect to the instance on which the SQL Server is installed [using Remote Desktop](/compute/docs/instances/connecting-to-windows) and sign in using your domain user.\n\n3. Right-click the **Start** button (or press **Win+X** ) and select **Run**.\n\n4. Confirm the elevation prompt by clicking **Yes**.\n\n5. Start the SQL Server setup:\n\n ```\n & c:\\sql_server_install\\setup.exe\n ```\n\nWhat's next\n-----------\n\n- [Learn about licenses](/compute/docs/licenses/about)\n\n- [View the SQL Server tutorials](/compute/docs/tutorials#sql-server)\n\n- [View the supported editions of SQL Server](/compute/docs/images/os-details#sql_server)"]]