11 ORDS_EXPORT_ADMIN PL/SQL Package Reference

This section describes how the ORDS_EXPORT_ADMIN package enables users to export REST-enabled objects within a schema.

The ORDS_EXPORT_ADMIN package enables users to export REST-enabled objects within a schema with the ORDS_ADMINISTRATOR_ROLE role. Administrators can selectively export specific REST-related artifacts using the provided schema name and additional parameters. This capability is particularly useful for documenting and migrating REST services as it ensures that only the necessary objects are included.

The following sections explains on how the parameters are used to provide fine-grained control over the export process and cater to various administrative needs.

11.1 ords_export_admin.export_schema

Format

FUNCTION ords_export_admin.export_schema(
  p_schema                  IN VARCHAR2,
  p_include_modules         IN BOOLEAN DEFAULT TRUE,
  p_include_privileges      IN BOOLEAN DEFAULT TRUE,
  p_include_roles           IN BOOLEAN DEFAULT TRUE,
  p_include_oauth           IN BOOLEAN DEFAULT TRUE,
  p_include_rest_objects    IN BOOLEAN DEFAULT TRUE,
  p_include_jwt_profiles    IN BOOLEAN DEFAULT TRUE,
  p_include_enable_schema   IN BOOLEAN DEFAULT TRUE,
  p_export_date             IN BOOLEAN DEFAULT TRUE,
  p_runnable_as_admin       IN BOOLEAN DEFAULT TRUE
)
RETURN CLOB;
Description

ords_export_admin.export_schema function is only valid for exporting the schemas that are previously REST-enabled.

Table 11-1 Parameters

Parameter Description
p_schema Specifies the name of the REST-enabled schema you want to export.
p_include_modules Specifies whether modules/templates/handlers/parameters calls are included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_include_privileges Specifies whether all privileges call are included in the export. Set the value to TRUE to include the calls otherwise, set the value to FALSE.
P_include_roles Specifies whether all the role calls are included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_include_oauth Specifies whether all Oauth client calls are included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_include_rest_object Specifies whether all REST-object calls are included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_include_jwt_profiles Specifies whether JWT profile call is included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_include_enable_schema Specifies whether ORDS.ENABLE_SCHEMA call is included in the export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_export_date Specifies whether the date when the export is made is included in the header export. Set the value to TRUE to include the calls, otherwise set the value to FALSE.
p_runnable_as_admin Specifies whether Public or Admin packages are used in the exported script. Set the value to TRUE if the exported script is planned to run as an administrator user targeting another schema, otherwise set the value to FALSE if current user is the target schema.

Examples

Example 11-1 Exporting with defaults

Following is an example of exporting the schema with all the boolean parameters set as default to TRUE. The exported script contains all the objects.

DECLARE
  v_exported_script CLOB;
BEGIN
  v_exported_script := ORDS_EXPORT_ADMIN.EXPORT_SCHEMA(
    P_SCHEMA => 'TEST_SCHEMA'
  );
END;

Example 11-2 Exporting with parameters

Following example uses all the optional parameters to indicate:
  • Not to include the JWT profiles in the export script
  • Output script does not have the exported date (useful to run the differences)
DECLARE
  v_exported_script CLOB;
BEGIN
  v_exported_script := ORDS_EXPORT_ADMIN.EXPORT_SCHEMA(
    P_SCHEMA => 'TEST_SCHEMA',
    P_INCLUDE_MODULES => TRUE,
    P_INCLUDE_PRIVILEGES => TRUE,
    P_INCLUDE_ROLES => TRUE,
    P_INCLUDE_OAUTH => TRUE,
    P_INCLUDE_REST_OBJECTS => TRUE,
    P_INCLUDE_JWT_PROFILES => FALSE,
    P_INCLUDE_ENABLE_SCHEMA => TRUE,
    P_EXPORT_DATE => FALSE,
    P_RUNNABLE_AS_ADMIN => TRUE
  );
END;