11 APEX_INSTANCE_ADMIN

The APEX_INSTANCE_ADMIN package provides utilities for managing an Oracle Application Express runtime environment. You use the APEX_INSTANCE_ADMIN package to get and set email settings, Oracle Wallet settings, report printing settings and to manage schema to workspace mappings. APEX_INSTANCE_ADMIN can be executed by the SYS, SYSTEM, and APEX_050000 database users and any database user granted the role APEX_ADMINISTRATOR_ROLE.

Available Parameter Values

Table 11-1 lists all the available parameter values you can set within the APEX_INSTANCE_ADMIN package, including parameters for email, wallet, and reporting printing.

Table 11-1 Available Parameters

Parameter Name Description

ACCOUNT_LIFETIME_DAYS

The maximum number of days an end-user account password may be used before the account is expired.

ALLOW_DB_MONITOR

If set to Y, the default, database monitoring is enabled. If set to N, it is disabled.

ALLOW_HOSTNAMES

If set, users can only navigate to an application if the URL's hostname part contains this value. Instance administrators can configure more specific values at workspace level.

ALLOW_PUBLIC_FILE_UPLOAD

If set to Y, file uploads are allowed without user authentication. If set to N, the default, they are not allowed.

ALLOW_RAS

This parameter is only supported if running Oracle Database 12c.

If set to Y, enable Real Application Security support for applications. If set to N (the default), Real Application Security cannot be used.

ALLOW_REST

If set to Y, the default, developers are allowed to expose report regions as RESTful services. If set to N, the are not allowed.

APEX_BUILDER_AUTHENTICATION

Controls the authentication scheme for the internal builder applications. Valid parameter values include:

  • APEX - Application Express workspace accounts authentication (default)

  • DB - Database accounts authentication

  • HEADER - HTTP header variable based authentication

  • SSO - Oracle Single Sign-On authentication

  • LDAP - LDAP authentication

APEX_REST_PATH_PREFIX

Controls the URI path prefix used to access built-in RESTful Services exposed by Application Express. For example, built-in RESTful Service for referencing static application files using #APP_IMAGES# token. If the default prefix (r) conflicts with RESTful Services defined by users, adjust this preference to avoid the conflict.

APPLICATION_ACTIVITY_LOGGING

Controls instance wide setting of application activity log ([A]lways, [N]ever, [U]se application settings)

APPLICATION_ID_MAX

The largest possible ID for a websheet or database application.

APPLICATION_ID_MIN

The smallest possible ID for a websheet or database application.

AUTOEXTEND_TABLESPACES

If set to Y, the default, provisioned tablespaces is autoextended up to a maximum size. If set to N tablespaces are not autoextended.

BIGFILE_TABLESPACES_ENABLED

If set to Y, the tablespaces provisioned through Oracle Application Express are created as bigfile tablespaces. If set to N, the tablespaces are created as smallfile tablespaces.

CHECKSUM_HASH_FUNCTION

Defines the algorithm that is used to create one way hashes for URL checksums.Valid values are MD5 (deprecated), SH1 (SHA-1), SH256 (SHA-2, 256 bit), SH384 (SHA-2, 384 bit), SH512 (SHA-2, 512 bit) and null. The SHA-2 algorithms are only available on Oracle Database Release 12g and later. A null value evaluates to the most secure algorithm available and is the default.

CHECK_FOR_UPDATES

If set to N, the check for Oracle Application Express and Oracle REST Data Services product updates is disabled for the entire instance, regardless of preferences specified by individual developers. The default is Y.

DELETE_UPLOADED_FILES_AFTER_DAYS

Uploaded files like application export files, websheet export files, spreadsheet data load files are automatically deleted after this number of days. Default is 14.

DISABLE_ADMIN_LOGIN

If set to Y, administration services are disabled. If set to N, the default, they are not disabled.

DISABLE_WORKSPACE_LOGIN

If set to Y, the workspace login is disabled. If set to N, the default, the login is not disabled.

DISABLE_WS_PROV

If set to Y, the workspace creation is disabled for requests sent out by using e-mail notification. If set to N, the default, they are not disabled.

EMAIL_IMAGES_URL

Specifies the full URL to the images directory of Application Express instance, including the trailing slash after the images directory. For example: http://your_server/i/

This setting is used for Oracle Application Express system-generated emails.

EMAIL_INSTANCE_URL

Specifies the URL to Oracle Application Express instance, including the trailing slash after the Database Access Descriptor. For example: http://your_server/pls/apex/

This setting used for Oracle Application Express system-generated emails.

ENABLE_TRANSACTIONAL_SQL

If set to Y, the default, transactional SQL commands are enabled on this instance. If set to N, they are not enabled.

ENCRYPTED_TABLESPACES_ENABLED

