Oracle DBMS_RCVCAT
Version 11.2.0.3
 
General Information
Purpose RMAN repository catalog maintenance
Source This package is dynamically created by the RMAN executable by the CREATE CATALOG command
Dependencies
AL DBMS_OUTPUT SCR
ALL_USERS DBMS_RCVMAN SCRL
BCB DBMS_STANDARD SITE_DFATT
BCF DF SITE_TFATT
BCR DUAL TEMPRES
BDF FB TF
BP GRSP TS
BRL NODE TSATT
BS NRSP USER_DB_LINKS
BSF OFFR USER_OBJECTS
CCB ORL USER_ROLE_PRIVS
CCF PLITBLM USER_TAB_COLUMNS
CDF RCVER VPC_DATABASES
CKP RLH VPC_USERS
CONF RMAN_SEQ XAL
DB ROUT XCF
DBINC RSR XDF
DBMS_CATOWNER RT  
Security Model Execute is granted to PUBLIC running with AUTHID CURRENT_USER
 
Source Code
Package Header (formatted and clarified source code) CREATE OR REPLACE PACKAGE dbms_rcvcat AUTHID CURRENT_USER IS

-- public constants
TRUE#  CONSTANT NUMBER := 1;
FALSE# CONSTANT NUMBER := 0;

-- Used to identify if the upgrade of catalog schema was complete
UPGRADE_COMPLETED CONSTANT NUMBER := 1;

-- resync types
RESYNC_FULL            CONSTANT NUMBER := 1;
RESYNC_PARTIAL         CONSTANT NUMBER := 2;
RESYNC_NONE            CONSTANT NUMBER := 3;
CONFIGRESYNC_NO        CONSTANT NUMBER := 0;
CONFIGRESYNC_TORC      CONSTANT NUMBER := 1;
CONFIGRESYNC_TOCF      CONSTANT NUMBER := 2;
CONFIGRESYNC_TORC_TOCF CONSTANT NUMBER := 3;

-- These constants must match the krmkct definition.

-- controlfile types

CF_CURRENT CONSTANT NUMBER := 1;
CF_BACKUP  CONSTANT NUMBER := 2;
CF_CREATED CONSTANT NUMBER := 3;
CF_STANDBY CONSTANT NUMBER := 4;
CF_CLONE   CONSTANT NUMBER := 5;
CF_NOMOUNT CONSTANT NUMBER := 6;

this_db_key    NUMBER := NULL;
this_dbinc_key NUMBER := NULL;

RESYNC_REASON_NOACTION CONSTANT NUMBER := 1; -- do not display reasons
RESYNC_REASON_NONE     CONSTANT NUMBER := 2; -- no reason is yet set
RESYNC_REASON_DF       CONSTANT NUMBER := 3;
RESYNC_REASON_TF       CONSTANT NUMBER := 4;
RESYNC_REASON_TS       CONSTANT NUMBER := 5;
RESYNC_REASON_THR      CONSTANT NUMBER := 6;
RESYNC_REASON_ORL      CONSTANT NUMBER := 7;
RESYNC_REASON_CONF     CONSTANT NUMBER := 8;
RESYNC_REASON_CF       CONSTANT NUMBER := 9;
RESYNC_REASON_RSL      CONSTANT NUMBER := 10;
RESYNC_REASON_INC      CONSTANT NUMBER := 11;
RESYNC_REASON_RESET    CONSTANT NUMBER := 12;

resync_reason   NUMBER  := RESYNC_REASON_NONE;
doResyncReasons BOOLEAN := FALSE;

RESYNC_ACTION_ADD      CONSTANT NUMBER := 1;
RESYNC_ACTION_DROP     CONSTANT NUMBER := 2;
RESYNC_ACTION_CHANGE   CONSTANT NUMBER := 3;
RESYNC_ACTION_RECREATE CONSTANT NUMBER := 4;
RESYNC_ACTION_RENAME   CONSTANT NUMBER := 5;
RESYNC_ACTION_RESIZE   CONSTANT NUMBER := 6;

TYPE resyncActionNames_t IS VARRAY(6) OF VARCHAR2(12);

-- Keep in sync with RESYNC_ACTION_XXXXX above
RESYNC_ACTION_NAMES CONSTANT resyncActionNames_t := resyncActionNames_t(
'added', 'dropped', 'changed', 'recreated', 'renamed', 'resized');

TYPE resyncActionTaken_t  IS VARRAY(6) OF BOOLEAN;
TYPE resyncActionCounts_t IS VARRAY(6) OF NUMBER;

RESYNC_OBJECT_TABLESPACE CONSTANT NUMBER := 1;
RESYNC_OBJECT_DATAFILE   CONSTANT NUMBER := 2;
RESYNC_OBJECT_TEMPFILE   CONSTANT NUMBER := 3;
RESYNC_OBJECT_REDOTHREAD CONSTANT NUMBER := 4;
RESYNC_OBJECT_ONLINELOG  CONSTANT NUMBER := 5;

TYPE resyncActionObjects_t IS VARRAY(5) OF VARCHAR2(16);

-- Keep in sync with RESYNC_OBJECT_XXXXX above
RESYNC_ACTION_OBJECTS CONSTANT resyncActionObjects_t :=
resyncActionObjects_t('Tablespace', 'Datafile', 'Tempfile', 'Redo thread', 'Online redo log');

-- Debug levels constants
RCVCAT_LEVEL_ZERO CONSTANT NUMBER := 0;
RCVCAT_LEVEL_MIN  CONSTANT NUMBER := 1;
RCVCAT_LEVEL_LOW  CONSTANT NUMBER := 5;
RCVCAT_LEVEL_MID  CONSTANT NUMBER := 9;
RCVCAT_LEVEL_HI   CONSTANT NUMBER := 12;
RCVCAT_LEVEL_MAX  CONSTANT NUMBER := 15;

RCVCAT_LEVEL_DEFAULT CONSTANT NUMBER := RCVCAT_LEVEL_MID;

TYPE fullResyncActions_t IS RECORD (
active    BOOLEAN,
valid     BOOLEAN,
lastobjno NUMBER,
objtype   NUMBER,
actTaken  resyncActionTaken_t,
actCount  resyncActionCounts_t);

fullResyncAction fullResyncActions_t;
-- :=
-- fullResyncActions_t(FALSE, FALSE, -1, NULL,
-- RESYNC_ACTION_TAKEN_NONE,
-- RESYNC_ACTION_COUNTS_ZERO);

/*-----------------------*
* Debugging functions    *
*------------------------*/

PROCEDURE setDebugOn(dbglevel IN NUMBER DEFAULT RCVCAT_LEVEL_DEFAULT);
PROCEDURE setDebugOff;

/*-----------------------*
* Database Registration  *
*------------------------*/
PROCEDURE registerDatabase(
db_id      IN NUMBER,
db_name    IN VARCHAR2,
reset_scn  IN NUMBER,
reset_time IN DATE);

-- registerDatabase registers a new target database in the recovery catalog.
-- All target databases must be registered exactly once. The database
-- is inserted into the db table, and also one row is inserted into the dbinc
-- table as the root and the current incarnation of this database.
-- Note that it is legal to register a database that has undergone a previous
-- resetlogs, but recovery to a time prior to the resetlogs is not supported.
-- registerDatabase is atomic; all changes to recovery catalog are committed
-- or rolled back if an exception is signalled
-- Input parameters:
-- db_id: the value of kccfhdbi from the controlfile of the target database
-- db_name: the name of the database
-- reset_scn: the resetlogs SCN of this database
-- reset_time: the resetlogs time

-- Exceptions:
-- DUPLICATE_DATABASE
-- a database with the same db_id has already been registered. This may
-- happen if the database was created by copying datafiles from an
-- existing datafile
-- CHECKPOINT_IN_PROGRESS (internal)
-- a recovery catalog checkpoint is in progress. The current checkpoint
-- must be ended or canceled before calling registerDatabase
-- BACKUP_IN_PROGRESS (internal)
-- a backup conversation is in progress. The current backup conversation
-- must be ended or canceled before calling registerDatabase

PROCEDURE resetDatabase(
db_id             IN NUMBER,
db_name           IN VARCHAR2,
reset_scn         IN NUMBER,
reset_time        IN DATE,
parent_reset_scn  IN NUMBER,
parent_reset_time IN DATE);

FUNCTION resetDatabase(
db_id             IN NUMBER,
db_name           IN VARCHAR2,
reset_scn         IN NUMBER,
reset_time        IN DATE,
parent_reset_scn  IN NUMBER,
parent_reset_time IN DATE)
RETURN NUMBER;

PROCEDURE resetDatabase(
dbinc_key IN NUMBER,
db_name   IN VARCHAR2);

PROCEDURE resetDatabase(
dbinc_key  IN  NUMBER,
db_name    IN  VARCHAR2,
reset_scn  OUT NUMBER,
reset_time OUT DATE,
db_id      IN  NUMBER DEFAULT NULL);

-- There are four forms of the resetDatabase procedure.
-- The first form registers a new incarnation of an registered database
-- and makes it the current incarnation. It must always be called after
-- the target database is opened with resetlogs option.
-- The second form changes the current incarnation of a registered database.
-- It must be called after the target database is implicitly changes
-- the incarnation during flashback database.
-- The thrid form makes an old incarnation the current incarnation.
-- registerDatabase is atomic; all changes to recovery catalog are committed
-- or rolled back if an exception is signalled
-- The fourth one is called by RMAN versions greater than 10i, to get resetlogs
-- SCN of the incarnation reset by user. This reset_scn is used to change
-- current incarnation pointer in mounted controlfile if the incarnation is
-- already known to controlfile. If incarnation is not known to mounted
-- control file, user must restore a file that belongs to new incarnation.
-- Input parameters:
-- dbinc_key
-- the primary key of an existing database incarnation in the recovery
-- catalog. Only used by the second form.
-- db_id
-- the value of kccfhdbi from the controlfile of the target database
-- db_name
-- the name of the database
-- reset_scn
-- the resetlogs SCN of this database
-- reset_time
-- the resetlogs time
-- Exceptions:
-- DB_ID_IS_NULL (internal)
-- a null db_id was given
-- DATABASE_NOT_FOUND
-- No database with the given db_id was found in the recovery catalog
-- Use registerDatabase procedure instead
-- RESET_SCN_TOO_LOW
-- RESET_TIME_TOO_LOW
-- CHECKPOINT_IN_PROGRESS (internal)
-- a recovery catalog checkpoint is in progress. The current checkpoint
-- must be ended or canceled before calling resetDatabase
-- BACKUP_IN_PROGRESS (internal)
-- a backup conversation is in progress. The current backup conversation
-- must be ended or canceled before calling resetDatabase

