Wenn Sie keine dieser Rollen haben, wenden Sie sich an den Organisationsadministrator, um Zugriff anzufordern.
Erweiterung aktivieren
Im Allgemeinen aktivieren Sie eine Erweiterung, indem Sie eine Verbindung zu einer Datenbank in der primären Instanz eines AlloyDB-Clusters herstellen und einen LOAD- oder CREATE EXTENSION-Befehl eingeben.
Bei einigen Erweiterungen müssen Sie jedoch ein oder mehrere Datenbank-Flags festlegen, bevor Sie die Erweiterung mit dem Befehl LOAD oder CREATE EXTENSION aktivieren können. Sie legen diese Flags für die AlloyDB-Instanz fest, für die Sie die Erweiterung verwenden möchten. Das kann die primäre Instanz oder die Instanz des Lesepools sein.
In der Liste der unterstützten Erweiterungen sehen Sie, für welche Erweiterungen dieser Schritt erforderlich ist und welche Datenbank-Flags Sie festlegen müssen.
Wiederholen Sie bei Bedarf den vorherigen Schritt, um eine Verbindung zu anderen Datenbanken herzustellen und die Erweiterung in jeder von ihnen zu erstellen.
Erweiterung deaktivieren
Sie deaktivieren eine Erweiterung, indem Sie die Schritte zum Aktivieren rückgängig machen.
Stellen Sie über die Eingabeaufforderung psql eine Verbindung zur Datenbank her, in der die Erweiterung aktiviert ist, und löschen Sie die Erweiterung:
\cDB_NAMEDROPEXTENSIONEXTENSION_NAME;
Wiederholen Sie den vorherigen Schritt, um eine Verbindung zu allen anderen Datenbanken herzustellen, in denen die Erweiterung aktiviert ist, und löschen Sie die Erweiterung in jeder von ihnen.
Wenn für die Erweiterung Datenbank-Flags für die Instanzen festgelegt werden mussten, in denen sie verwendet wurde, entfernen Sie die Flags aus jeder der Instanzen, in denen sie verwendet wurde. Folgen Sie dazu der Anleitung unter Datenbank-Flags einer Instanz konfigurieren.
In der Liste der unterstützten Erweiterungen sehen Sie, für welche Erweiterungen Datenbank-Flags festgelegt werden müssen und welche Flags erforderlich sind.
[[["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-25 (UTC)."],[[["\u003cp\u003eAlloyDB extensions are enabled by connecting to a database in the primary instance and using a \u003ccode\u003eLOAD\u003c/code\u003e or \u003ccode\u003eCREATE EXTENSION\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eSome extensions require setting specific database flags on the relevant AlloyDB instance, either primary or read pool, before enabling them.\u003c/p\u003e\n"],["\u003cp\u003eDisabling an extension involves connecting to the primary instance and using the \u003ccode\u003eDROP EXTENSION\u003c/code\u003e command within each relevant database.\u003c/p\u003e\n"],["\u003cp\u003eIf database flags were set for an extension, they must be removed from each instance where the extension was used after disabling the extension.\u003c/p\u003e\n"],["\u003cp\u003eThe necessary IAM roles for enabling or disabling extensions are \u003ccode\u003eroles/alloydb.admin\u003c/code\u003e, \u003ccode\u003eroles/owner\u003c/code\u003e, or \u003ccode\u003eroles/editor\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Configure database extensions\n\nThis page describes how to enable and disable PostgreSQL extensions in\nAlloyDB.\n\nSee [Supported database extensions](/alloydb/docs/reference/extensions) for the\nlist of the extensions that AlloyDB supports.\n\n\nBefore you begin\n----------------\n\n- The Google Cloud project you are using must have been [enabled to access AlloyDB](/alloydb/docs/project-enable-access).\n- You must have one of these IAM roles in the Google Cloud project you are using:\n - `roles/alloydb.admin` (the AlloyDB Admin predefined IAM role)\n - `roles/owner` (the Owner basic IAM role)\n - `roles/editor` (the Editor basic IAM role)\n\n If you don't have any of these roles, contact your Organization Administrator to request\n access.\n\n\u003cbr /\u003e\n\nEnable an extension\n-------------------\n\nIn general, you enable an extension by connecting to a database in\nan AlloyDB cluster's primary instance and entering a `LOAD` or\n`CREATE EXTENSION` command.\n\nHowever, some extensions require you to set one or more database flags\n**before** you can use the `LOAD` or `CREATE EXTENSION` command to enable the\nextension. You set these flags on the AlloyDB instance where you\nwant to use the extension, whether that instance is the primary instance or read\npool instance.\n\n### Procedure\n\n1. If required, [set the appropriate database flags](/alloydb/docs/instance-configure-database-flags) on the instance where you\n want to use the extension, either the primary instance or a read pool instance.\n\n The [list of supported extensions](/alloydb/docs/reference/extensions)\n shows which extensions require this step and states which database flags you\n must set.\n2. Connect a `psql` client to the cluster's primary instance, as\n described in [Connect a psql client to\n an instance](/alloydb/docs/connect-psql).\n\n | **Note:** You must connect to the primary instance even if you are enabling the extension on a read pool instance.\n3. At the `psql` command prompt, connect to the database and create the extension: \n\n ```sql\n \\c \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eDB_NAME\u003c/span\u003e\u003c/var\u003e\n CREATE EXTENSION IF NOT EXISTS \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eEXTENSION_NAME\u003c/span\u003e\u003c/var\u003e;\n ```\n | **Note:** To create the [auto_explain](https://www.postgresql.org/docs/16/auto-explain.html) extension, use the \\`LOAD\\` command.\n4. If desired, repeat the previous step to connect to other databases and create the extension in each of them.\n\nDisable an extension\n--------------------\n\nYou disable an extension by reversing the procedure used to enable it.\n\n1. Connect a `psql` client to the cluster's primary instance, as\n described in [Connect a psql client to\n an instance](/alloydb/docs/connect-psql).\n\n | **Note:** You must connect to the primary instance even if you are disabling an extension that is only being used on read pool instances.\n2. At the `psql` command prompt, connect to the database that has the extension enabled and drop the extension: \n\n ```sql\n \\c DB_NAME\n DROP EXTENSION EXTENSION_NAME;\n ```\n3. Repeat the previous step to connect to any other databases that have the extension enabled and drop the extension in each of them.\n4. If the extension required that database flags be set on the instances\n where it was used, remove the flags from each of the instances where it was\n used by following the instructions in\n [Configure an instance's\n database flags](/alloydb/docs/instance-configure-database-flags).\n\n The [list of supported extensions](/alloydb/docs/reference/extensions)\n shows which extensions require setting of database flags and identifies\n which flags."]]