If set to Y, the tablespaces provisioned through Oracle Application Express are created as encrypted tablespaces. If set to N, the tablespaces are not encyrpted.

EXPIRE_FIND_USER_ACCOUNTS

If set to Y, expiration of Application Express accounts is enabled. If set to N, they are not enabled.

HTTP_ERROR_STATUS_ON_ERROR_PAGE_ENABLED

Used in conjunction with the APEX_INSTANCE_ADMIN.SET_PARAMETER procedure.

If set to N, the default, Oracle Application Express presents an error page to the end user for all unhanded errors. If set to Y, returns an HTTP 400 status to the end user's client browser when the Application Express engine encounters an unhandled error.

HTTP_RESPONSE_HEADERS

List of http response headers, separated by newline (chr(10)). Application Express writes these headers on each request, before rendering the page. The substitution string #CDN# within the headers is replaced with the content delivery networks that are known to Application Express.

HTTP_STS_MAX_AGE

REQUIRE_HTTPS must be set to A for this parameter to be relevant. Application Express emits a Strict-Transport-Security header, with max-age=<value>, on HTTPS requests if HTTP_STS_MAX_AGE has a value greater than 0. If the request protocol is HTTP, instead of processing the request, Application Express redirects to a HTTPS URL.

INBOUND_PROXIES

Comma-separated list of IP addresses for proxy servers through which requests come in.

LOGIN_THROTTLE_DELAY

The flag which determines the time increase in seconds after failed logins.

LOGIN_THROTTLE_METHODS

The methods to count failed logins. Colon-separated list of USERNAME_IP, USERNAME, IP.

MAX_SESSION_IDLE_SEC

The number of seconds an internal application may be idle.

MAX_SESSION_IDLE_SEC

The number of seconds an internal application may be idle.

MAX_SESSION_LENGTH_SEC

The number of seconds an internal application session may exist.

MAX_SESSION_LENGTH_SEC

The number of seconds an internal application session may exist.

PASSWORD_ALPHA_CHARACTERS

The alphabetic characters used for password complexity rules. Default list of alphabetic characters include the following:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

PASSWORD_HASH_FUNCTION

Defines the algorithm that is used to create one way hashes for workspace user passwords. Valid values are MD5 (deprecated), SH1 (SHA-1), SH256 (SHA-2, 256 bit), SH384 (SHA-2, 384 bit), SH512 (SHA-2, 512 bit) and null. The SHA-2 algorithms are only available on Oracle Database Release 12g and later. A null value evaluates to the most secure algorithm available and is the default.

PASSWORD_HASH_ITERATIONS

Defines the number of iterations for the PASSWORD_HASH_FUNCTION (default 10000).

PASSWORD_HISTORY_DAYS

Defines the maximum number of days a developer or administrator account password may be used before the account expires. The default value is 45 days.

PASSWORD_PUNCTUATION_CHARACTERS

The punctuation characters used for password complexity rules. Default list of punctuation characters include the following: !"#$%&()``*+,-/:;<=>?_

PLSQL_EDITING

If set to Y, the default, the SQL Workshop Object Browser is enabled to allow users to edit and compile PL/SQL. If set to N, users are not allowed.

PRINT_BIB_LICENSED

Specify either standard support or advanced support. Advanced support requires an Oracle BI Publisher license. Valid values include:

  • APEX_LISTENER - Requires Oracle Rest Data Services

  • ADVANCED - Requires Oracle BI Publisher

  • STANDARD

PRINT_SVR_HOST

Specifies the host address of the print server converting engine, for example, localhost. Enter the appropriate host address if the print server is installed at another location.

PRINT_SVR_PORT

Defines the port of the print server engine, for example 8888. Value must be a positive integer.

PRINT_SVR_PROTOCOL

Valid values include:

  • http

  • https

PRINT_SVR_SCRIPT

Defines the script that is the print server engine, for example:

/xmlpserver/convert

QOS_MAX_SESSION_KILL_TIMEOUT

Number of seconds that an active old session can live, when QOS_MAX_SESSION_REQUESTS has been reached. The oldest database session with LAST_CALL_ET greater than QOS_MAX_SESSION_KILL_TIMEOUT is killed.

QOS_MAX_SESSION_REQUESTS

Number of allowed concurrent requests to one session associated with this workspace.

QOS_MAX_WORKSPACE_REQUESTS

Number of allowed concurrent requests to sessions in this workspace.

REQ_NEW_SCHEMA

If set to Y, the option for new schema for new workspace requests is enabled. If set to N, the default, the option is disabled.

REQUIRE_HTTPS

Set to A, to enforce HTTPS for the entire Application Express instance. Set to I, to enforce HTTPS within the Application Express development and administration applications. Set to N, to allow all applications to be used when the protocol is either HTTP or HTTPS. Please note developers can also enforce HTTPS at the application level, by setting the Secure attribute of an application scheme's cookie.