PROCEDURE unregisterDatabase(db_key IN NUMBER DEFAULT NULL,db_id IN NUMBER);

-- unRegisterDatabase removes a registered database from the recovery catalog
--
-- Input parameters:
-- db_key
-- The primary key of an existing database in the recovery catalog. This
-- parameter is optional and not required because db_id uniquely
-- identifies the database. Furthermore, the client (that is RMAN) does not
-- know what is db_key. The parameter is here only because of
-- compatibility reasons.
-- db_id
-- The value of kccfhdbi from the control file of the target database.
--
-- Exceptions:
-- CHECKPOINT_IN_PROGRESS (internal)
-- Recovery catalog resync is in progress. The current resync must be
-- ended or canceled before calling unregisterDatabase.
-- NO_DATA_FOUND
-- Database not fund in the catalog.

/*--------------------------*
* Set Database Incarnation *
*--------------------------*/

PROCEDURE setDatabase(
db_name        IN VARCHAR2,
reset_scn      IN NUMBER,
reset_time     IN DATE,
db_id          IN NUMBER,
db_unique_name IN VARCHAR2,
dummy_instance IN BOOLEAN,
cf_type        IN NUMBER,
site_aware     IN BOOLEAN DEFAULT FALSE);

PROCEDURE setDatabase(
db_name        IN VARCHAR2,
reset_scn      IN NUMBER,
reset_time     IN DATE,
db_id          IN NUMBER,
db_unique_name IN VARCHAR2 DEFAULT NULL);

PROCEDURE setDatabase(dbinc_key IN NUMBER);

PROCEDURE setDatabase;

-- setDatabase selects which target database subsequent dbms_rcvcat
-- procedures operate on. Note that only the current incarnation can be
-- selected. If the target database or its current incarnation is not
-- registered then setDatabase will fail.
-- setDatabase sets the package state variables to point to the selected
-- database and its current incarnation.
-- The settings will be valid until the end of the session unless setDatabase
-- is called again
-- Input parameters:
-- db_id
-- the value of kccfhdbi from the controlfile of the target database
-- if not set and succesfully connected to database it will set to
-- current dbid of target database
-- db_name
-- the name of the database
-- reset_scn
-- the resetlogs SCN of this database
-- reset_time
-- the resetlogs time
-- dummy_instance
-- TRUE if the instance is a dummy that is started by RMAN
-- cf_type
-- type of controlfile used by instance
-- Exceptions:
-- DATABASE_NOT_FOUND
-- No database with the given db_id was found in the recovery catalog
-- The database must be registered using registerDatabase first
-- DATABASE_INCARNATION_NOT_FOUND
-- No database incarnation matches the given arguments
-- The database incarnation must be registered using resetDatabase first
-- CHECKPOINT_IN_PROGRESS (internal)
-- a recovery catalog checkpoint is in progress. The current checkpoint
-- must be ended or canceled before calling setDatabase

/*-----------------------------*
* Recovery Catalog Checkpoint *
*-----------------------------*/

FUNCTION ckptNeeded(
ckp_scn          IN NUMBER,
ckp_cf_seq       IN NUMBER,
cf_version       IN DATE,
cf_type          IN NUMBER,
high_df_recid    IN NUMBER,
high_orl_recid   IN NUMBER,
high_cdf_recid   IN NUMBER,
high_al_recid    IN NUMBER,
high_bp_recid    IN NUMBER,
high_do_recid    IN NUMBER,
high_offr_recid  IN NUMBER,
high_pc_recid    IN NUMBER DEFAULT NULL, -- for compatibility
high_conf_recid  IN NUMBER DEFAULT NULL, -- for compatibility
rltime           IN DATE   DEFAULT NULL, -- for compatibility
high_ts_recid    IN NUMBER DEFAULT NULL, -- for compatibility
high_bs_recid    IN NUMBER DEFAULT NULL, -- for compatibility
lopen_reset_scn  IN NUMBER DEFAULT NULL, -- for compatibility
lopen_reset_time IN DATE   DEFAULT NULL, -- for compatibility
high_ic_recid    IN NUMBER DEFAULT NULL, -- for compatibility
high_tf_recid    IN NUMBER DEFAULT NULL, -- for compatibility
high_rt_recid    IN NUMBER DEFAULT NULL, -- for compatibility
high_grsp_recid  IN NUMBER DEFAULT NULL, -- for compatibility
high_nrsp_recid  IN NUMBER DEFAULT NULL, -- for compatibility
high_bcr_recid   IN NUMBER DEFAULT NULL)
RETURN NUMBER; -- for compatibility

PROCEDURE lockForCkpt;

PROCEDURE beginCkpt(
ckp_scn       IN NUMBER,
ckp_cf_seq    IN NUMBER,
cf_version    IN DATE,
ckp_time      IN DATE,
ckp_type      IN VARCHAR2,
ckp_db_status IN VARCHAR2,
high_df_recid IN NUMBER,
cf_type       IN VARCHAR2 DEFAULT 'CURRENT'); -- for compatibility reasons

-- ckptNeeded determines whether recovery catalog is current enough
-- for name translation. It is used by RMAN to check whether an implicit
-- resync is needed before compiling a new backup, copy, restore or recover
-- command.
-- beginCkpt begins a new recovery catalog checkpoint. It records the
-- checkpoint scn and controlfile sequence number of the backup control file
-- used for the checkpoint. The ckp_scn must greater than ckp_scn of the
-- previous checkpoint or if the ckp_scns are equal then the ckp_cf_seq
-- must be greater ckp_cf_seq of the previous checkpoint. If also the
-- ckp_sf_seqs are equal, then the recovery catalog has already been resynced
-- with this backup controlfile. Otherwise the backup controlfile is too old.
--
-- Since the current control file doesn't have ckp_scn partial resyncs
-- check only that ckp_cf_seq advances.
--
-- if the cf_create_time has not changed since the previous checkpoint,
-- we assume that the controlfile has not been recreated. If it has changed
-- the controlfile must have been recreated and all recids in the controlfiles
-- have effectively been reset. Therefore beginCkpt resets the highwater marks
-- for all recids to 0 to force this resync will read all entries from
-- the newly create controlfile.
--
-- It locks the database incarnation row in the dbinc table to prevent
-- multiple simultaneous checkpoint from happening. The endCkpt procedure must
-- be called in the end to commit the recovery catalog checkpoint transaction.
-- Alternatively cancelCkpt can be called to rollback the transaction if
-- something goes wrong.
--
-- Input Parameters:
-- ckp_scn
-- controlfile checkpoint scn
-- ckp_cf_seq
-- controlfile sequence number
-- cf_create_time
-- control file creation timestamp
-- ckp_time
-- controlfile checkpoint timestamp
-- ckp_type
-- 'FULL' full resync from a snapshot control file
-- 'JOB' partial resync from current control file
-- high_*_recid
-- High recid of coresponding controlfile records
-- cf_type
-- controlfile type CURRENT, STANDBY, BACKUP, CLONE etc
-- Exceptions:
-- CHECKPOINT_IN_PROGRESS (internal)
-- a recovery catalog checkpoint is in progress. The current checkpoint
-- must be ended or canceled before beginning a new one
-- DATABASE_INCARNATION_NOT_SET
-- the database incarnation is not set. It must be set by calling
-- setDatabase before calling beginCkpt
-- INVALID_CKP_SCN
-- the backup controlfile ckp_scn is less than ckp_scn of the previous
-- checkpoint. This should not happen. However, it is conceivable that this
-- could happen if the user restores the database from an offline backup
-- and doesn't open the database with resetlogs.
-- INVALID_CKP_CF_SEQ
-- the backup controlfile ckp_cf_seq is less than ckp_cf_seq of the
-- previous checkpoint. This should not happen. See the explanation of the
-- the previous exception.
-- CKP_ALREADY_RECORDED
-- the backup control file ckp_scn and ckp_cf_seq are equal to the previous
-- checkpoint. Nothing was changed in the control file between this
-- this checkpoint and the previous one, so the there is no reason to
-- resync
-- CHECKPOINT_TYPE_INVALID
-- the ckp_type is not valid ('ONLINE' or 'OFFLINE')

PROCEDURE endCkpt;

-- endCkpt must be called after all information is successfully resynced.
-- Note that endCkpt cannot verify that everything was successfully resynced,
-- the client must not call endCkpt if it encountered unrecoverable errors
-- during the checkpoint.
-- It will commit the checkpoint transaction and clear the package state
-- variables to indicate that no checkpoint is in progress
-- Exceptions:
-- CHECKPOINT_NOT_IN_PROGRESS (internal)
-- there is no checkpoint in progress to be ended. Maybe cancelCkpt was
-- called before this.


PROCEDURE cancelCkpt;

/* cancelCkpt must be called if unrecoverable error is encountered during the checkpoint. It will rollback the checkpoint transaction and clear the package state variables to indicate that no checkpoint is in progress */

/*-------------------*
 * Resync            *
 *-------------------*/
