Debes tener uno de estos roles de IAM en el proyecto Google Cloud que estás usando:
roles/alloydb.admin (el rol de IAM predefinido de administrador de AlloyDB)
roles/owner (el rol de IAM básico de propietario)
roles/editor (el rol básico de IAM de Editor)
Si no tienes ninguno de estos roles, comunícate con el administrador de tu organización para solicitar acceso.
Cómo habilitar una extensión
En general, para habilitar una extensión, debes conectarte a una base de datos en la instancia principal de un clúster de AlloyDB y, luego, ingresar un comando LOAD o CREATE EXTENSION.
Sin embargo, algunas extensiones requieren que configures una o más marcas de la base de datos antes de que puedas usar el comando LOAD o CREATE EXTENSION para habilitar la extensión. Puedes establecer estas marcas en la instancia de AlloyDB en la que deseas usar la extensión, ya sea la instancia principal o la instancia del grupo de lectura.
En la lista de extensiones compatibles, se muestran las extensiones que requieren este paso y se indican las marcas de base de datos que debes establecer.
En el símbolo del sistema de psql, conéctate a la base de datos que tiene habilitada la extensión y descarta la extensión:
\cDB_NAMEDROPEXTENSIONEXTENSION_NAME;
Repite el paso anterior para conectarte a cualquier otra base de datos que tenga habilitada la extensión y descarta la extensión en cada una de ellas.
Si la extensión requería que se establecieran marcas de base de datos en las instancias en las que se usaba, quita las marcas de cada una de las instancias en las que se usó siguiendo las instrucciones en Configura las marcas de base de datos de una instancia.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (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."]]