REQUIRE_HTTPS

Set to Y to allow authentication pages within the Application Express development and administration applications to be used only when the protocol is HTTPS. Select N to allow these application pages to be used when the protocol is either HTTP or HTTPS.

REQUIRE_VERIFICATION_CODE

If set to Y, the Verification Code is displayed and is required for someone to request a new workspace. If set to N, the default, the Verification Code is not required.

RESTFUL_SERVICES_ENABLED

If set to Y, the default, RESTful services development is enabled. If set to N, RESTful services are not enabled.

RM_CONSUMER_GROUP

If set, this is the resource manager consumer group to be used for all page events. A more specific group can be configured at workspace level.

SERVICE_REQUEST_FLOW

Determines default provisioning mode. Default is MANUAL.

SERVICE_REQUESTS_ENABLED

If set to Y, the default, workspace service requests for schemas, storage, and termination is enabled. If set to N, these requests are disabled.

SMTP_FROM

Defines the "from" address for administrative tasks that generate email, such as approving a provision request or resetting a password.

Enter a valid email address, for example:

someone@somewhere.com

SMTP_HOST_ADDRESS

Defines the server address of the SMTP server. If you are using another server as an SMTP relay, change this parameter to that server's address.

Default setting:

localhost

SMTP_HOST_PORT

Defines the port the SMTP server listens to for mail requests.

Default setting:

25

SMTP_PASSWORD

Defines the password Application Express takes to authenticate itself against the SMTP server, with the parameter SMTP_USERNAME.

SMTP_TLS_MODE

Defines whether Application Express opens an encrypted connection to the SMTP server. Encryption is only supported on database versions 11.2.0.2 and later. On earlier database versions, the connection is not encrypted.

If set to N, the connection is unencrypted (default).

If set to Y, the connection is encrypted before data is sent.

If STARTTLS, Application Express sends the SMTP commands EHLO <SMTP_HOST_ADDRESS> and STARTTLS before encrypting the connection.

SMTP_USERNAME

Defines the username Application Express takes to authenticate itself against the SMTP server (default is null). Starting with database version 11.2.0.2, Application Express uses UTL_MAIL's AUTH procedure for authentication. This procedure negotiates an authentication mode with the SMTP server. With earlier database versions, the authentication mode is always AUTH LOGIN. If SMTP_USERNAME is null, no authentication is used.

SQL_SCRIPT_MAX_OUTPUT_SIZE

The maximum allowable size for an individual script result. Default is 200000.

SSO_LOGOUT_URL

Defines the URL Application Express redirects to in order to trigger a logout from the Single Sign-On server. Application Express automatically appends "?p_done_url=...login url...".

Example: https://login.mycompany.com/pls/orasso/orasso.wwsso_app_admin.ls_logout

STRONG_SITE_ADMIN_PASSWORD

If set to Y, the default, the apex_admin password must conform to the default set of strong complexity rules. If set to N, the password is not required to follow the strong complexity rules.

SYSTEM_HELP_URL

Location of the help and documentation accessed from the Help link within the development environment. Default is http://apex.oracle.com/doc41.

TRACING_ENABLED

If set to Y (the default), an application with Debug enabled can also generate server side db trace files using &p_trace=YES on the URL.

If set to N, the request to create a trace file is ignored.

USERNAME_VALIDATION

The regular expression used to validate a username if the Builder authentication scheme is not APEX. Default is as follows:

^[[:alnum:]._%-]+@[[:alnum:].-]+\.[[:alpha:]]{2,4}$

WALLET_PATH

The path to the wallet on the file system, for example:

file:/home/<username>/wallets

WALLET_PWD

The password associated with the wallet.

WEBSHEET_SQL_ACCESS

If set to Y, the default, SQL tags and SQL reports are possible in Websheet applications. If set to N, they are not possible.

WORKSPACE_EMAIL_MAXIMUM

Maximum number of emails allowed to be sent by using APEX_MAIL per workspace in a 24 hour period. Default is 1000.

WORKSPACE_MAX_FILE_BYTES

The maximum number of bytes for uploaded files for a workspace. A setting at the workspace-level overrides the instance-level setting.

WORKSPACE_MAX_OUTPUT_SIZE

The maximum space allocated for script results. Default is 2000000.

WORKSPACE_PROVISION_DEMO_OBJECTS

If set to Y, the default, demonstration applications and database objects are created in new workspaces. If set to N, they are not created in the current workspace.

WORKSPACE_WEBSHEET_OBJECTS

If set to Y, the default, Application Express Websheet database objects are created in new workspaces. If set to N, they are not created in the current workspace.


ADD_SCHEMA Procedure

The ADD_SCHEMA procedure adds a schema to a workspace to schema mapping.

Syntax

APEX_INSTANCE_ADMIN.ADD_SCHEMA(
    p_workspace    IN VARCHAR2,
    p_schema       IN VARCHAR2);