-- Resyncing all non-circular-reuse type records (tablespace, datafile and
-- redo thread) from the controlfile use the following protocol. The
-- controlfile maintains a high_recid for each record type. The high_recid
-- is incremented every time a record of that type is created, updated or
-- deleted. The client gets the high_recid for the record type
-- from the controlfile and passes it to beginResync. The beginResync
-- compares the given high_recid with the high_recid stored in the recovery
-- catalog. If the high_recids are equal then nothing has changed in the
-- controlfile since the previous resync and beginResync returns false.
-- If the given high_recid is greater than the one stored in the recovery
-- catalog then beginResync will return true and the client will query
-- all records from the controlfile and call Check procedure for each
-- record.
-- Resyncing all circular-reuse type records from the controlfile use another
-- protocol. Since the circular-reuse type records are never updated
-- (significantly) after they have been created, only records created after
-- the previous resync need to be resynced. The client calls the beginResync
-- procedure which returns the high_recid stored in the recovery catalog.
-- The client compared the returned high_recid with the high_recid in the
-- controlfile. If the high_recids are equal then no new record have created
-- since the previous resync. If the high_recid in controlfile is greater
-- than the one returned by beginResync, then the client will query all
-- records with recid greater than the returned high_recid from the controlfile
-- and call Check procedure for each record.
-- The parameters for all Check procedures match the columns in the
-- corresponding V$ views on the controlfile fixed tables.

/*-------------------*
 * Tablespace Resync *
 *-------------------*/
FUNCTION beginTableSpaceResync(
high_ts_recid IN NUMBER,
force         IN BOOLEAN DEFAULT FALSE)
RETURN BOOLEAN;

-- beginTableSpaceResync should be called to start the process of resyncing
-- information about tablespaces.
-- Returns:
-- TRUE --> tablespace resync started
-- FALSE --> tablespace resync not started (since there is nothing to resync)
-- Exceptions:
-- CHECKPOINT_NOT_IN_PROGRESS


PROCEDURE checkTableSpace(
ts_name                     IN VARCHAR2,
ts#                         IN NUMBER,
create_scn                  IN NUMBER,
create_time                 IN DATE,
rbs_count                   IN NUMBER DEFAULT NULL,
included_in_database_backup IN VARCHAR2 DEFAULT NULL,
bigfile                     IN VARCHAR2 DEFAULT NULL,
temporary                   IN VARCHAR2 DEFAULT NULL,
encrypt_in_backup           IN VARCHAR2 DEFAULT NULL);

-- checkTableSpace inserts or updates information about the given tablespace.
-- It must be called once for each tablespace currently listed in
-- the controlfile in ascending ts# order. If checkTableSpace notices that a
-- tablespace is dropped, either because its ts# is not passed to it or
-- because a new tablespace with same ts# but higher create_scn is passed,
-- it marks the tablespace dropped in the recovery catalog.
--
-- Input Parameters:
-- ts_name
-- The name of the tablespace
-- ts#
-- The ktsn number of the tablespace
-- create_scn
-- The lowest cretion SCN among all datafiles in the tablespace
-- create_time
-- Timestamp for create_scn
-- rbs_count
-- included_in_database_backup
-- Flag telling if the tablespace is included in full backups.
-- 'YES'or NULL - included in whole database backup
-- 'NO' - not included in whole database backup
-- bigfile
-- Flag telling if the tablespace is bigfile or smallfile
-- 'NO' or NULL - smallfile
-- 'YES' - bigfile
-- tempts
-- Flag telling if the tablespace is temporary or not
-- 'NO' or NULL - not a temporary tablespace
-- 'YES' - temporary tablespace
-- Exceptions:
-- TS_RESYNC_NOT_STARTED
-- BAD_TS_ORDER
-- tablespaces were passed in wrong order
-- INVALID_CREATE_SCN
-- create_scn is higher than ckp_scn or create scn is lower than the
-- create scn of the previous incarnation
-- INVALID_CREATE_TIME
-- INVALID_TS_NAME

PROCEDURE endTableSpaceResync;

-- endTableSpaceResync must be called after the last call to checkTablespace.
-- Exceptions:
-- TS_RESYNC_NOT_STARTED

/*-----------------*
 * Datafile Resync *
 *-----------------*/

FUNCTION beginDataFileResync(high_df_recid IN NUMBER) RETURN BOOLEAN;

/* beginDataFileResync must be called to start the process of resyncing information about datafiles. The tablespace information must be resync'd before doing a datafile resync.
Exceptions: TS_RESYNC_NOT_COMPLETE */


PROCEDURE checkDataFile(
file#               IN NUMBER,
fname               IN VARCHAR2,
create_scn          IN NUMBER,
create_time         IN DATE,
blocks              IN NUMBER,
block_size          IN NUMBER,
ts#                 IN NUMBER,
stop_scn            IN NUMBER,
read_only           IN NUMBER,
stop_time           IN DATE     DEFAULT NULL,
rfile#              IN NUMBER   DEFAULT NULL,
aux_fname           IN VARCHAR2 DEFAULT NULL,
foreign_dbid        IN NUMBER   DEFAULT 0,
foreign_create_scn  IN NUMBER   DEFAULT 0,
foreign_create_time IN DATE     DEFAULT NULL,
plugged_readonly    IN VARCHAR2 DEFAULT 'NO',
plugin_scn          IN NUMBER   DEFAULT 0,
plugin_reset_scn    IN NUMBER   DEFAULT 0,
plugin_reset_time   IN DATE     DEFAULT NULL,
create_thread       IN NUMBER   DEFAULT NULL,
create_size         IN NUMBER   DEFAULT NULL);

/* checkDataFile inserts or updates information about the given datafile. It must be called once for each datafile currently listed in the controlfile in ascending file# order. checkDataFile will also mark datafiles which are not listed in the controlfile anymore as dropped in rcvcat. Note that datafiles may disappear from controlfile if it is recreated. */
-- Input Parameters:
-- file#
-- datafile number
-- fname
-- the current name of the datafile
-- create_scn
-- the creation SCN
-- create_time
-- the creation timestamp
-- fsize
-- the current size of the datafile in blocks
-- ts#
-- the ktsn of the tablespace to which this datafile belongs
-- aux_name
-- file name of auxname
-- 'NONE' - auxname is not configured
-- NULL - auxname is unknown
Exceptions: DF_RESYNC_NOT_STARTED */

PROCEDURE endDataFileResync;

/* endDataFileResync must be called after all datafiles have been passed in.
Exceptions: DF_RESYNC_NOT_STARTED */

/* Following procedures are used to resync file names from controlfile to recovery catalog. These names will be used during restores. */


FUNCTION beginDataFileResyncForStandby(high_df_recid IN NUMBER) return BOOLEAN;

PROCEDURE checkDataFileForStandby(
file#        IN NUMBER,
fname        IN VARCHAR2,
create_scn   IN NUMBER,
create_time  IN DATE,
blocks       IN NUMBER,
block_size   IN NUMBER,
ts#          IN NUMBER,
rfile#       IN NUMBER,
stop_scn     IN NUMBER,
read_only    IN NUMBER,
foreign_dbid IN NUMBER,
plugin_scn   IN NUMBER);

/* checkDataFileForStandby inserts or updates information about the given datafile. It must be called once for each datafile currently listed in the controlfile in ascending file# order. checkDataFile will also mark datafiles which are not listed in the controlfile anymore as dropped in rcvcat. Note that datafiles may disappear from controlfile if it is
recreated. */


PROCEDURE endDataFileResyncForStandby;

FUNCTION beginTempFileResyncForStandby(high_tf_recid IN NUMBER) RETURN BOOLEAN;

PROCEDURE checkTempFileForStandby (
file#       IN NUMBER,
fname       IN VARCHAR2,
create_scn  IN NUMBER,
create_time IN DATE,
blocks      IN NUMBER,
block_size  IN NUMBER,
ts#         IN NUMBER,
rfile#      IN NUMBER,
autoextend  IN VARCHAR2,
max_size    IN NUMBER,
next_size   IN NUMBER);

PROCEDURE endTempFileResyncForStandby;

PROCEDURE setDatafileSize(
file#      IN NUMBER,
create_scn IN NUMBER,
blocks     IN NUMBER,
plugin_scn IN NUMBER DEFAULT 0);

/*-----------------*
 * TempFile Resync *
 *-----------------*/
FUNCTION tempFileToResync(high_tf_recid IN NUMBER) return BOOLEAN;

/* tempFileToResync is called to start the process of resyncing tempfile tablespace before resyncing tempfiles. As the same high_ts_recid is used to track permanent tablespace and temp tablespace, we use this function to trigger a tablespace resync whenever there is a new tempfile is added. */

FUNCTION beginTempFileResync(high_tf_recid IN NUMBER) return BOOLEAN;

/* beginTempFileResync must be called to start the process of resyncing information about tempfiles. The tablespace information must be resync'd before doing a tempfile resync.
Exceptions: TS_RESYNC_NOT_COMPLETE */


PROCEDURE checkTempFile(
file#       IN NUMBER,
fname       IN VARCHAR2,
create_scn  IN NUMBER,
create_time IN DATE,
blocks      IN NUMBER,
block_size  IN NUMBER,
ts#         IN NUMBER,
rfile#      IN NUMBER,
autoextend  IN VARCHAR2,
max_size    IN NUMBER,
next_size   IN NUMBER);

-- checkTempFile inserts or updates information about the given tempfile.
-- It must be called once for each tempfile currently listed in
-- the controlfile in ascending file# order. checkTempFile will also mark
-- tempfiles which are not listed in the controlfile anymore as dropped
-- in rcvcat. Note that tempfiles may disappear from controlfile if it is
-- recreated.
--
-- Input Parameters:
-- file#
-- tempfile number
-- fname
-- the current name of the tempfile
-- create_scn
-- the creation SCN
-- create_time
-- the creation timestamp
-- blocks
-- the current size of the tempfile in blocks
-- block_size
-- the current blocksize of the tempfile
-- ts#
-- the ktsn of the tablespace to which this tempfile belongs
-- rfile#
-- tablespace relative file#
-- autoextend
-- ON to indicate the tempfile is auto extensible. Otherwise, OFF.
-- max_size
-- maximum size to which file can extend.
-- next_size
-- amount of increment which file extends to maximum size.
-- Exceptions:
-- TF_RESYNC_NOT_STARTED

