SYSTEM$ZEROCOPY_SWAP_IMPORTED_DB_WITH_CLD
functionnot supportedCore SQL functionsExchanges the names of a database that was created from a legacy Salesforce data share and a catalog-linked database that was created from a Salesforce Zero-Copy connector. Use this function to move queries and references from the legacy database to the catalog-linked database without changing the names that they use.
Syntax
SYSTEM$ZEROCOPY_SWAP_IMPORTED_DB_WITH_CLD('<imported_db>', '<cld_db>')
Parameters
| Name | Required | Description |
|---|---|---|
imported_db | required | The name of the database that was created from a share. Specify it as a string literal. A fully qualified name isn’t needed, because database names are unique. |
cld_db | required | The name of the catalog-linked database that was created from a Salesforce Zero-Copy connector, as a string literal. |
Returns
Returns a string that confirms the swap.
Usage notes
- The function renames the databases in one transaction. It doesn’t move privileges: each database keeps its own grants and ownership. After the swap, roles that had access to the legacy database have no access to the catalog-linked database that now carries its name. Grant USAGE on the database and its schemas, and SELECT on its views, to those roles.
- Before you swap, check that the connector is connected and that schema names match.
- To undo the swap, call the function again with the names as they are after the swap: the database that was imported first, and the catalog-linked database second.
- References to the legacy schema names (schema_<share>) keep resolving only if the catalog-linked database has LEGACY_SALESFORCE_SCHEMA_ALIAS = TRUE. To set it, use ALTER DATABASE … UPDATE LINKED_ZEROCOPY_CONNECTOR.
- The function fails if the first argument isn’t a database created from a share, or the second isn’t a catalog-linked database of a Salesforce connector.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object OWNERSHIP | The database that was created from a share (imported_db). OWNERSHIP | The catalog-linked database (cld_db). For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.