Parameters

Table 11-2 describes the parameters available in the ADD_SCHEMA procedure.

Table 11-2 ADD_SCHEMA Parameters

Parameter Description

p_workspace

The name of the workspace to which the schema mapping is added.

p_schema

The schema to add to the schema to workspace mapping.


Example

The following example demonstrates how to use the ADD_SCHEMA procedure to map a schema mapped to a workspace.

BEGIN
    APEX_INSTANCE_ADMIN.ADD_SCHEMA('MY_WORKSPACE','FRANK');
END;

ADD_WORKSPACE Procedure

The ADD_WORKSPACE procedure adds a workspace to an Application Express Instance.

Syntax

APEX_INSTANCE_ADMIN.ADD_WORKSPACE(
    p_workspace_id        IN NUMBER DEFAULT NULL,
    p_workspace           IN VARCHAR2,
    p_source_identifier   IN VARCHAR2 DEFAULT NULL,
    p_primary_schema      IN VARCHAR2,
    p_additional_schemas  IN VARCHAR2,
    p_rm_consumer_group   IN VARCHAR2 DEFAULT NULL );

Parameters

Table 11-3 describes the parameters available in the ADD_WORKSPACE procedure.

Table 11-3 ADD_WORKSPACE Parameters

Parameter Description

p_workspace_id

The ID to uniquely identify the workspace in an Application Express instance. This may be left null and a new unique ID is assigned.

p_workspace

The name of the workspace to be added.

p_source_identifier

A short identifier for the workspace used when synchronizing feedback between different instances.

p_primary_schema

The primary database schema to associate with the new workspace.

p_additional_schemas

A colon delimited list of additional schemas to associate with this workspace.

p_rm_consumer_group

Resource Manager consumer group which is used when executing applications of this workspace.


Example

The following example demonstrates how to use the ADD_WORKSPACE procedure to add a new workspace named MY_WORKSPACE using the primary schema, SCOTT, along with additional schema mappings for HR and OE.

BEGIN
    APEX_INSTANCE_ADMIN.ADD_WORKSPACE (
        p_workspace_id       => 8675309,
        p_workspace          => 'MY_WORKSPACE',
        p_primary_schema     => 'SCOTT',
        p_additional_schemas => 'HR:OE' );
END;

CREATE_SCHEMA_EXCEPTION Procedure

This procedure creates an exception which allows assignment of a restricted schema to a specific workspace.

Syntax

APEX_INSTANCE_ADMIN.CREATE_SCHEMA_EXCEPTION (
    p_schema    in varchar2,
    p_workspace in varchar2 );

Parameter

Table 11-4 describes the parameters available for CREATE_SCHEMA_EXCEPTION procedure.

Table 11-4 CREATE_SCHEMA_EXCPETION Parameters

Parameter Description

p_schema

The schema.

p_workspace

The workspace.


Example

This example allows the assignment of restricted schema HR to workspace HR_WORKSPACE.

begin
    apex_instance_admin.create_schema_exception (
        p_schema    => 'HR',
        p_workspace => 'HR_WORKSPACE' );
    commit;
end;

FREE_WORKSPACE_APP_IDS Procedure

This procedure removes the reservation of application IDs for a given workspace ID. Use this procedure to undo a reservation, when the reservation is not necessary anymore because it happened by mistake or the workspace no longer exists. To reserve application IDs for a given workspace, see "RESERVE_WORKSPACE_APP_IDS Procedure."

Syntax

APEX_INSTANCE_ADMIN.FREE_WORKSPACE_APP_IDS (
    p_workspace_id IN NUMBER );

Parameters

Table 11-5 describes the parameters available in the FREE_WORKSPACE_APP_IDS procedure.

Table 11-5 FREE_WORKSPACE_APP_IDS Parameters

Parameter Description

p_workspace_id

The unique ID of the workspace.


Example

This example illustrates how to undo the reservation of application IDS that belong to a workspace with an ID of 1234567890.

begin
    apex_instance_admin.free_workspace_app_ids(1234567890);
end;

GET_PARAMETER Function

The GET_PARAMETER function retrieves the value of a parameter used in administering a runtime environment.

Syntax

APEX_INSTANCE_ADMIN.GET_PARAMETER(
    p_parameter     IN VARCHAR2)
RETURN VARCHAR2;

Parameters

Table 11-6 describes the parameters available in the GET_PARAMETER function.

Table 11-6 GET_PARAMETER Parameters

Parameter Description

p_parameter

The instance parameter to be retrieved.

See "Available Parameter Values".


Example

The following example demonstrates how to use the GET_PARAMETER function to retrieve the SMTP_HOST_ADDRESS parameter currently defined for an Oracle Application Express instance.

DECLARE
    L_VAL VARCHAR2(4000);