PROCEDURE endTempFileResync;

-- endTempFileResync must be called after all tempfiles have been passed in.
-- Exceptions:
-- TF_RESYNC_NOT_STARTED

/*---------------------*
 * Redo Thread resync  *
 *---------------------*/

FUNCTION beginThreadResync(high_rt_recid IN NUMBER) RETURN BOOLEAN;

-- beginThreadResync begins the redo thread resync

PROCEDURE checkThread(
thread#        IN NUMBER,
last_sequence# IN NUMBER,
enable_scn     IN NUMBER,
enable_time    IN DATE,
disable_scn    IN NUMBER,
disable_time   IN DATE,
status         IN VARCHAR2);

-- checkThread inserts or updates information about the given redo thread.
-- It must called once for each redo thread currently listed in the
-- control file in ascending thread# order.
-- Input Parameters:
-- thread#
-- thread number
-- last_sequence#
-- last log sequence number allocated for this thread
-- enable_scn
-- SCN of the last thread enable or disable
-- create_time
-- timestamp of the last thread enable or disable
-- status
-- 'E' -> enabled, 'D' -> disabled
-- Exceptions:
-- RT_RESYNC_NOT_STARTED
-- BAD_RT_ORDER

PROCEDURE endThreadResync;

-- endThreadResync must be called after all redo threads have been checked

/*------------------------*
 * Online Redo Log resync *
 *------------------------*/

FUNCTION beginOnlineRedoLogResync(high_orl_recid IN NUMBER) RETURN BOOLEAN;

-- beginOnlineRedoLogResync begins the redo log resync.

procedure checkOnlineRedoLog(
thread# IN NUMBER,
group#  IN NUMBER,
fname   IN VARCHAR2,
bytes   IN NUMBER   DEFAULT NULL,
type    IN VARCHAR2 DEFAULT 'ONLINE');

-- checkOnlineRedoLog inserts or updates information about the given redo log
-- It must called once for each redo log currently listed in the
-- control file in ascending fname order.

PROCEDURE endOnlineRedoLogResync;

-- endOnlineRedoLogResync must be called after all logs have been checked

/*---------------------------------*
* Guaranteed Restore Point Resync *
*---------------------------------*/


FUNCTION beginGuaranteedRPResync(high_grsp_recid IN NUMBER) RETURN BOOLEAN;

-- beginGuaranteedRPResync begins the restore point resync

PROCEDURE checkGuaranteedRP(
rspname           IN VARCHAR2,
from_scn          IN NUMBER,
to_scn            IN NUMBER,
resetlogs_change# IN NUMBER,
resetlogs_time    IN DATE,
create_time       IN DATE DEFAULT NULL,
rsp_time          IN DATE DEFAULT NULL,
guaranteed        IN VARCHAR2 DEFAULT 'YES');

-- checkGuaranteedRP inserts or updates information about the
-- given restore point. It must called once for each restore point currently
-- listed in the control file in ascending fname order.

PROCEDURE endGuaranteedRPResync;

-- endGuaranteedRPResync must be called after all restore point
-- have been checked

/*----------------------------------*
 * RMAN Configration records resync *
 *----------------------------------*/

FUNCTION beginConfigResync(high_conf_recid IN NUMBER) RETURN NUMBER;

FUNCTION beginConfigResync2(high_conf_recid IN NUMBER) RETURN NUMBER;

-- begiConfigResync2 begins resync of RMAN Configration records.
-- beginConfigResync is used only by 9i client.


PROCEDURE endConfigResync;

PROCEDURE endConfigResync2(sync_to_cf_pending IN BOOLEAN DEFAULT FALSE);

/* endConfigResync2 must be called after all RMAN Configurations records have been checked. endConfigResync is used only by 9i client. */

PROCEDURE getConfig(
conf#    OUT NUMBER,
name  IN OUT VARCHAR2,
value IN OUT VARCHAR2,
first IN     BOOLEAN);

/* this getConfig is called during resync from RC to CF. This is duplicate of function from dbms_rcvman PL/SQL package */

/*-----------------------------*
 * Redo Log History resync     *
 *-----------------------------*/

FUNCTION beginLogHistoryResync RETURN NUMBER;

/* beginLogHistoryResync begins the log history resync. It returns the highest recid of the log history entries recorded in the recovery catalog. The purpose of the returned recid is to avoid processing log history entries that are already in rcvcat. */

FUNCTION getLogHistoryLowSCN RETURN NUMBER;

/* getLogHistoryLowSCN returns the highest low_scn that is known to recovery catalog for current incarnation. Using this, we skip resyncing log history records that are less than low_scn when the controlfile is not current. */

PROCEDURE checkLogHistory(
rlh_recid  IN NUMBER,
rlh_stamp  IN NUMBER,
thread#    IN NUMBER,
sequence#  IN NUMBER,
low_scn    IN NUMBER,
low_time   IN DATE,
next_scn   IN NUMBER,
reset_scn  IN NUMBER DEFAULT NULL,
reset_time IN DATE   DEFAULT NULL);

