SAVE_AUTHS procedure

Saves the authorizations of all relations in the specified schema for later restoration with the RESTORE_AUTHS procedure procedure.

Prototypes

SAVE_AUTHS(ASCHEMA VARCHAR(128))
SAVE_AUTHS()

Description

SAVE_AUTHS is a utility procedure which copies the authorization settings for all tables in the specified schema. If no schema is specified the current schema is used. Essentially this is equivalent to running SAVE_AUTH procedure for every table in a schema.

Parameters

ASCHEMA
The name of the schema containing the tables for which to save authorziation settings. If this parameter is omitted the value of the CURRENT SCHEMA special register will be used instead.

Examples

Save all the authorization information from the tables in the FINANCE_DEV schema, do something arbitrary to the schema and restore the authorizations again:

SET SCHEMA FINANCE_DEV;
CALL SAVE_AUTHS();
-- Do something arbitrary to the schema (e.g. run a script to manipulate its structure)
CALL RESTORE_AUTHS();

Advanced usage: Copy the authorizations from the FINANCE_DEV schema to the FINANCE schema by changing the content of SAVED_AUTH (this is the table in which SAVE_AUTH procedure temporarily stores authorizations; it has exactly the same structure as SYSCAT.TABAUTH):

CALL SAVE_AUTHS('FINANCE_DEV');
UPDATE UTILS.SAVED_AUTH
    SET TABSCHEMA = 'FINANCE'
    WHERE TABSCHEMA = 'FINANCE_DEV';
CALL RESTORE_AUTHS('FINANCE');