BEGIN
    L_VAL :=APEX_INSTANCE_ADMIN.GET_PARAMETER('SMTP_HOST_ADDRESS');
    DBMS_OUTPUT.PUT_LINE('The SMTP Host Setting Is: '||L_VAL);
END;

GET_SCHEMAS Function

The GET_SCHEMAS function retrieves a comma-delimited list of schemas that are mapped to a given workspace.

Syntax

APEX_INSTANCE_ADMIN.GET_SCHEMAS(
    p_workspace     IN VARCHAR2)
RETURN VARCHAR2;

Parameters

Table 11-7 describes the parameters available in the GET_SCHEMAS function.

Table 11-7 GET_SCHEMAS Parameters

Parameter Description

p_workspace

The name of the workspace from which to retrieve the schema list.


Example

The following example demonstrates how to use the GET_SCHEMA function to retrieve the underlying schemas mapped to a workspace.

DECLARE
    L_VAL VARCHAR2(4000);
BEGIN
    L_VAL :=APEX_INSTANCE_ADMIN.GET_SCHEMAS('MY_WORKSPACE');
    DBMS_OUTPUT.PUT_LINE('The schemas for my workspace: '||L_VAL);
END;

GET_WORKSPACE_PARAMETER

The GET_WORKSPACE_PARAMETER procedure gets the workspace parameter.

Syntax

get_workspace_parameter(
    p_workspace     IN VARCHAR2,
    p_parameter     IN VARCHAR2,

Parameters

Table 11-8 describes the parameters available in GET_WORKSPACE_PARAMETER procedure.

Table 11-8 GET_WORKSPACE_PARAMETER Parameters

Parameter Description

p_workspace

The name of the workspace to which you are getting the workspace parameter.

p_parameter

The parameter name that overrides the instance parameter value of the same name for this workspace. Parameter names include:

  • ALLOW_HOSTNAMES

  • QOS_MAX_WORKSPACE_REQUESTS

  • QOS_MAX_SESSION_REQUESTS

  • QOS_MAX_SESSION_KILL_TIMEOUT

  • RM_CONSUMER_GROUP

  • WORKSPACE_EMAIL_MAXIMUM

  • WORKSPACE_MAX_FILE_BYTES


Example

The following example prints the value of ALLOW_HOSTNAMES for the HR workspace.

BEGIN
    DBMS_OUTPUT.PUT_LINE (
APEX_INSTANCE_ADMIN.GET_WORKSPACE_PARAMETER (
            p_workspace => 'HR',
            p_parameter => 'ALLOW_HOSTNAMES' ));
END;

REMOVE_APPLICATION Procedure

The REMOVE_APPLICATION procedure removes the application specified from the Application Express instance.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_APPLICATION (
    p_application_id IN NUMBER);

Parameters

Table 11-9 describes the REMOVE_APPLICATION procedure parameters.

Table 11-9 REMOVE_APPLICATION Parameters

Parameter Description

p_application_id

The ID of the application to remove.


Example

The following example demonstrates how to use the REMOVE_APPLICATION procedure to remove an application with an ID of 100 from an Application Express instance.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_APPLICATION(100);
END;

REMOVE_SAVED_REPORT Procedure

The REMOVE_SAVED_REPORT procedure removes a specific user's saved interactive report settings for a particular application.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SAVED_REPORT(
    p_application_id     IN NUMBER,
    p_report_id          IN NUMBER);

Parameters

Table 11-10 describes the parameters available in the REMOVE_SAVED_REPORT procedure.

Table 11-10 REMOVE_SAVED_REPORT Parameters

Parameter Description

p_application_id

The ID of the application for which to remove user saved interactive report information.

p_report_id

The ID of the saved user interactive report to be removed.


Example

The following example demonstrates how to use the REMOVE_SAVED_REPORT procedure to remove user saved interactive report with the ID 123 for the application with an ID of 100.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_SAVED_REPORT(100,123);
END;

REMOVE_SAVED_REPORTS Procedure

The REMOVE_SAVED_REPORTS procedure removes all user saved interactive report settings for a particular application or for the entire instance.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SAVED_REPORTS(
    p_application_id     IN NUMBER DEFAULT NULL);

Parameters

Table 11-11 describes the parameters available in the REMOVE_SAVED_REPORTS procedure.

Table 11-11 REMOVE_SAVED_REPORTS Parameters

Parameter Description

p_application_id

The ID of the application for which to remove user saved interactive report information. If this parameter is left null, all user saved interactive reports for the entire instance is removed.


Example

The following example demonstrates how to use the REMOVE_SAVED_REPORTS procedure to remove user saved interactive report information for the application with an ID of 100.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_SAVED_REPORTS(100);
END;

REMOVE_SCHEMA Procedure