-- checkLogHistory inserts or checks the information about given log history
-- entry. If entry doesn't exist in rcvcat then it is inserted. If the entry
-- already exists then it is compared with the given entry. If there
-- is a mismatch an internal error is signalled (the entries shouldn't change)
-- checkLogHistory is called once for every redo log history entry in the
-- controlfile with a recid greater than or equal to the one returned by
-- beginLogHistoryResync. The idea is to check the last entry insert during the
-- previous checkpoint.
-- Input Parameters:
-- rlh_recid
-- The controlfile recid of the redo log history entry
-- rlh_stamp
-- The controlfile stamp of the redo log history entry
-- thread#
-- Thread number.
-- sequence#
-- Log sequence number
-- low_scn
-- The low SCN of this log.
-- low_time
-- Timestamp associated with lowScn.
-- next_scn
-- The last SCN of this log. All redo at this SCN or higher
-- is in a subsequent log sequence number.

PROCEDURE endLogHistoryResync;

/* endLogHistoryResync will complete redo log history resync and update the high_rlh_recid column in dbinc table. */

/*-------------------------*
 * Archived Log resync     *
 *-------------------------*/

FUNCTION beginArchivedLogResync RETURN NUMBER;

-- beginArchivedLogResync begins archive log resync

PROCEDURE checkArchivedLog(
al_recid              IN NUMBER,
al_stamp              IN NUMBER,
thread#               IN NUMBER,
sequence#             IN NUMBER,
reset_scn             IN NUMBER,
reset_time            IN DATE,
low_scn               IN NUMBER,
low_time              IN DATE,
next_scn              IN NUMBER,
next_time             IN DATE,
blocks                IN NUMBER,
block_size            IN NUMBER,
fname                 IN VARCHAR2,
archived              IN VARCHAR2,
completion_time       IN DATE,
status                IN VARCHAR2,
is_standby            IN VARCHAR2 DEFAULT NULL,
dictionary_begin      IN VARCHAR2 DEFAULT NULL,
dictionary_end        IN VARCHAR2 DEFAULT NULL,
is_recovery_dest_file IN VARCHAR2 DEFAULT 'NO',
compressed            IN VARCHAR2 DEFAULT 'NO',
creator               IN VARCHAR2 DEFAULT NULL,
terminal              IN VARCHAR2 DEFAULT 'NO');

/* checkArchivedLog inserts the archived log entry in rcvcat. If the entry is already in rcvcat it will check that it matches the given entry. */
-- Input Parameters:
-- al_recid
-- The controlfile recid of the archived log entry
-- al_stamp
-- The controlfile stamp of the archived log entry
-- thread#
-- Thread number.
-- sequence#
-- Log sequence number
-- reset_scn
-- The resetlogs SCN.
-- reset_time
-- Timestamp associated with resetScn.
-- low_scn
-- The low SCN of this log.
-- low_time
-- Timestamp associated with lowScn.
-- next_scn
-- The last SCN of this log. All redo at this SCN or higher
-- is in a subsequent log sequence number.
-- next_time
-- Timestamep associated with nextScn.
-- blocks
-- Number of blocks in this archivelog.
-- block_size
-- Blocksize of the log.
-- fname
-- Filename of the archived log. NULL -> log was archived
-- status
-- 'A' -> log is available, 'U' -> log is unavailable
-- is_standby
-- 'Y' -> this is a standby archive log,
-- 'N' -> this is a primary archive log
-- is_recovery_dest_file
-- YES - is a recovery destination file. Otherwise, NO.
-- compressed
-- whether the piece is compressed.

procedure endArchivedLogResync;

/* endArchivedLogResync completes archived log resync and updates the high_al_recid column in dbinc table for the next resync. */

/*-------------------------*
 * Offline range resync    *
 *-------------------------*/

FUNCTION beginOfflineRangeResync RETURN NUMBER;

/* beginOfflineRangeResync begins the offline range resync. It returns the highest offline range recid that was recorded by the previous resync. */

procedure checkOfflineRange(
offr_recid IN NUMBER
,offr_stamp IN NUMBER
,file# IN NUMBER
,create_scn IN NUMBER
,offline_scn IN NUMBER
,online_scn IN NUMBER
,online_time IN DATE
,cf_create_time IN DATE
,reset_scn IN NUMBER DEFAULT NULL
,reset_time IN DATE DEFAULT NULL);

-- checkOfflineRange inserts a offline range record in the rcvcat.
-- Input Parameters:
-- offr_recid
-- recid of the offline range record in control file
-- offr_stamp
-- stamp of the offline range record in control file

PROCEDURE endOfflineRangeResync;

-- endOfflineRangeResync completes the offline range resync.

/*-------------------------*
 * Backup Set resync *
 *-------------------------*/
function beginBackupSetResync return NUMBER;
-- beginBackupSetResync begins the backup set resync. It returns the highest
-- backup set recid that was recorded by the previous resync.
procedure checkBackupSet(
bs_recid IN NUMBER
,bs_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,bck_type IN VARCHAR2
,incr_level IN NUMBER DEFAULT NULL
,pieces IN NUMBER
,start_time IN DATE
,completion_time IN DATE
,controlfile_included
IN VARCHAR2 DEFAULT NULL
,input_file_scan_only
IN VARCHAR2 DEFAULT NULL
,keep_options IN NUMBER DEFAULT 0
,keep_until IN DATE DEFAULT NULL
,block_size IN NUMBER DEFAULT NULL
,multi_section IN VARCHAR2 DEFAULT NULL
);
-- checkBackupSet inserts a backup set record in the rcvcat. If the record is
-- already in rcvcat the completion_time will be checked.
-- Input Parameters:
-- bck_type
-- Type of backup: 'D' = full datafile, 'I' = incremental datafile,
-- 'L' = archivelog
-- incr_level
-- Level of the incremental backup
-- bs_recid
-- recid of the backup set record in control file
-- bs_stamp
-- stamp of the backup set record in control file
-- completion_time
-- time when the backup completed
-- ctrlf_ckp_scn
-- If the backup set contains a control file, this the checkpoint SCN
-- in the control file backup. Null otherwise
-- controlfile_included
-- Indicates if this backup set has a controlfile in it and its type
-- 'YES' or 'SBY'. If no controlfile in the backup set then
-- it is 'NO'.
-- keep_until
--- Keep until some time.
-- keep_options
--- Keep options (0 means no_keep).
-- block_size
-- block_size for backupset
procedure endBackupSetResync;
-- endBackupSetResync completes the backup set resync.
/*-------------------------*
* Backup piece resync *
*-------------------------*/
function beginBackupPieceResync return NUMBER;
procedure checkBackupPiece(
bp_recid IN NUMBER
,bp_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,piece# IN NUMBER
,tag IN VARCHAR2
,device_type IN VARCHAR2
,handle IN VARCHAR2
,comments IN VARCHAR2
,media IN VARCHAR2
,concur IN VARCHAR2
,start_time IN DATE
,completion_time IN DATE
,status IN VARCHAR2
,copy# IN NUMBER DEFAULT 1
,media_pool IN NUMBER DEFAULT 0
,bytes IN NUMBER DEFAULT NULL
,is_recovery_dest_file
IN VARCHAR2 DEFAULT 'NO'
,rsr_recid IN NUMBER DEFAULT NULL
,rsr_stamp IN NUMBER DEFAULT NULL
,compressed IN VARCHAR2 DEFAULT 'NO'
,encrypted IN VARCHAR2 DEFAULT 'NO'
,backed_by_osb IN VARCHAR2 DEFAULT 'NO'
);
-- Input Parameters:
--
-- bp_recid
-- recid of backup piece record in control file
-- bp_stamp
-- stamp of backup piece record in control file
-- piece#
-- The ordinal number of this piece within the set.
-- tag
-- User-specified tag. May be NULL.
-- device_type
-- Sequential device type on which this backup set resides. 'DISK'
-- specified if on disk rather than sequential media.
-- handle
-- The media handle on which this backup piece is stored.
-- comments
-- The comment associated with the backup piece.
-- media
-- The media id. If multiple backup pieces reside on the same physical
-- piece of media, then they have the same mediaId. Note this is not
-- the same as a handle, as the handle is specific to a single piece.
-- concur
-- TRUE if multiple job steps can access the physical media concurrently,
-- FALSE if not.
-- bytes
-- piece size in bytes. If unknown, then null is sent. For example,
-- pre-10i backuppieces doesn't have bytes value and inspecting a tape
-- backup doesn't populate bytes value.
-- is_recovery_dest_file
-- YES - is a recovery destination file. Otherwise, NO.
-- compressed
-- whether the piece is compressed.
procedure endBackupPieceResync;
/*-------------------------*
* Backup Datafile resync *
*-------------------------*/
function beginBackupDataFileResync return NUMBER;
procedure checkBackupDataFile(
bdf_recid IN NUMBER
,bdf_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,file# IN NUMBER
,create_scn IN NUMBER
,create_time IN DATE
,reset_scn IN NUMBER
,reset_time IN DATE
,incr_level IN NUMBER
,incr_scn IN NUMBER
,ckp_scn IN NUMBER
,ckp_time IN DATE
,abs_fuzzy_scn IN NUMBER
,datafile_blocks IN NUMBER
,blocks IN NUMBER
,block_size IN NUMBER
,min_offr_recid IN NUMBER
,completion_time IN DATE
,controlfile_type IN VARCHAR2 DEFAULT NULL
,cfile_abck_year IN NUMBER DEFAULT NULL
,cfile_abck_mon_day IN NUMBER DEFAULT NULL
,cfile_abck_seq IN NUMBER DEFAULT NULL
,chk_last_recid IN BOOLEAN DEFAULT TRUE
,blocks_read IN NUMBER DEFAULT NULL
,used_chg_track IN VARCHAR2 DEFAULT 'NO'
,used_optim IN VARCHAR2 DEFAULT 'NO'
,foreign_dbid IN NUMBER DEFAULT 0
,plugged_readonly IN VARCHAR2 DEFAULT 'NO'
,plugin_scn IN NUMBER DEFAULT 0
,plugin_reset_scn IN NUMBER DEFAULT 0
,plugin_reset_time IN DATE DEFAULT NULL
,section_size IN NUMBER DEFAULT NULL
);
-- Input Parameters:
-- recid
-- This is the recid of the v$backup_datafile record for this backup.
-- stamp
-- The timestamp associated with the recid in the controlfile.
-- file#
-- Datafile number
-- create_scn
-- The creation SCN of the datafile.
-- reset_scn
-- The resetlogs SCN of the datafile. Note that different datafiles
-- in a backup set may have different resetScn's. This occurs when
-- taking a backup of a file that was off-line clean or read-only when
-- a resetlogs was done.
-- reset_time
-- incr_scn
-- ckp_scn
-- The SCN to which the datafile's checkpoint will be advanced if this
-- backup is restored ('F') or applied ('I').
-- ckp_time
-- The timestamp associated with ckp_scn.
-- abs_fuzzy_scn
-- Absolute fuzzy SCN.
-- If zero then the file has no fuzziness at all.
-- blocks
-- Number of blocks written to the backup set for this datafile, or
-- the number of blocks in the datafile copy.
-- block_size
-- The blocksize of the datafile or datafile copy. All files within
-- a backup set have the same blocksize, but this need not be enforced
-- by this package.
-- controlfile_type
-- If this a controlfile, it indicates its type ('B' or 'S'), null
-- otherwise
-- chk_last_recid
-- Crosscheck with catalog if this recid is below the previous
-- high water mark.
procedure endBackupDataFileResync;
/*-------------------------*
* Backup SPFILE resync *
*-------------------------*/
function beginBackupSpFileResync return NUMBER;
procedure checkBackupSpFile(
bsf_recid IN NUMBER
,bsf_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,modification_time IN DATE
,bytes IN NUMBER
,chk_last_recid IN BOOLEAN DEFAULT TRUE
,db_unique_name IN VARCHAR2 DEFAULT NULL
);
-- Input Parameters:
-- bsf_recid
-- This is the recid of the v$backup_spfile record for this backup.
-- bsf_stamp
-- The timestamp associated with the recid in the controlfile.
-- set_stamp
-- The timestamp associated with the parent backup set.
-- set_count
-- The set_count of the parent backup set.
-- modification_time
-- The modification time of this SPFILE.
-- bytes
-- Number of bytes written to the backup set for this SPFILE.
-- chk_last_recid
-- Crosscheck with catalog if this recid is below the previous
-- high water mark.
procedure endBackupSpFileResync;
/*-------------------------*
* Backup Redo Log resync *
*-------------------------*/
function beginBackupRedoLogResync return NUMBER;
procedure checkBackupRedoLog(
brl_recid IN NUMBER
,brl_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,thread# IN NUMBER
,sequence# IN NUMBER
,reset_scn IN NUMBER
,reset_time IN DATE
,low_scn IN NUMBER
,low_time IN DATE
,next_scn IN NUMBER
,next_time IN DATE
,blocks IN NUMBER
,block_size IN NUMBER
,chk_last_recid IN BOOLEAN DEFAULT TRUE
,terminal IN VARCHAR2 DEFAULT 'NO'
);
-- Input Parameters:
-- recid
-- The controlfile recid of the archivelog entry. Null if for a backup
-- set.
-- stamp
-- Timestamp associated with copyRecid.
-- thread#
-- Thread number.
-- sequence#
-- Log sequence number
-- reset_scn
-- The resetlogs SCN.
-- reset_time
-- Timestamp associated with resetScn.
-- low_scn
-- The low SCN of this log.
-- low_time
-- Timestamp associated with lowScn.
-- next_scn
-- The last SCN of this log. All redo at this SCN or higher
-- is in a subsequent log sequence number.
-- next_time
-- Timestamep associated with nextScn.
-- blocks
-- Number of blocks in this archivelog.
-- block_size
-- Blocksize of the log.
-- chk_last_recid
-- Crosscheck with catalog if this recid is below the previous
-- high water mark.
procedure endBackupRedoLogResync;
/*----------------------------*
* Copy Datafile resync *
*----------------------------*/
function beginDataFileCopyResync return NUMBER;
procedure checkDataFileCopy(
cdf_recid IN NUMBER
,cdf_stamp IN NUMBER
,fname IN VARCHAR2
,tag IN VARCHAR2
,file# IN NUMBER
,create_scn IN NUMBER
,create_time IN DATE
,reset_scn IN NUMBER
,reset_time IN DATE
,incr_level IN NUMBER
,ckp_scn IN NUMBER
,ckp_time IN DATE
,onl_fuzzy IN VARCHAR2
,bck_fuzzy IN VARCHAR2
,abs_fuzzy_scn IN NUMBER
,rcv_fuzzy_scn IN NUMBER
,rcv_fuzzy_time IN DATE
,blocks IN NUMBER
,block_size IN NUMBER
,min_offr_recid IN NUMBER
,completion_time IN DATE
,status IN VARCHAR2
,controlfile_type IN VARCHAR2 DEFAULT NULL
,keep_options IN NUMBER DEFAULT 0
,keep_until IN DATE DEFAULT NULL
,scanned IN VARCHAR2 DEFAULT 'NO'
,is_recovery_dest_file IN VARCHAR2 DEFAULT 'NO'
,rsr_recid        IN NUMBER DEFAULT NULL
,rsr_stamp        IN NUMBER DEFAULT NULL
,marked_corrupt   IN NUMBER DEFAULT NULL
,foreign_dbid     IN NUMBER DEFAULT 0
,plugged_readonly IN VARCHAR2 DEFAULT 'NO'
,plugin_scn       IN NUMBER DEFAULT 0
,plugin_reset_scn IN NUMBER DEFAULT 0
,plugin_reset_time IN DATE DEFAULT NULL
);
-- Input Parameters:
-- recid
-- If this is a datafile copy, this is the recid of the controlfile
-- record for this copy.
-- stamp
-- The timestamp associated with the recid in the controlfile.
-- fname
-- The filename of the copy file.
-- tag
-- Optional tag for a datafile copy
-- file#
-- Datafile number
-- create_scn
-- The creation SCN of the datafile.
-- reset_scn
-- The resetlogs SCN of the datafile. Note that different datafiles
-- in a backup set may have different resetScn's. This occurs when
-- taking a backup of a file that was off-line clean or read-only when
-- a resetlogs was done.
-- reset_time
-- ckp_scn
-- The SCN in the file's header.
-- ckp_time
-- The timestamp associated with ckp_scn.
-- abs_fuzzy_scn
-- Absolute fuzzy SCN.
-- If 0, then the file is not fuzzy at all.
-- blocks
-- File size.
-- block_size
-- Number of bytes in each logical block.
-- controlfile_type
-- The type of controlfile copy this is 'B' or 'S'.
-- null if not a controlfile
-- keep_until
--- Keep until some time.
-- keep_options
--- Keep options (0 means no_keep).
-- is_recovery_dest_file
-- YES - is a recovery destination file. Otherwise, NO.
procedure endDataFileCopyResync;
/*----------------------------*
* Corrupt Block resync *
*----------------------------*/
function beginBackupCorruptionResync return NUMBER;
procedure checkBackupCorruption(
bcb_recid IN NUMBER
,bcb_stamp IN NUMBER
,set_stamp IN NUMBER
,set_count IN NUMBER
,piece# IN NUMBER
,file# IN NUMBER
,block# IN NUMBER
,blocks IN NUMBER
,corrupt_scn IN NUMBER
,marked_corrupt IN VARCHAR2
,corruption_type IN VARCHAR2 DEFAULT NULL
);
procedure endBackupCorruptionResync;
function beginCopyCorruptionResync return NUMBER;
procedure checkCopyCorruption(
ccb_recid IN NUMBER
,ccb_stamp IN NUMBER
,cdf_recid IN NUMBER
,cdf_stamp IN NUMBER
,file# IN NUMBER
,block# IN NUMBER
,blocks IN NUMBER
,corrupt_scn IN NUMBER
,marked_corrupt IN VARCHAR2
,corruption_type IN VARCHAR2 DEFAULT NULL
);
procedure endCopyCorruptionResync;
-- addCorrupt is called to add information about a block corruption in a
-- datafile copy or backup datafile.
--
-- Input Parameters:
-- bdf_key
-- Primary key of the bdf record which was returned by addBackupDatafile.
-- block#
-- The block number of the corrupt block.
-- corrupt_scn
-- SCN of the redo that corrupted the block for logically corrupt blocks.
-- Zero if the block is media corrupt.
-- marked_corrupt
-- 'T' if we could not read the block from disk and had to reformat
-- the block as corrupt for storing in the backup set or copy. 'F'
-- otherwise.
-- piece#
-- The backup piece where the corrupt block was written. Null if
-- this is for a datafile copy.
/*----------------------------*
* Deleted Object resync *
*----------------------------*/
function beginDeletedObjectResync return NUMBER;
procedure checkDeletedObject(
do_recid IN NUMBER
,do_stamp IN NUMBER
,object_type IN VARCHAR2
,object_recid IN NUMBER
,object_stamp IN NUMBER
,object_data IN NUMBER DEFAULT NULL
,object_fname IN VARCHAR2 DEFAULT NULL
,object_create_scn IN NUMBER DEFAULT NULL
,set_stamp IN NUMBER DEFAULT NULL
,set_count IN NUMBER DEFAULT NULL
);
procedure endDeletedObjectResync;
/*-------------------*
* Proxy Copy resync *
*-------------------*/
function beginProxyResync return NUMBER;
procedure checkProxyDataFile(
xdf_recid IN NUMBER
,xdf_stamp IN NUMBER
,tag IN VARCHAR2
,file# IN NUMBER
,create_scn IN NUMBER
,create_time IN DATE
,reset_scn IN NUMBER
,reset_time IN DATE
,incr_level IN NUMBER
,ckp_scn IN NUMBER
,ckp_time IN DATE
,onl_fuzzy IN VARCHAR2
,bck_fuzzy IN VARCHAR2
,abs_fuzzy_scn IN NUMBER
,rcv_fuzzy_scn IN NUMBER
,rcv_fuzzy_time IN DATE
,blocks IN NUMBER
,block_size IN NUMBER
,min_offr_recid IN NUMBER
,device_type IN VARCHAR2
,handle IN VARCHAR2
,comments IN VARCHAR2
,media IN VARCHAR2
,media_pool IN NUMBER
,start_time IN DATE
,completion_time IN DATE
,status IN VARCHAR2
,controlfile_type IN VARCHAR2 DEFAULT NULL
,keep_options IN NUMBER DEFAULT 0
,keep_until IN DATE DEFAULT NULL
,rsr_recid IN NUMBER DEFAULT NULL
,rsr_stamp IN NUMBER DEFAULT NULL
,foreign_dbid IN NUMBER DEFAULT 0
,plugged_readonly IN VARCHAR2 DEFAULT 'NO'
,plugin_scn IN NUMBER DEFAULT 0
,plugin_reset_scn IN NUMBER DEFAULT 0
,plugin_reset_time IN DATE DEFAULT NULL);

PROCEDURE checkProxyArchivedLog(
xal_recid IN NUMBER
,xal_stamp IN NUMBER
,tag IN VARCHAR2
,thread# IN NUMBER
,sequence# IN NUMBER
,resetlogs_change# IN NUMBER
,resetlogs_time IN DATE
,first_change# IN NUMBER
,first_time IN DATE
,next_change# IN NUMBER
,next_time IN DATE
,blocks IN NUMBER
,block_size IN NUMBER
,device_type IN VARCHAR2
,handle IN VARCHAR2
,comments IN VARCHAR2
,media IN VARCHAR2
,media_pool IN NUMBER
,start_time IN DATE
,completion_time IN DATE
,status IN VARCHAR2
,rsr_recid IN NUMBER
,rsr_stamp IN NUMBER
,terminal IN VARCHAR2 DEFAULT 'NO'
,keep_until IN DATE DEFAULT NULL
,keep_options IN NUMBER DEFAULT 0);

-- Input Parameters:
-- recid
-- If this is a datafile/archivelog copy, this is the recid of the
-- controlfile record for this copy.
-- stamp
-- The timestamp associated with the recid in the controlfile.
-- fname
-- The filename of the copy file.
-- tag
-- Optional tag for a datafile copy
-- file#
-- Datafile number
-- thread#
-- Thread number
-- sequence#
-- Log sequence number
-- create_scn
-- The creation SCN of the datafile.
-- reset_scn, resetlogs_change#
-- The resetlogs SCN of the datafile. Note that different datafiles
-- in a backup set may have different resetScn's. This occurs when
-- taking a backup of a file that was off-line clean or read-only when
-- a resetlogs was done.
-- reset_time, resetlogs_time
-- Timestamp associated with reset_scn
-- ckp_scn
-- The SCN in the file's header.
-- ckp_time
-- The timestamp associated with ckp_scn.
-- abs_fuzzy_scn
-- Absolute fuzzy SCN.
-- If 0, then the file is not fuzzy at all.
-- blocks
-- File size.
-- block_size
-- Number of bytes in each logical block.
-- handle
-- The media handle on which this proxy backup is stored.
-- comments
-- The comment associated with the proxy backup.
-- media
-- The media id. If multiple proxy copies reside on the same physical
-- piece of media, then they have the same mediaId. Note this is not
-- the same as a handle, as the handle is specific to a single piece.
-- start_time
-- The time that the media management layer was told it could start
-- copying the file.
-- completion_time
-- The time that the media management layer reported that it was done
-- copying the file.
-- status
-- A or D - available or deleted
-- controlfile_type
-- The type of controlfile copy this is 'B' or 'S'.
-- null if not a controlfile
-- keep_until
-- Keep until some time.
-- keep_options
-- Keep options (0 means no_keep).
-- first_change#
-- SCN generated when switching in
-- first_time
-- Timestamp associated with first_change#
-- next_change#
-- SCN generated when switching out
-- next_time
-- Timestamp associated with next_time
procedure endProxyResync;
/*-------------------------*
* Incarnation resync *
*-------------------------*/
FUNCTION beginIncarnationResync(return_Recid in BOOLEAN DEFAULT FALSE)
return NUMBER;
-- beginIncarnationResync begins the database incarnation tree resync. It
-- returns the controlfile timestamp seen by previous resync, if return_Recid
-- is FALSE. Otherwise returns last recid of the incarnation record resynced
-- from same controlfile (i.e., treated like other circular record sections).
function checkIncarnation(reset_scn IN NUMBER,
reset_time IN DATE,
prior_reset_scn IN NUMBER DEFAULT NULL,
prior_reset_time IN DATE DEFAULT NULL,
db_name IN VARCHAR2 DEFAULT 'UNKNOWN')
return NUMBER;
-- checkIncarnation checks if reset_scn, reset_time incarnation is present
-- in dbinc table. Ifn't inserts this entry into dbinc table. Returns the
-- corresponding dbinc_key entry.
procedure endIncarnationResync(high_kccdivts IN NUMBER,
high_ic_recid IN NUMBER DEFAULT 0);
-- endIncarnationResync records this controlfile timestamp / high recid id
-- depending on whether resync is based on controlfile stamp or recid's.
/*-----------------------------*
* Normal restore point Resync *
*-----------------------------*/
FUNCTION beginRestorePointResync RETURN NUMBER;
PROCEDURE checkRestorePoint(
nrsp_recid IN NUMBER
,nrsp_stamp IN NUMBER
,nrsp_name IN VARCHAR2
,reset_scn IN NUMBER
,reset_time IN DATE
,to_scn IN NUMBER
,nrsp_time IN DATE
,create_time IN DATE
,deleted IN NUMBER
);
PROCEDURE endRestorePointResync(lowrecid IN NUMBER);
/*----------------------------*
* RMAN Status resync *
*----------------------------*/
FUNCTION beginRmanStatusResync RETURN NUMBER;
-- beginRmanStatusResync begins the resync of the RMAN status records. It
-- returns the controlfile timestamp seen by previous resync.
PROCEDURE checkRmanStatus( recid IN NUMBER
,stamp IN NUMBER
,parent_recid IN NUMBER
,parent_stamp IN NUMBER
,row_level IN NUMBER
,row_type IN VARCHAR2
,command_id IN VARCHAR2
,operation IN VARCHAR2
,status IN VARCHAR2
,mbytes_processed IN NUMBER
,start_time IN DATE
,end_time IN DATE
,ibytes IN NUMBER DEFAULT NULL
,obytes IN NUMBER DEFAULT NULL
,optimized IN VARCHAR2 DEFAULT NULL
,otype IN VARCHAR2 DEFAULT NULL
,session_recid IN NUMBER DEFAULT NULL
,session_stamp IN NUMBER DEFAULT NULL
,odevtype IN VARCHAR2 DEFAULT NULL
,osb_allocated IN VARCHAR2 DEFAULT 'NO');
--
-- checkRmanStatus checks if this RMAN status row is present in the rsr table.
-- If it is not present, then it inserts this row into the table.
--
-- Input Parameters:
-- recid
-- Recid of the rman status record in the controlfile.
-- stamp
-- The timestamp associated with the recid in the controlfile.
-- parent_recid
-- The recid of the parent record. Might be null..
-- parent_stamp
-- The timestamp associated with the parent+_recid in the controlfile.
-- Might be null.
-- row_level
-- Row level.
-- command_id
-- Command id of the row.
-- operation
-- Operation accociated with this row.
-- status
-- Status of the operation
-- mbytes_processed
-- amount of data processed with the operation.
-- start_time
-- The time when operation begin.
-- start_end
-- The time when operation ends. Might be null.
-- ibytes
-- The amount of input data in bytes processed
-- obytes
-- The amount of output data written in bytes during the command
PROCEDURE endRmanStatusResync(recid NUMBER);
-- endRmanStatusResync records the input recid as high_rsr_recid.
PROCEDURE updateRmanStatusRow( recid IN NUMBER
,stamp IN NUMBER
,mbytes IN NUMBER
,status IN binary_integer);
-- commitRmanStatusRow updates the row with status and mbytes.
/*----------------------------*
* RMAN Output resync *
*----------------------------*/
FUNCTION beginRmanOutputResync(start_timestamp in NUMBER) RETURN NUMBER;
-- beginRmanOutputResync begins the resync of the RMAN output records. It
-- returns the timestamp seen by previous resync of RMAN output rows.
PROCEDURE checkRmanOutput( recid IN NUMBER
,stamp IN NUMBER
,session_recid IN NUMBER
,session_stamp IN NUMBER
,rman_status_recid IN NUMBER
,rman_status_stamp IN NUMBER
,output IN VARCHAR2);
--
-- checkRmanOut checks if this RMAN Output row is present in the rout table.
-- If it is not present, then it inserts this row into the table.
--
-- Input Parameters:
-- stamp
-- The timestamp associated with the recid in the memory.
-- session_recid
-- The recid of the session record indicator.
-- session_stamp
-- The timestamp associated with the session record indicator.
-- rman_status_recid
-- recid of the control file record corresponding to the command.
-- rman_status_stamp
-- stamp of the control file record corresponding to the command.
-- output
-- text ouput from the command execution.
PROCEDURE endRmanOutputResync;
-- endRmanOutputResync records the input stamp as high_rout_stamp.
/*----------------------------*
* Block Corruption Resync *
*----------------------------*/
function beginBlockCorruptionResync(
low_bcr_recid IN NUMBER)
return NUMBER;
procedure checkBlockCorruption(
bcr_recid IN NUMBER
,bcr_stamp IN NUMBER
,file# IN NUMBER
,create_scn IN NUMBER
,create_time IN DATE
,block# IN NUMBER
,blocks IN NUMBER
,corrupt_scn IN NUMBER
,corruption_type IN VARCHAR2
);
procedure endBlockCorruptionResync;
--
-- Input Parameters:
-- bcr_recid and bcr_stamp
-- X$KCCBLKCOR recid and stamp
-- file#, create_scn and create_time
-- Datafile number, creation scn and creation time to which this
-- corruption block range belongs.
-- block#
-- The block number of the corrupt block.
-- blocks
-- Number of blocks corrupted from block#.
-- corrupt_scn
-- SCN of the redo that corrupted the block for logically corrupt blocks.
-- Zero if the block is media corrupt.
-- corruption_type
-- One of following types: ALL ZERO, FRACTURED, CHECKSUM, CORRUPT
--
/*----------------------------*
* Change Procedures *
*----------------------------*/
procedure changeDataFileCopy(
cdf_recid IN NUMBER
,cdf_stamp IN NUMBER
,status IN VARCHAR2
,keep_options IN NUMBER DEFAULT NULL -- null means don't update
,keep_until IN DATE DEFAULT NULL
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeDatafileCopy is called to change the availability, delete a
-- datafile copy or to change keep optsion of a datafile copy
-- in recovery catalog
procedure changeControlfileCopy(
cdf_recid IN NUMBER
,cdf_stamp IN NUMBER
,status IN VARCHAR2
,keep_options IN NUMBER DEFAULT NULL -- null means don't update
,keep_until IN DATE DEFAULT NULL
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeControlfileCopy is called to change the availability or delete a
-- controlfile copy in recovery catalog
procedure changeArchivedLog(
al_recid IN NUMBER
,al_stamp IN NUMBER
,status IN VARCHAR2
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeArchivedLog is called to change the availability or delete a
-- datafile copy in recovery catalog
procedure changeBackupSet(
recid IN NUMBER
,stamp IN NUMBER
,keep_options IN NUMBER -- null means don't update
,keep_until IN DATE
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeDatafileCopy is called to change the availability, delete a
-- datafile copy or to change keep optsion of a datafile copy
-- in recovery catalog
procedure changeBackupPiece(
bp_recid IN NUMBER
,bp_stamp IN NUMBER
,status IN VARCHAR2
,set_stamp IN NUMBER DEFAULT NULL
,set_count IN NUMBER DEFAULT NULL
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeBackupPiece is called to change the availability of or delete a backup
-- piece
procedure changeProxyCopy(
pc_recid IN NUMBER
,pc_stamp IN NUMBER
,status IN VARCHAR2
,keep_options IN NUMBER DEFAULT NULL -- null means don't update
,keep_until IN DATE DEFAULT NULL
,osite_key IN NUMBER DEFAULT NULL
,nsite_key IN NUMBER DEFAULT NULL
);
-- changeProxyCopy is called to change the availability of or delete a
-- proxy copy
/*----------------------------*
* Stored Script Procedures *
*----------------------------*/
procedure createScript(name IN VARCHAR2);
procedure createScript(name IN VARCHAR2,
scr_com IN VARCHAR2,
global IN BOOLEAN);
procedure replaceScript(name IN VARCHAR2);
procedure replaceScript(name IN VARCHAR2,
scr_com IN VARCHAR2,
global IN BOOLEAN);
-- These procedures create or replace a script with the given name. Each
-- database registered in the catalog has its own namespace for scripts.
-- The putLine function must be called to pass the lines of the script
-- to the catalog.
procedure putLine(line IN VARCHAR2);
-- This procedure passes 1 line of the script to the catalog. The client
-- must call this until all lines have been passed in. After the last line,
-- call putLine(NULL) to indicate that all lines have been passed in.
-- The maximum line length is 1024 bytes.
procedure deleteScript(name IN VARCHAR2);
procedure deleteScript(name IN VARCHAR2, glob IN NUMBER);
-- Deletes a script. If glob is TRUE, it deletes a global script.
procedure getScript(name IN VARCHAR2);
procedure getScript(name IN VARCHAR2, glob IN NUMBER);
-- This procedure gets a script from the recovery catalog. The client must
-- call getLine to fetch the lines of the script. If glob is TRUE it gets a
-- global script.
function getLine return VARCHAR2;
-- This function returns 1 line of the stored script. When all lines have
-- been passed back, it returns NULL.
procedure commitChanges;
-- Just does a commit;
/*---------------------------------------*
* Procedures for clone database support *
*---------------------------------------*/
procedure setCloneName(file# IN NUMBER
,creation_change# IN NUMBER
,new_clone_fname IN VARCHAR2
,old_clone_fname IN VARCHAR2
,changedauxname OUT BOOLEAN
,plugin_change# IN NUMBER DEFAULT 0);
FUNCTION getCloneName(file# IN NUMBER
,creation_change# IN NUMBER
,plugin_change# IN NUMBER DEFAULT 0) RETURN VARCHAR2;
/*-----------------------------------*
* Procedures for RMAN configuration *
*-----------------------------------*/
PROCEDURE setConfig(conf# IN NUMBER
,name IN VARCHAR2
,value IN VARCHAR2);
PROCEDURE resetConfig;
PROCEDURE setConfig2(conf# IN NUMBER
,name IN VARCHAR2
,value IN VARCHAR2
,nodespec IN BOOLEAN);
PROCEDURE resetConfig2(nodespec IN BOOLEAN,
high_conf_recid IN NUMBER DEFAULT NULL);
PROCEDURE deleteConfig(conf# IN NUMBER);
FUNCTION setConfig3(name IN VARCHAR2
,value IN VARCHAR2
,db_unique_name IN VARCHAR2) RETURN NUMBER;
PROCEDURE deleteConfig3(conf# IN NUMBER
,db_unique_name IN VARCHAR2);
/*----------------------------*
* Version info *
*----------------------------*/
function getPackageVersion return VARCHAR2;
function getCatalogVersion return VARCHAR2;
/*-------------------*
* Utility functions *
*-------------------*/
/*
* NAME
* bsStstusRecalc
* DESCRIPTION
* Recompute the backupset status for all backupset whose current
* status is a specified value. This is intended to be used when
* new values are introduced for the bs.status column.
*/
PROCEDURE bsStatusRecalc(status IN VARCHAR2);
-- reNormalize is the interface to the recovery catalog used to apply a
-- one-time fixup on Windows-NT by re-applying the normalization algorithm,
-- which has been improved for 8.1.6.
-- The first call to reNormalize passes a null value for newname, to
-- initialize the procedure. Each call returns an oldname which needs to be
-- normalized. The caller normalizes the name and passes it back to
-- reNormalize, in newname, on the next call. reNormalize will then update
-- the previous row and return the next one. oldname is returned to the caller
-- as null when there are no more names.
PROCEDURE reNormalize(newname IN VARCHAR2, oldname OUT VARCHAR2);
-- sanityCheck is a procedure that performs internal consistency checks, and
-- cleanup, of the recovery catalog. It is the last thing that is done during
-- resync.
PROCEDURE sanityCheck;
-- This function gets the sfile_key of the file in the catalog
-- if the catalog does not have the file then the routine fails if createfile
-- if 0, if createfile is 1 then a new record is created
-- It returns the key of the record created.
-- If the file already exists in the catalog, the current key is
-- returned and the newfile flag is set, so that it can be updated.
-- A special case is when this_fname is null, in this case the routine
-- returns the current db_key, this is needed for a posterior select
-- of all the stored files in the catalog for the current database (db_key)
-- in this case createfile and newfile are ignored.
FUNCTION getDbid RETURN NUMBER;
PROCEDURE listScriptNames(glob IN NUMBER,
allnames IN NUMBER);
-- Opens the cursor to fetch the names of the scripts that stored in the
-- recovery catalog.
-- By default scripts created by the target database are fetched and also
-- all the global scripts.
-- If GLOB, is TRUE then only the global scripts are fetched.
-- If ALLNAMES, is TRUE, then all scripts from all databases are fetched.

PROCEDURE getScriptNames(
dbname OUT VARCHAR2,
scnm   OUT VARCHAR2,
sccom  OUT VARCHAR2);

-- Fetch one row from the cursor opened by listScriptNames.
-- It returns the name of the target database to which the script belongs,
-- ORAGLOBAL is used to indicate the script is a GLOBAL script, the name of
-- the script and the comment associated at the script (NULL) if no comment
-- is stored in the recovery catalog.

PROCEDURE updateOldestFlashbackSCN(
oldest_flashback_scn  IN NUMBER,
oldest_flashback_time IN DATE DEFAULT NULL);

-- Updates the current dbinc record with the oldest_flashback_scn (aka
-- guaranteed flashback scn) and oldest_flashback time that is passed in.

FUNCTION getDbinc RETURN NUMBER;

-- Returns the package constant this_dbinc_key

FUNCTION isDuplicateRecord(
recid IN NUMBER,
stamp IN NUMBER,
type  IN VARCHAR2)
RETURN BOOLEAN;

-- Return TRUE if there exists a record with (recid, stamp) in catalog
-- table identified by type. Otherwise, FALSE.
-- Type can one of following values:
-- 1. 'AL' (archived log)
-- 2. 'BP' (backup piece)
-- 3. 'DC' (datafile copy)
FUNCTION doDuplicateMining RETURN BOOLEAN;
-- Return TRUE if we have to do mining in order to determine the closest
-- resync time. Otherwise, FALSE.
-- Unregister a standby site. This procedures removes the metadata stored in
-- recovery catalog for the given standby node.
PROCEDURE unregisterSite(db_unique_name IN VARCHAR2,
incbcks IN binary_integer);
-- rename a site name. This procedures renames the metadata stored in
-- recovery catalog for the given standby node.
PROCEDURE renameSite(from_db_unique_name IN VARCHAR2,
to_db_unique_name IN VARCHAR2);
-- Add db_unique_name to node
-- Add a new entry to the node table if it doesn't exist.
PROCEDURE resyncAddDBUname(cdbunstr IN VARCHAR2);
-- Function used to return site key for a required site from catalog schema...
-- If not db_unique_name is specified, it returns current site key.
FUNCTION getThisSiteKey(db_unique_name in VARCHAR2 DEFAULT NULL)
return NUMBER;
PROCEDURE enableResyncActions;
PROCEDURE setReason(reason IN NUMBER, forceSet IN BOOLEAN DEFAULT FALSE);
FUNCTION getReason RETURN NUMBER;
PROCEDURE incResyncActions(action IN NUMBER,
objno IN NUMBER,
objname IN VARCHAR2);
PROCEDURE getResyncActions(valid OUT BOOLEAN
,added OUT NUMBER
,dropped OUT NUMBER
,changed OUT NUMBER
,recreated OUT NUMBER
,renamed OUT NUMBER
,resized OUT NUMBER);
PROCEDURE clearResyncActions;
PROCEDURE dumpResyncActions;
FUNCTION debOK (level IN NUMBER DEFAULT RCVCAT_LEVEL_DEFAULT) RETURN BOOLEAN;
--
-- createTempResource
--
-- Add an entry with the given name and data_type in tempres table.
--
PROCEDURE createTempResource(
name IN VARCHAR2
,data_type IN VARCHAR2);
--
-- lockTempResource
--
-- get a rowlock in tempres table for the given name and data_type. If
-- no rowlock can be obtained or there is no such object, then return
-- FALSE. Otherwise, TRUE if successful.
--
FUNCTION lockTempResource(name IN VARCHAR2, data_type IN VARCHAR2) RETURN BOOLEAN;

/* cleanupTempResource
   For each row in tempres table, get a rowlock and then drop the object. If the rowlock
   couldn't be obtained, then try next row. No error is signalled.*/


PROCEDURE cleanupTempResource;

-- addDbidToImport
--
-- If no dbid and no dbname is provided, then add all the dbid's that exists
-- in source recovery catalog database and its incarnations to idb and
-- idbinc table correspondingly.
-- If dbid is not null, then add the dbid and its incarnation to idb and
-- idbinc table correspondingly.
-- If dbname is not null, then add the dbid and its incarnation that
-- corresponds to the dbname to idb and idbinc table.
-- Signal any error when dbid was not found, dbname was ambiguous or
-- no database was found.


PROCEDURE addDbidToImport(
first  IN binary_integer,
idb    IN VARCHAR2,
idbinc IN VARCHAR2,
dbid   IN NUMBER DEFAULT NULL,
dbname IN VARCHAR2 DEFAULT NULL);

-- lockDbidToImport
--
-- Obtain rowlock for all the dbids that are present in idb table on source
-- recovery catalog database. This is needed to prevent any update to
-- source recovery catalog database while doing import.


PROCEDURE lockDbidToImport(idb IN VARCHAR2);

-- importSchema
--
-- Use the dblink, idb and idbinc table and import all the recovery catalog
-- tables from source recovery catalog database (using dblink provided)
-- into destination recovery catalog database. If there is any error, the
-- changes are rolled back.


PROCEDURE importSchema(
dblink IN VARCHAR2,
idb    IN VARCHAR2,
idbinc IN VARCHAR2);

-- Functions to control file sharing attributes and behavior of RCVCAT
-- package.
--
-- set Archive log file sharing scope attributes for the session


PROCEDURE setArchiveFileScopeAttributes(logs_shared IN NUMBER);

-- set Backup file sharing scope attributes for the session

PROCEDURE setBackupFileScopeAttributes(
disk_backups_shared IN NUMBER,
tape_backups_shared IN NUMBER);

-- unregisterDatabase
--
-- unregister all database in idb that was successfully imported from
-- source recovery catalog database.


PROCEDURE unregisterDatabase(idb IN VARCHAR2);

/*--------------------------------------*
* Virtual Private Catalog Procedures *
*--------------------------------------*/

PROCEDURE grant_catalog(userid   IN VARCHAR2, dbname IN VARCHAR2);
PROCEDURE grant_catalog(userid   IN VARCHAR2, dbid IN NUMBER);
PROCEDURE grant_register(userid  IN VARCHAR2);
PROCEDURE revoke_catalog(userid  IN VARCHAR2, dbname IN VARCHAR2);
PROCEDURE revoke_catalog(userid  IN VARCHAR2, dbid IN NUMBER);
PROCEDURE revoke_register(userid IN VARCHAR2);
PROCEDURE revoke_all(userid IN VARCHAR2);
PROCEDURE create_virtual_catalog;
PROCEDURE drop_virtual_catalog;

END dbms_rcvcat;
Package Body Source Code Click Here
 
 
Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2013 Daniel A. Morgan All Rights Reserved