This REMOVE_SCHEMA procedure removes a workspace to schema mapping.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SCHEMA(
    p_workspace     IN VARCHAR2,
    p_schema        IN VARCHAR2);

Parameters

Table 11-12 describes the parameters available in the REMOVE_SCHEMA procedure.

Table 11-12 REMOVE_SCHEMA Parameters

Parameter Description

p_workspace

The name of the workspace from which the schema mapping is removed.

p_schema

The schema to remove from the schema to workspace mapping.


Example

The following example demonstrates how to use the REMOVE_SCHEMA procedure to remove the schema named Frank from the MY_WORKSPACE workspace to schema mapping.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_SCHEMA('MY_WORKSPACE','FRANK');
END;

REMOVE_SCHEMA_EXCEPTION Procedure

This procedure removes an exception that allows the assignment of a restricted schema to a given workspace.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SCHEMA_EXCEPTION (
    p_schema    in varchar2,
    p_workspace in varchar2 );

Parameter

Table 11-13 describes the parameters available for REMOVE_SCHEMA_EXCEPTION procedure.

Table 11-13 REMOVE_SCHEMA_EXCEPTION Parameters

Parameter Description

p_schema

The schema.

p_workspace

The workspace.


Example

This example removes the exception that allows the assignment of schema HR to workspace HR_WORKSPACE.

begin
    apex_instance_admin.remove_schema_exception (
        p_schema    => 'HR',
        p_workspace => 'HR_WORKSPACE' );
    commit;
end;

REMOVE_SCHEMA_EXCEPTIONS Procedure

This procedure removes all exceptions that allow the assignment of a given schema to workspaces.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SCHEMA_EXCEPTIONS (
      p_schema in varchar2 );

Parameter

Table 11-14 describes the parameters available for REMOVE_SCHEMA_EXCEPTIONS procedure.

Table 11-14 REMOVE_SCHEMA_EXCEPTIONS Parameter

Parameter Description

p_schema

The schema.


Example

This example removes all exceptions that allow the assignment of the HR schema to workspaces.

begin
    apex_instance_admin.remove_schema_exceptions (
            p_schema => 'HR' );
    commit;
end;

REMOVE_SUBSCRIPTION Procedure

The REMOVE_SUBSCRIPTION procedure removes a specific interactive report subscription.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_SUBSCRIPTION(
    p_subscription_id     IN NUMBER);

Parameters

Table 11-15 describes the parameters available for the REMOVE_SUBSCRIPTION procedure.

Table 11-15 REMOVE_SUBSCRIPTION Procedure Parameters

Parameter Description

p_subscription_id

The ID of the interactive report subscription to be removed.


Example

The following example demonstrates how to use the REMOVE_SUBSCRIPTION procedure to remove interactive report subscription with the ID 12345. Use of APEX_APPLICATION_PAGE_IR_SUB view can help identifying the subscription ID to remove.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_SUBSCRIPTION (
        p_subscription_id => 12345);
END;

REMOVE_WORKSPACE Procedure

The REMOVE_WORKSPACE procedure removes a workspace from an Application Express instance.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_WORKSPACE(
    p_workspace         IN VARCHAR2,
    p_drop_users        IN VARCHAR2 DEFAULT 'N',
    p_drop_tablespaces  IN VARCHAR2 DEFAULT 'N' );

Parameters

Table 11-16 describes the parameters available in the REMOVE_WORKSPACE procedure.

Table 11-16 REMOVE_WORKSPACE Parameters

Parameter Description

p_workspace

The name of the workspace to be removed.

p_drop_users

'Y' to drop the database user associated with the workspace. The default is 'N'.

p_drop_tablespaces

'Y' to drop the tablespace associated with the database user associated with the workspace. The default is 'N'.


Example

The following example demonstrates how to use the REMOVE_WORKSPACE procedure to remove an existing workspace named MY_WORKSPACE, along with the associated database users and tablespace.

BEGIN
    APEX_INSTANCE_ADMIN.REMOVE_WORKSPACE('MY_WORKSPACE','Y','Y');
END;

REMOVE_WORKSPACE_EXCEPTIONS Procedure

This procedure removes all exceptions that allow the assignment of restricted schemas to given workspace.

Syntax

APEX_INSTANCE_ADMIN.REMOVE_WORKSPACE_EXCEPTIONS (      p_workspace in varchar2 );

Parameter

Table 11-14 describes the parameters available for REMOVE_WORKSPACE_EXCEPTIONS procedure.

Table 11-17 REMOVE_WORKSPACE_EXCEPTIONS Parameter

Parameter Description

p_workspace

The workspace.


Example

This example removes all exceptions that allow the assignment of restricted schemas to HR_WORKSPACE.

begin    apex_instance_admin.remove_schema_exceptions (            p_workspace => 'HR_WORKSPACE' );    commit;end;

RESERVE_WORKSPACE_APP_IDS Procedure

This procedure permanently reserves the IDs of websheet and database applications in a given workspace. Even if the workspace and its applications get removed, developers can not create other applications with one of these IDs. To undo a reservation, see "FREE_WORKSPACE_APP_IDS Procedure."

Syntax

APEX_INSTANCE_ADMIN.RESERVE_WORKSPACE_APP_IDS (
    p_workspace_id IN NUMBER );

Parameters

Table 11-18 describes the parameters available in the RESERVE_WORKSPACE_APP_IDS procedure.

Table 11-18 RESERVE_WORKSPACE_APP_IDS Parameters

Parameter Description

p_workspace_id

The unique ID of the workspace.


Example

This example demonstrates setting up two separate Application Express instances where the application IDs are limited to within a specific range. At a later point, a workspace and all of it's applications are moved from instance 1 to instance 2. For the workspace that is moved, the developer reserves all of its application IDs to ensure that no applications with the same IDs are created on instance 1.

  1. After setting up Application Express instance 1, ensure that application IDs are between 100000 and 199999.

    begin
        apex_instance_admin.set_parameter('APPLICATION_ID_MIN', 100000);
        apex_instance_admin.set_parameter('APPLICATION_ID_MAX', 199999);
    end;
    
  2. After setting up Application Express instance 2, ensure that application IDs are between 200000 and 299999.

    begin
        apex_instance_admin.set_parameter('APPLICATION_ID_MIN', 200000);
        apex_instance_admin.set_parameter('APPLICATION_ID_MAX', 299999);
    end;
    
  3. Later, the operations team decides that workspace MY_WORKSPACE with ID 1234567890 should be moved from instance 1 to instance 2. The required steps are:

    1. Export the workspace, applications and data on instance 1 (not shown here).

    2. Ensure that no other application on instance 1 can reuse application IDs of this workspace.

      begin
          apex_instance_admin.reserve_workspace_app_ids(1234567890);
      end;
      
    3. Drop workspace, accompanying data and users on instance 1.

      begin
          apex_instance_admin.remove_workspace('MY_WORKSPACE');
      end;
      
    4. Import the workspace, applications and data on instance 2 (not shown here).

RESTRICT_SCHEMA Procedure

This procedure revokes the privilege to assign a schema to workspaces.

Syntax

APEX_INSTANCE_ADMIN.RESTRICT_SCHEMA (
    p_schema in varchar2 );

Parameter

Table 11-19 describes the parameters available for RESTRICT_SCHEMA procedure.

Table 11-19 RESTRICT_SCHEMA Parameters

Parameter Description

p_schema

The schema.


Example

This example revokes the privilege to assign schema HR to workspaces.

begin
    apex_instance_admin.restrict_schema(p_schema => 'HR');
    commit;
end;

SET_LOG_SWITCH_INTERVAL Procedure

Set the log switch interval for each of the logs maintained by Application Express.

Syntax

APEX_INSTANCE_ADMIN.SET_LOG_SWITCH_INTERVAL(
    p_log_name              IN VARCHAR2,
    p_log_switch_after_days IN NUMBER );

Parameters

Table 11-20 describes the parameters available in the SET_LOG_SWITCH_INTERVAL procedure.

Table 11-20 SET_LOG_SWITCH_INTERVAL Parameters

Parameters Description

p_log_name

Specifies the name of the log. Valid values include ACCESS, ACTIVITY, CLICKTHRU, and DEBUG.

p_log_switch_after_days

This interval must be a positive integer between 1 and 180.


Example

This example sets the log switch interval for the ACTIVITY log to 30 days.

begin
    apex_instance_admin.set_log_switch_interval( p_log_name in 'ACTIVITY', p_log_switch_after_days => 30 );
    commit;
end;

SET_WORKSPACE_PARAMETER

The SET_WORKSPACE_PARAMETER procedure sets the designated workspace parameter.

Syntax

SET_WORKSPACE_PARAMETER(
    p_workspace     IN VARCHAR2,
    p_parameter     IN VARCHAR2,
    p_value         IN VARCHAR2 );

Parameters

Table 11-21 describes the parameters available in SET_WORKSPACE_PARAMETER procedure.

Table 11-21 SET_WORKSPACE_PARAMETER Parameters

Parameter Description

p_workspace

The name of the workspace to which you are setting the workspace parameter.

p_parameter

The parameter name which overrides the instance parameter value of the same for this workspace. Parameter names include:

  • ALLOW_HOSTNAMES

  • QOS_MAX_WORKSPACE_REQUESTS

  • QOS_MAX_SESSION_REQUESTS

  • QOS_MAX_SESSION_KILL_TIMEOUT

  • RM_CONSUMER_GROUP

  • WORKSPACE_EMAIL_MAXIMUM

  • WORKSPACE_MAX_FILE_BYTES

p_value

The parameter value.


Example

The following example demonstrates how to use the set_workspace_parameter procedure to restrict URLs for accessing applications in the HR workspace that have hr.example.com in the hostname or domain name.

BEGIN
apex_instance_admin.set_workspace_parameter (
            p_workspace => 'HR',
            p_parameter => 'ALLOW_HOSTNAMES' ));
            p_value     => 'hr.example.com' );
END;

SET_PARAMETER Procedure

The SET_PARAMETER procedure sets a parameter used in administering a runtime environment. You must issue a commit for the parameter change to take affect.

Syntax

APEX_INSTANCE_ADMIN.SET_PARAMETER(
    p_parameter     IN VARCHAR2,
    p_value         IN VARCHAR2 DEFAULT 'N');

Parameters

Table 11-22 describes the parameters available in the SET_PARAMETER procedure.

Table 11-22 SET_PARAMETER Parameters

Parameter Description

p_parameter

The instance parameter to be set.

p_value

The value of the parameter.

See "Available Parameter Values".


Example

The following example demonstrates how to use the SET_PARAMETER procedure to set the SMTP_HOST_ADDRESS parameter for an Oracle Application Express instance.

BEGIN
    APEX_INSTANCE_ADMIN.SET_PARAMETER('SMTP_HOST_ADDRESS', 'mail.example.com');
    COMMIT;
END;

SET_WORKSPACE_CONSUMER_GROUP Procedure

The SET_WORKSPACE_CONSUMER_GROUP procedure sets a Resource Manager Consumer Group to a workspace.

Syntax

set_workspace_consumer_group( 
    p_workspace in varchar2, 
    p_rm_consumer_group in varchar2 ); 

Parameters

Table 11-23 describes the parameters available for the SET_WORKSPACE_CONSUMER_GROUP procedure.

Table 11-23 SET_WORKSPACE_CONSUMER_GROUP Parameters

Parameters Description

p_workspace

This is the name of the workspace for which the resource consumer group is to be set.

p_rm_consumer_group

The parameter P_RM_CONSUMER_GROUP is the Oracle Database Resource Manager Consumer Group name. The consumer group does not have to exist at the time this procedure is invoked. But if the Resource Manager Consumer Group is set for a workspace and the consumer group does not exist, then an error will be raised when anyone attempts to login to this workspace or execute any application in the workspace.

If the value of P_RM_CONSUMER_GROUP is null, then the Resource Manager consumer group associated with the specified workspace is cleared.


Example

The following example sets the workspace to the Resource Manager consumer group "CUSTOM_GROUP1":

begin
        apex_instance_admin.set_workspace_consumer_group(
        p_workspace => 'MY_WORKSPACE',
        p_rm_consumer_group => 'CUSTOM_GROUP1' );
    commit;
end;
/

TRUNCATE_LOG Procedure

The TRUNCATE_LOG procedure truncates the log entries specified by the input parameter.

Syntax

APEX_INSTANCE_ADMIN.TRUNCATE_LOG(
    p_log     IN VARCHAR2);

Parameters

Table 11-24 describes the parameters available in the TRUNCATE_LOG procedure.

Table 11-24 TRUNCATE_LOG Parameters

Parameter Description

p_log

This parameter can have one of the following values:

ACTIVITY - removes all entries that record page access.

USER_ACCESS - removes all entries that record user login.

MAIL - removes all entries that record mail sent.

CLICKS - removes all entries that record clicks tracked to external sites.

LOCK_INSTALL_SCRIPT - removes all entries that record developer locking of supporting objects script.

LOCK_PAGE - removes all entries that record developer locking of pages.

WORKSPACE_HIST - removes all entries that record daily workspace summary.

PURGE - removes all entries that record automatic workspace purge activity.

FILE - removes all entries that record automatic file purge activity.

SCRIPT - removes all entries that record results of SQL scripts executed in SQL Workshop.

SQL - removes all entries that record the history of commands executed in SQL Workshop SQL Commands


Example

The following example demonstrates how to use the TRUNCATE_LOG procedure to remove all log entries that record access to Application Express application pages.

BEGIN
  APEX_INSTANCE_ADMIN.TRUNCATE_LOG('ACTIVITY');
END;

UNRESTRICT_SCHEMA Procedure

This procedure re-grants the privilege to assign a schema to workspaces, if it has been revoked before.

Syntax

APEX_INSTANCE_ADMIN.UNRESTRICT_SCHEMA (
    p_schema in varchar2 );

Parameter

Table 11-25 describes the parameters available for UNRESTRICT_SCHEMA procedure.

Table 11-25 RESTRICT_SCHEMA Parameters

Parameter Description

p_schema

The schema.


Example

This example re-grants the privilege to assign schema HR to workspaces.

begin
    apex_instance_admin.unrestrict_schema(p_schema => 'HR');
    commit;
end;