DBA Data[Home] [Help]

PACKAGE: SYS.DBMS_RCVMAN

Source


1 package dbms_rcvman IS
2 
3 ----------------------------------------
4 -- PUBLIC VARIABLES AND TYPES SECTION --
5 ----------------------------------------
6 
7 actual_dbinc_key number := NULL; -- see comments on getActualDbinc
8 
9 TRUE#  CONSTANT number := 1;
10 FALSE# CONSTANT number := 0;
11 
12 -- Below public variables used in KQFV.H to obtain summary information based
13 -- on job filter attributes.
14 SESSION_KEY number;
15 SESSION_FROMTIME DATE;
16 SESSION_UNTILTIME DATE;
17 
18 -- The values here must never be changed, because the 8.0 rman executables have
19 -- these values hard-coded in the krmkbt enum in krmk.h.  The setFrom procedure
20 -- in particular is using hard-coded values.
21 
22 -- The 8.1.5 rman executable calls a procedure, set_package_constants, that
23 -- re-assigns these constants to whatever the package needs them to be, then
24 -- queries the package for their new values.  The 8.1.5 rman does not care
25 -- what the values are, however, the cursor used by reportGetDFDel used to use
26 -- these values to perform an order-by to return rows in preference order.
27 -- The preference order is used to decide which ones to delete.
28 
29 -- As of 8.1.6, the order-by in reportGetDFDel is independant of these values.
30 -- The 8.1.6 rman does not use these values at all, except in setFrom.
31 -- However, for backwards compatibility with the 8.1.5 RMAN, these must remain
32 -- as public package constants.
33 
34 COPY                  number := 1; -- any image copy of a file
35 FULL_DF_BACKUP        number := 2; -- datafile in a full backup set
36 INCREMENTAL_DF_BACKUP number := 3; -- datafile in an incr backup set
37 BACKUP                number := 4; -- any file in a backup set (incl proxy)
38 OFFLINE_RANGE         number := 5; -- an offline range
39 CUMULATIVE            number := 6; -- cumulative incremental - for LIST only
40 PROXY                 number := 7; -- any proxy copy of a file
41 NONPROXY              number := 9; -- any image, backup set other than proxy
42 AVMCOPY               number := 10; --  only avm image copy of a file
43 
44 -- Recovery Action Kinds (Obsolete as of 8.1.6) --
45 
46 implicitOfflRange CONSTANT NUMBER := 2**0;
47 cleanRange        CONSTANT NUMBER := 2**1;
48 applyOfflRange    CONSTANT NUMBER := 2**2;
49 dfCopy            CONSTANT NUMBER := 2**3;
50 proxyFull         CONSTANT NUMBER := 2**4;
51 buSet             CONSTANT NUMBER := 2**5;
52 applyIncremental  CONSTANT NUMBER := 2**6;
53 redo              CONSTANT NUMBER := 2**7;
54 
55 -- kind masks
56 maxKind           CONSTANT NUMBER := redo;            -- last real kind above
57 allKind           CONSTANT NUMBER := (maxKind*2) - 1; -- all real backup types
58 fullKind          CONSTANT NUMBER := dfCopy + proxyFull + buSet;
59 tagKind           CONSTANT NUMBER := fullKind + applyIncremental;
60 
61 -- pseudo kinds
62 deletedKind       CONSTANT NUMBER := maxKind*2;      -- action deleted
63 
64 ----------------------------------
65 -- Backupset Availability Masks --
66 ----------------------------------
67 
68 BSavailable     CONSTANT BINARY_INTEGER := 2**0;
69 BSunavailable   CONSTANT BINARY_INTEGER := 2**1;
70 BSdeleted       CONSTANT BINARY_INTEGER := 2**2;
71 BSexpired       CONSTANT BINARY_INTEGER := 2**3;
72 -- BSpartial_avail is a backupset validation mask and NOT a backuppiece
73 -- filter.  For eg. to get 'A', 'U', 'X' pieces and to enable validation
74 -- to succeed for partially available backupset use
75 -- BSpartial_avail + BSavailable + BSunavailable + BSexpired.
76 BSpartial_avail CONSTANT BINARY_INTEGER := 2**4;
77 
78 
79 ----------------------
80 -- BackupType Mask ---
81 ----------------------
82 BSdatafile_full  CONSTANT BINARY_INTEGER := 2**0;
83 BSdatafile_incr  CONSTANT BINARY_INTEGER := 2**1;
84 BSarchivelog     CONSTANT BINARY_INTEGER := 2**2;
85 
86 ---------------------------
87 -- ControlfileType Mask ---
88 ---------------------------
89 BScfile_all      CONSTANT BINARY_INTEGER := 2**0;      -- shouldn't be altered
90 BScfile_auto     CONSTANT BINARY_INTEGER := 2**1;
91 
92 ---------------------
93 -- Datafile Record --
94 ---------------------
95 
96 TYPE dfRec_t IS RECORD
97 (
98    dfNumber             number,
99    dfCreationSCN        number,
100    dfCreationTime       date,
101    fileName             varchar2(1024),
102    tsName               varchar2(30),
103    tsNumber             number,
104    status               number,
105    blocks               number,
106    blockSize            number,
107    kbytes               number,
108    unrecovSCN           number,
109    stopSCN              number,
110    readOnly             number,
111    rfNumber             number,
112    inBackup             number,     -- if greater than 0 then
113                                     -- included_in_database_backup is set
114    auxName              varchar2(1024),
115    dbincKey             number,
116    dfOfflineSCN         number,
117    dfOnlineSCN          number,
118    dfOnlineTime         date,
119    encrypt              number,     -- encrypt value 1=ON, 2=OFF, 3=CLEAR
120    foreignDbid          number,         -- foreign database id
121    pluggedRonly         binary_integer, -- 1 for read-only. Otherwise, 0
122    pluginSCN            number,         -- plugin change#
123    pluginRlgSCN         number,         -- plugin resetlogs_change#
124    pluginRlgTime        date,           -- plugin resetlogs_time
125    newDfCreationSCN     number,         -- plugin scn or creation scn
126    creation_thread      number,         -- creation thread
127    creation_size        number,         -- creation size
128    pdbId                number,         -- pdbid
129    pdbKey               number,         -- pdbKey
130    pdbName              varchar2(30),   -- pdbname
131    pdbClosed            number,         -- pdbclosed
132    pdbForeignDbid       number  -- dbid of PDB from which this file came from
133 );
134 
135 ---------------------
136 -- Tempfile Record --
137 ---------------------
138 
139 TYPE tfRec_t IS RECORD
140 (
141    tfNumber             number,
142    tfCreationSCN        number,
143    tfCreationTime       date,
144    fileName             varchar2(1024),
145    tsName               varchar2(30),
146    tsNumber             number,
147    status               number,
148    isSFT                varchar2(3),
149    blocks               number,
150    blockSize            number,
151    maxSize              number,
152    nextSize             number,
153    rfNumber             number,
154    dbincKey             number,
155    pdbId                number,
156    pdbKey               number,
157    pdbName              varchar2(30)
158 );
159 
160 -------------------------
161 -- Archived Log Record --
162 -------------------------
163 
164 TYPE alRec_t IS RECORD
165 (
166    key                  number,
167    recid                number,
168    stamp                number,
169    thread               number,
170    sequence             number,
171    fileName             varchar2(1024),
172    lowSCN               number,
173    lowTime              date,
174    nextSCN              number,
175    nextTime             date,
176    rlgSCN               number,
177    rlgTime              date,
178    blocks               number,
179    blockSize            number,
180    status               varchar2(1),
181    compTime             date,
182    duplicate            number,
183    isrdf                varchar2(3),
184    compressed           varchar2(3),
185    stby                 varchar2(1),
186    terminal             varchar2(3),
187    site_key             number,
188    site_key_order_col   number,
189    source_dbid          number
190 );
191 
192 -- All of the queries which return data about a backup/imagecopy/proxycopy
193 -- select into a rcvRec_t record type.  We have standardized all of our
194 -- queries to have a common select-list and the results of the queries are
195 -- returned through a common public package function.  The reason for this is
196 -- so that krmk.pc can populate its internal data structures consistantly,
197 -- regardless of what particular procedure it has called to query the catalog.
198 
199 -- By having all queries select into the same record type, we can ensure
200 -- that all queries use the same select list.  Any new fields that get added
201 -- to this record will require updating the select lists of all queries.
202 -- Failure to make the correct updates will result in PLSQL giving an error
203 -- when the package body is re-created, so the error will be easily detected
204 -- without the need to run any test suite.
205 
206 -- The record is divided into three sections.  These correpond to
207 -- three krmk.h data structures which will be populated with the data
208 -- from this record.  Refer to krmk.h for a description of the purpose
209 -- of each of these three data strucutres.
210 
211 -- Think of this as:  the container acts on the object.
212 
213 ---------------------
214 -- Recovery Record --
215 ---------------------
216 
217 TYPE rcvRec_t IS RECORD
218 (
219    -- *** Recovery Container Section ***
220 
221    type_con             number,         -- recovery container type
222    key_con              number,         -- primary key
223    recid_con            number,         -- recid
224    stamp_con            number,         -- stamp
225    setStamp_con         number,         -- set count if backup set (null)
226    setCount_con         number,         -- set stamp if backup set (null)
227    bsRecid_con          number,         -- backup set recid (null)
228    bsStamp_con          number,         -- backup set stamp (null)
229    bsKey_con            number,         -- backup set key (null)
230    bsLevel_con          number,         -- backup set level (null)
231    bsType_con           varchar2(1),    -- backup set type
232    elapseSecs_con       number,         -- backup set elapse seconds (null)
233    pieceCount_con       number,         -- backup set piece count (null)
234    fileName_con         varchar2(1024), -- filename if a copy (or) piece (null)
235    tag_con              varchar2(32),   -- tag (null)
236                                         -- filled in by addAction() for
237                                         -- backup sets
238    copyNumber_con       number,         -- backup set copy# (null) maxlimit 256
239                                         -- filled in by addAction() only
240    status_con           varchar2(1),    -- status (null)
241    blocks_con           number,         -- size of file in blocks (null)
242    blockSize_con        number,         -- block size (null)
243    deviceType_con       varchar2(255),  -- device type required (null)
244                                         -- filled in by addAction() for
245                                         -- backup sets
246    compTime_con         date,           -- completion time
247    cfCreationTime_con   date,           -- controlfile creation time if
248                                         -- offline range (null)
249    pieceNumber_con      number,
250    bpCompTime_con       date,
251    bpCompressed_con     varchar2(3),
252 
253    multi_section_con    varchar2(1),    -- multi-section backup piece
254 
255    -- *** Recovery Action Section ***
256 
257    type_act             number,         -- recovery action type
258    fromSCN_act          number,
259    toSCN_act            number,
260    toTime_act           date,
261    rlgSCN_act           number,
262    rlgTime_act          date,
263    dbincKey_act         number,
264    level_act            number,
265    section_size_act     number,
266 
267    -- *** Recovery Object Section ***
268 
269    dfNumber_obj         number,
270    dfCreationSCN_obj    number,
271    cfSequence_obj       number,        -- controlfile autobackup sequence
272    cfDate_obj           date,          -- controlfile autobackup date
273    logSequence_obj      number,
274    logThread_obj        number,
275    logRlgSCN_obj        number,
276    logRlgTime_obj       date,
277    logLowSCN_obj        number,
278    logLowTime_obj       date,
279    logNextSCN_obj       number,
280    logNextTime_obj      date,
281    logTerminal_obj      varchar2(3),
282    cfType_obj           varchar2(1),   -- controlfile type ('B' or 'S')
283    pdbKey_obj           number,
284 
285    -- *** Retention Policy Section ***
286    keep_options         number,
287    keep_until           date,
288 
289    -- *** Optimization Action Section ***
290 
291    afzSCN_act           number,
292    rfzTime_act          date,
293    rfzSCN_act           number,
294 
295    -- *** media Action Section ***
296    media_con            varchar2(80),    -- media volume name for backup piece
297 
298    isrdf_con            varchar2(3),
299 
300    -- ** site specific information for recovery action ***
301    site_key_con         number,
302 
303    -- *** plugged Section ***
304    foreignDbid_obj      number,         -- foreign database id
305    pluggedRonly_obj     binary_integer, -- 1 for read-only. Otherwise, 0
306    pluginSCN_obj        number,         -- plugin change#
307    pluginRlgSCN_obj     number,         -- plugin resetlogs change#
308    pluginRlgTime_obj    date,           -- plugin resetlogs time
309 
310    -- ** sort order Section ***
311    newDfCreationSCN_obj number,         -- plugin scn or creation scn
312    newToSCN_act         number,         -- plugin scn or checkpoint scn
313    newRlgSCN_act        number,         -- plugin rlgscn or rlgscn
314    newRlgTime_act       date,           -- plugin rlgtime or rlgtime
315 
316    -- ** SPFILE specific data **
317    sfDbUniqueName_obj   varchar2(30)
318 );
319 
320 ------------------------------
321 -- Recovery Container Types --
322 ------------------------------
323 
324 --
325 -- NOTE!!! NOTE!!! NOTE!!!
326 --
327 -- You must never change these constants values between releases. Doing so
328 -- would break the compatibility by making lower version of RMAN executable
329 -- not able to talk to this recovery catalog. We have never changed these
330 -- constants from 8.1.5 onwards. See bug 893864 for details.
331 --
332 
333 -- NOTE:  Order is important, it is used in an ORDER BY.
334 
335 offlineRangeRec_con_t   CONSTANT NUMBER := 2**0;
336 proxyCopy_con_t         CONSTANT NUMBER := 2**1;
337 imageCopy_con_t         CONSTANT NUMBER := 2**2;
338 backupSet_con_t         CONSTANT NUMBER := 2**3;
339 addredo_con_t           CONSTANT NUMBER := 2**4;
343 
340 deleted_con_t           CONSTANT NUMBER := 2**8;
341 datafile_con_t          CONSTANT NUMBER := 2**9;
342 avmImageCopy_con_t      CONSTANT NUMBER := 2**10;
344 -- Masks
345 backupMask_con_t        CONSTANT NUMBER := proxyCopy_con_t + imageCopy_con_t +
346                                            backupSet_con_t;
347 tagMask_con_t           CONSTANT NUMBER := proxyCopy_con_t + imageCopy_con_t +
348                                            backupSet_con_t;
349 
350 ---------------------------
351 -- Recovery Action Types --
352 ---------------------------
353 
354 full_act_t              CONSTANT NUMBER := 2**0;
355 incremental_act_t       CONSTANT NUMBER := 2**1;
356 redo_act_t              CONSTANT NUMBER := 2**2;
357 offlineRange_act_t      CONSTANT NUMBER := 2**3;
358 cleanRange_act_t        CONSTANT NUMBER := 2**4;
359 implicitRange_act_t     CONSTANT NUMBER := 2**5;
360 spanningRange_act_t     CONSTANT NUMBER := 2**6;
361 createdatafile_act_t    CONSTANT NUMBER := 2**7;
362 
363 -----------------------------------------
364 -- Recovery Record Returning Functions --
365 -----------------------------------------
366 
367 -- These defines are used as the funCode arg to getRcvRec to tell it which
368 -- function it should call.  We do this so that krmk.pc can have a single
369 -- interface routine for getting a rcvRec_t.
370 
371 getCfCopy               CONSTANT NUMBER := 0;
372 getDfCopy               CONSTANT NUMBER := 1;
373 getAnyProxy             CONSTANT NUMBER := 2;
374 getCfBackup             CONSTANT NUMBER := 3;
375 listCfCopy              CONSTANT NUMBER := 4;
376 listDfCopy              CONSTANT NUMBER := 5;
377 listCfBackup            CONSTANT NUMBER := 6;
378 listDfBackup            CONSTANT NUMBER := 7;
379 listAlBackup            CONSTANT NUMBER := 8;
380 listDfProxy             CONSTANT NUMBER := 9;
381 getRecovAction          CONSTANT NUMBER := 10;
382 getAlBackup             CONSTANT NUMBER := 11;
383 listAlCopy              CONSTANT NUMBER := 12;
384 listBSet                CONSTANT NUMBER := 13;
385 getSfBackup             CONSTANT NUMBER := 14;
386 listSfBackup            CONSTANT NUMBER := 15;
387 getAllBSet              CONSTANT NUMBER := 16;
388 listAlProxy             CONSTANT NUMBER := 17;
389 getRangeAlBackup        CONSTANT NUMBER := 18;
390 
391 ------------------------
392 -- RMAN command types --
393 ------------------------
394 -- These defines are used as an interface to find out the command executed
395 -- by rman.
396 --
397 unknownCmd_t            CONSTANT BINARY_INTEGER := 0;
398 recoverCmd_t            CONSTANT BINARY_INTEGER := 1;
399 rcvCopyCmd_t            CONSTANT BINARY_INTEGER := 2;
400 obsoleteCmd_t           CONSTANT BINARY_INTEGER := 3;
401 restoreCmd_t            CONSTANT BINARY_INTEGER := 4;
402 blkRestoreCmd_t         CONSTANT BINARY_INTEGER := 5;
403 
404 ----------------------------------------
405 -- What to do when archiver is stuck? --
406 ----------------------------------------
407 -- Set this to 0 if you want to disable the behavior of using memory
408 -- sorting when archiver is stuck.
409 --
410 stuckMemorySize CONSTANT NUMBER := 50 * 1024 * 1024;
411 
412 -----------------------
413 -- Backup Set Record --
414 -----------------------
415 
416 TYPE bsRec_t IS RECORD
417 (
418    recid                number,
419    stamp                number,
420    key                  number,
421    setStamp             number,
422    setCount             number,
423    bsType               varchar2(1),
424    level                number,
425    elapseSecs           number,
426    compTime             date,
427    status               varchar2(1),
428    pieceCount           number,
429    keep_options         number,
430    keep_until           date,
431    multi_section        varchar2(1)
432 );
433 
434 ------------------------
435 -- Backup Piece Record --
436 -------------------------
437 
438 TYPE bpRec_t IS RECORD
439 (
440    recid                number,
441    stamp                number,
442    key                  number,
443    bskey                number,
444    setStamp             number,
445    setCount             number,
446    bsType               varchar2(1),
447    pieceNumber          number,
448    copyNumber           number,
449    status               varchar2(1),
450    compTime             date,
451    handle               varchar2(1024),
452    tag                  varchar2(32),
453    deviceType           varchar2(255),
454    media                varchar2(80),
455    bytes                number,
456    compressed           varchar2(3),
457    site_key             number,
458    vb_key               number,
459    am_access            varchar2(1), -- need for 12.0 compatibility
460    ba_access           varchar2(1)
461 );
462 
463 ---------------------------------
464 -- Backupset Validation Record --
465 ---------------------------------
466 
467 TYPE validBackupSetRec_t IS RECORD
468 (
469    deviceType   varchar2(255),
470    tag          varchar2(32),                   -- may be null
471    order1       number,                         -- preference hint
472    copyNumber   number,                         -- null if code 2 or 3
473    code         number                          -- 1 => same copy#
474                                                 -- 2 => mix of copy#s, but
478 
475                                                 --      same tag
476                                                 -- 3 => mix of copy#s and tags
477 );
479 bsRecCacheEnabled   constant boolean := TRUE;  -- FALSE to use pre10i method
480 bsRecCacheLowLimit  constant number  := 2048;  -- minimum cache size
481 bsRecCacheHighLimit constant number  := 32768; -- maximum cache size
482 
483 
484 TYPE incarnation_t IS RECORD
485 (
486 INCARNATION#                                       NUMBER,
487 RESETLOGS_CHANGE#                                  NUMBER,
488 RESETLOGS_TIME                                     DATE,
489 PRIOR_RESETLOGS_CHANGE#                            NUMBER,
490 PRIOR_RESETLOGS_TIME                               DATE,
491 STATUS                                             VARCHAR2(7),
492 RESETLOGS_ID                                       NUMBER,
493 PRIOR_INCARNATION#                                 NUMBER
494 );
495 
496 TYPE pdb_incarnation_t IS RECORD
497 (
498 CON_ID                                             NUMBER,
499 PDBINC_KEY                                         NUMBER,
500 INCSCN                                             NUMBER,
501 ERSCN                                              NUMBER,
502 STATUS                                             VARCHAR2(7)
503 );
504 
505 --------------------
506 -- backup history --
507 --------------------
508 TYPE bhistoryRec_t IS RECORD
509 (
510    dfNumber        number,
511    create_scn      number,
512    reset_scn       number,
513    reset_time      date,
514    ckp_scn         number,
515    ckp_time        date,
516    stop_scn        number,
517    logThread       number,
518    logSequence     number,
519    setStamp        number,
520    setCount        number,
521    compTime        date,
522    nbackups        number,
523    logTerminal     varchar2(3),
524    next_scn        number,
525    pluggedRonly    binary_integer, -- 1 for read-only. Otherwise, 0
526    pluginSCN       number,
527    pluginRlgSCN    number,
528    pluginRlgTime   date,
529    newcreate_scn   number,    -- create_scn or pluginSCN
530    newreset_scn    number,    -- reset_scn  or pluginRlgSCN
531    newreset_time   date       -- reset_time or pluginRlgTime
532 );
533 
534 ---------------
535 -- aged file --
536 ---------------
537 TYPE agedFileRec_t IS RECORD
538 (
539    type           number,
540    key            number,
541    stamp          number
542 );
543 
544 --------------------------------------------------------
545 -- List Backup Constants, Record and Global Varaibles --
546 --------------------------------------------------------
547 
548 -- Constants
549 -- NOTE: These constants are will be displayed in the RC_ view and will be
550 --       visible to the user.
551 backupset_txt      CONSTANT VARCHAR2(16) := 'BACKUP SET';
552 copy_txt           CONSTANT VARCHAR2(16) := 'COPY';
553 proxycopy_txt      CONSTANT VARCHAR2(16) := 'PROXY COPY';
554 datafile_txt       CONSTANT VARCHAR2(16) := 'DATAFILE';
555 spfile_txt         CONSTANT VARCHAR2(16) := 'SPFILE';
556 archivedlog_txt    CONSTANT VARCHAR2(16) := 'ARCHIVED LOG';
557 controlfile_txt    CONSTANT VARCHAR2(16) := 'CONTROLFILE';
558 piece_txt          CONSTANT VARCHAR2(16) := 'PIECE';
559 available_txt      CONSTANT VARCHAR2(16) := 'AVAILABLE';
560 unavailable_txt    CONSTANT VARCHAR2(16) := 'UNAVAILABLE';
561 expired_txt        CONSTANT VARCHAR2(16) := 'EXPIRED';
562 deleted_txt        CONSTANT VARCHAR2(16) := 'DELETED';
563 other_txt          CONSTANT VARCHAR2(16) := 'OTHER';
564 full_txt           CONSTANT VARCHAR2(16) := 'FULL';
565 incr1_txt          CONSTANT VARCHAR2(16) := 'INCR1';
566 incr2_txt          CONSTANT VARCHAR2(16) := 'INCR2';
567 incr3_txt          CONSTANT VARCHAR2(16) := 'INCR3';
568 incr4_txt          CONSTANT VARCHAR2(16) := 'INCR4';
569 incr_txt           CONSTANT VARCHAR2(16) := 'INCR';        -- level unknown
570 
571 -- The following record type is returned by the listBackup() function
572 -- NOTE: The name of variables in this structure are displayed in
573 --       the view V_$BACKUP_FILES. rc_lbRec_t structure is used to display
574 --       RC_BACKUP_FILES. So, remember to make change in rc_lbRec_t,
575 --       rc_lbRec_t_body and rc_listBackup() if you need to make new
576 --       columns visible to user.
577 --
578 TYPE lbRec_t IS RECORD
579 (
580    list_order1        NUMBER,       -- just hint to correctly order records
581 
582    list_order2        NUMBER,       -- just hint to correctly order records
583 
584    pkey               NUMBER,       -- primary key
585    --
586    -- row part
587    --
588    backup_type        VARCHAR2(32),  -- Type of the backup:
589                                      --  * 'BACKUP SET'
590                                      --  * 'COPY'
591                                      --  * 'PROXY COPY'
592 
593    --
594    -- file part
595    --
596    file_type           VARCHAR2(32), -- Type of the file:
597                                      --  * 'DATAFILE',
598                                      --  * 'CONTROLFILE'
599                                      --  * 'SPFILE'
600                                      --  * 'REDO LOG'
601                                      --  * 'PIECE'
602 
603    -- Common part.
604    -- This part is shared by rows returned from listBackup.
605    keep               VARCHAR2(3),
606    keep_until         DATE,
607    keep_options       VARCHAR2(13),
611                                       --  * 'EXPIRED'
608    status             VARCHAR2(16),   -- Status of the piece/copy:
609                                       --  * 'AVAIABLE'
610                                       --  * 'UNAVAIABLE'
612                                       --  * 'OTHER'
613    fname              VARCHAR2(1024), -- piece or copy name
614    tag                VARCHAR2(32),   -- piece or copy tag
615    media              VARCHAR2(80),
616    recid              NUMBER,
617    stamp              NUMBER,
618    device_type        VARCHAR2(255),
619    block_size         NUMBER,
620    completion_time    DATE,
621    is_rdf             VARCHAR2(3),
622    compressed         VARCHAR2(3),
623    obsolete           VARCHAR2(3),
624    keep_for_dbpitr    VARCHAR2(3),
625    bytes              NUMBER,
626 
627    -- BACKUP SET part.
628    -- Valid only when backup_type is 'BACKUP SET'.
629    bs_key                NUMBER,
630    bs_count              NUMBER,
631    bs_stamp              NUMBER,
632    bs_type               VARCHAR2(32), -- Type of the backup set:
633                                        --  * 'DATAFILE'
634                                        --  * 'ARCHIVED LOG'
635    bs_incr_type          VARCHAR2(32),
636    bs_pieces             NUMBER,
637    bs_copies             NUMBER,
638    bs_completion_time    DATE,
639    bs_status             VARCHAR2(16),   -- Status of the backup set:
640                                          --  * 'AVAIABLE'
641                                          --  * 'UNAVAIABLE'
642                                          --  * 'EXPIRED'
643                                          --  * 'OTHER'
644    bs_bytes              NUMBER,
645    bs_compressed         VARCHAR2(3),    -- If backup set is compressed:
646                                          --  * 'YES'
647                                          --  * 'NO'
648                                          --  * 'OTHER'
649 
650    bs_tag                VARCHAR2(1024), -- List of all tags of pieces.
651                                          -- We don't repeate same tags. Tags
652                                          -- divided by commas.
653 
654    bs_device_type        VARCHAR2(255),  -- List of device types of pieces.
655                                          -- Device types are divided by commas.
656 
657    -- BACKUP PIECE part.
658    -- Valid only when file_type is 'PIECE' and backup_type is 'BACKUP SET'.
659    bp_piece#             NUMBER,
660    bp_copy#              NUMBER,
661    bp_vb_key             NUMBER,
662    bp_ba_access          VARCHAR2(1),
663    bp_lib_key            NUMBER,
664 
665    -- DATAFILE part.
666    -- Valid only when file_type is 'DATAFILE', 'CONTROLFILE', or 'SPFILE'.
667    df_file#                  NUMBER,
668    df_ts#                    NUMBER,
669    df_plugin_change#         NUMBER,
670    df_foreign_dbid           NUMBER,
671    df_tablespace             VARCHAR2(30),
672    df_resetlogs_change#      NUMBER,
673    df_creation_change#       NUMBER,
674    df_checkpoint_change#     NUMBER,
675    df_ckp_mod_time           DATE,
676    df_incremental_change#    NUMBER,
677 
678    -- REDO LOG part.
679    -- This part is valid only when file_type is 'REDO LOG'.
680    rl_thread#            NUMBER,
681    rl_sequence#          NUMBER,
682    rl_resetlogs_change#  NUMBER,
683    rl_first_change#      NUMBER,
684    rl_first_time         DATE,
685    rl_next_change#       NUMBER,
686    rl_next_time          DATE,
687 
688    -- SPFILE part
689    sf_db_unique_name     VARCHAR2(30),
690 
691    -- CDB container id
692    con_id                NUMBER
693 );
694 
695 -- This record keeps a datafile information for listBackup function.
696 -- In addition to normal datafile record, it contains various keepscn
697 -- information.
698 TYPE lbDfRec_t IS RECORD
699 (
700    dfRec                dfRec_t,
701    -- This is the minimum checkpoint_change# of the backup that are kept
702    -- for retention policy and its corresponding resetlogs_change#.
703    -- A full backup of this datafile is kept if its checkpoint_change# is
704    -- greater than fullmin_scn and its resetlogs_change# is greater
705    -- that fullmin_scn or equal to fullmin_rlgscn.
706    fullmin_scn           NUMBER,
707    fullmin_rlgscn        NUMBER,
708 
709    -- This is the minimum checkpoint_change# of the backup that are kept
710    -- for retention policy and its corresponding resetlogs_change#.
711    -- A incremental backup of this datafile is kept if its checkpoint_change#
712    -- is greater than incrmin_scn and its resetlogs_change# is greater
713    -- than incrmin_scn or equal to incrmin_rlgscn.
714    incrmin_scn           NUMBER,
715    incrmin_rlgscn        NUMBER,
716 
717    -- This is the minimum checkpoint_change# of its backup that are kept
718    -- for archived logs attribute and its corresponding resetlogs_change#.
719    -- All archivelogs and its backups are kept if its first_change# is
720    -- greater than the logmin_scn and its resetlogs_change# is greater
721    -- thatn logmin_scn or equal to logmin_rlgscn.
722    logmin_scn            NUMBER,
723    logmin_rlgscn         NUMBER
724 );
725 
726 TYPE lbDfRecTab_t  IS TABLE     OF lbDfRec_t      INDEX BY BINARY_INTEGER;
727 TYPE lbRecTab_t    IS TABLE     OF lbRec_t        INDEX BY BINARY_INTEGER;
728 TYPE lbRecVar_t    IS VARRAY(1) OF lbRec_t;
729 TYPE rcvRecTabI_t  IS TABLE     OF rcvRec_t       INDEX BY BINARY_INTEGER;
733 TYPE lbCursor_t    IS REF                         CURSOR;
730 TYPE rcvRecTabII_t IS TABLE     OF rcvRecTabI_t   INDEX BY BINARY_INTEGER;
731 TYPE dfRecTab_t    IS TABLE     OF dfRec_t        INDEX BY BINARY_INTEGER;
732 TYPE numTab_t      IS TABLE     OF number         INDEX BY BINARY_INTEGER;
734 
735 -----------------------------------------------------------------------------
736 -- The following structire is used by the function listBackup.
737 -- The variables in the strcuture are initialized when listBackup is called
738 -- with firstCall=TRUE.
739 -----------------------------------------------------------------------------
740 TYPE lbState_t   IS RECORD
741   (
742    -- The collection table lbRecOutTab keeps track of the rows which should
743    -- returned by the function listBackup. The function listBackup will loop
744    -- until it does not fill lbRecOutTab with at least one element.
745    lbRecOutTab        lbRecTab_t,
746    lbRecOutTab_count  binary_integer,
747 
748    -- The collection table lbRecTmpTab keeps track of the backup datafiles and
749    -- backup archived log rows which are part of the backup set.
750    lbRecTmpTab        lbRecTab_t,
751 
752    -- The collection lbRecCmn keeps track of the backup set attributes.
753    lbRecCmn           lbRec_t,
754 
755    -- The collection table lbDfRecTab contains the list of all database files
756    -- which ever existed after untilSCN.
757    lbDfRecTabUs       lbDfRecTab_t,
758 
759    -- The collection table lbDfRecTab contains the list of all database files
760    -- which ever existed.
761    lbDfRecTab         dfRecTab_t,
762 
763    -- This variable hols the maximum number of the datafile. It is used for
764    -- indextin of lbDfRecTab.
765    lbMaxDfNumber      number,
766 
767    -- For keep backups we need to know the current time.
768    lbNowTime          date,
769 
770    -- The table piece_count stores number of pieces in each copy. The variable
771    -- copy_count says how many copies we have.
772    lbPieceCountTab    numTab_t,
773    lbCopyCount        binary_integer,
774 
775    -- Must Keep List is a table of rcvRecTabI_t indexed by binary_integer
776    -- which itself is a table of rcvRec_t
777    lbMkTab            rcvRecTabII_t,
778 
779    -- Must Keep Incremental List is a table of rcvRecTabI_t indexed by
780    -- binary_integer which itself is a table of rcvRec_t
781    lbMkITab           rcvRecTabII_t,
782 
783    -- The variable lbMinGrsp stands for minimum guaranteed restore point.
784    -- An archived log backup set is obsolete if all rl_first_change#
785    -- in the backup set is less than lbMinGrsp. No resetlogs information
786    -- is compared. The redo log copies DOES NOT FOLLOW this rule. We
787    -- keep the redo log copies only if needed by guaranteed restore point.
788    -- The idea of keeping the backupset of redo log since the oldest GRP is
789    -- to flashback to GRP2 from GRP1 (where GRP2 > GRP1) because it
790    -- will require archivelogs outside the range listed by grsp table
791    -- (from_scn - to_scn column).
792    lbMinGrsp         number,
793 
794    -- The variable lbFbUntilTime stands for Flashback Until Time.
795    -- An archived log backup set is obsolete if all rl_first_time in the
796    -- backup set is less than lbFbUntilTime. No resetlogs information is
797    -- compared. The redo log copies (that is archived logs and proxy
798    -- copies) follow the same rule.
799    lbFbUntilTime     date,
800 
801    -- The variable lbRlKeepRlgSCN is the resetlogs_change# associated with
802    -- the lbRlKeepSCN. It is used in conjunction with lbRlKeepSCN to
803    -- decide an obsolete archived log. When NULL, the resetlogs_change#
804    -- is unknown.
805    lbRlKeepRlgSCN     number,
806 
807    -- The variable lbRlKeepSCN says that archived log backup set is
808    -- obsolete if the rl_first_change# in the backup set is less than
809    -- lbRlKeepSCN and its resetlogs_change# greater than lbRlKeepSCN and
810    -- equal to lbRlKeepRlgSCN.
811    -- The redo logs copies (that is archived logs and proxy copies)
812    -- follow the same rule.
813    lbRlKeepSCN        number,
814 
815    -- If either lbObsoleteRetention or lbObsoleteKeep is set to TRUE when the
816    -- current backup processed by listBackup is obsolete.
817    -- If lbObsoleteRetention is TRUE, then the backup is obsolete because of
818    -- retention policy. If lbObsoleteKeep is TRUE, then the backup is obsolete
819    -- because of its keep attributes.
820    lbObsoleteRetention boolean,
821    lbKeepForDBPITR     boolean,
822    lbObsoleteKeep      boolean,
823 
824    lbNeedObsoleteData  boolean
825  );
826 
827 -- In case that listBackup is not called from pipeline function, then
828 -- there is no need for the called to save and maintain the state:  the
829 -- function will use state from the package.
830 lbStatePck   lbState_t;
831 
832 ---------------------------------------------------------------------------
833 -- End of global variable used by the function listBackup.
834 ---------------------------------------------------------------------------
835 
836 -----------------------------------------------------------------------------
837 -- The following structure is used by the function getRestoreRange.
838 -- startTime and endTime is the starting time and the ending time of restore
839 -- range respectively.
840 -- fromScn and toScn are the lowest and highest scn of the restore range
841 -- respectively.
845 TYPE restoreRange_t IS RECORD
842 -- isValidRange indicates whether it is a valid restore range
843 -----------------------------------------------------------------------------
844 
846 (
847    lowTime       DATE,
848    highTime      DATE,
849    startScn      NUMBER,
850    lowScn        NUMBER,
851    highScn       NUMBER,
852    lowDbIncKey   NUMBER,
853    highDbIncKey  NUMBER,
854    lowRlgScn     NUMBER,
855    highRlgScn    NUMBER,
856    lowRlgTime    DATE,
857    highRlgTime   DATE,
858    rcvStartScn   NUMBER,
859    rcvStartTime  DATE,
860    isValidRange  BOOLEAN,
861    cfBkupFound   BOOLEAN,
862    con_id        NUMBER
863 );
864 
865 TYPE restoreRangeTab_t IS TABLE OF restoreRange_t INDEX BY BINARY_INTEGER;
866 
867 -- Intelligent Repair variables
868 
869 TYPE failureRec_t IS RECORD
870 (
871    priority      VARCHAR2(8),
872    failureId     NUMBER,
873    parentId      NUMBER,
874    childCount    NUMBER,
875    description   VARCHAR2(1024),
876    timeDetected  DATE,
877    status        VARCHAR2(12),
878    impacts       VARCHAR2(1024)
879 );
880 
881 TYPE repairRec_t IS RECORD
882 (
883    type          NUMBER,
884    failureidx    NUMBER,
885    repairidx     NUMBER,
886    description   VARCHAR2(1024)
887 );
888 
889 TYPE repairParmsRec_t IS RECORD
890 (
891    type          NUMBER,
892    failureidx    NUMBER,
893    repairidx     NUMBER,
894    name          VARCHAR2(256),
895    value         VARCHAR2(512)
896 );
897 
898 TYPE repairOptionRec_t IS RECORD
899 (
900    optionidx     NUMBER,
901    description   VARCHAR2(1024)
902 );
903 
904 TYPE repairStepRec_t IS RECORD
905 (
906    type           NUMBER,
907    failureidx     NUMBER,
908    repairidx      NUMBER,
909    repairstepidx  NUMBER,
910    workingrepair  NUMBER,
911    description    VARCHAR2(1024),
912    repairscript   VARCHAR2(1024)
913 );
914 
915 ----------------------
916 -- Pluggable DB Record
917 ----------------------
918 TYPE pdbNameRec_t IS RECORD
919 (
920    pdbId    NUMBER,
921    name     VARCHAR2(30)
922 );
923 
924 TYPE pdbFileRec_t IS RECORD
925 (
926    pdbId    NUMBER,
927    file#    NUMBER,
928    stopSCN  NUMBER
929 );
930 
931 cdbRoot_txt  CONSTANT VARCHAR2(8) := 'CDB$ROOT';
932 
933 -----------------------------------------------------
934 -- PUBLIC FUNCTION/PROCEDURE SPECIFICATION SECTION --
935 -----------------------------------------------------
936 
937 ----------------------------------------
938 -- Debugging functions and procedures --
939 ----------------------------------------
940 
941 FUNCTION dumpState(
942    lineno IN number)
943 RETURN varchar2;
944 
945 PROCEDURE dumpPkgState(msg in varchar2 default null);
946 
947 PROCEDURE setDebugOn;
948 
949 PROCEDURE setDebugOff;
950 
951 ----------------------------
952 -- Package Initialization --
953 ----------------------------
954 -- This is a vestigal function that was released to customers in 8.1.3 Beta.
955 -- It is no longer called, and is no longer needed, but must still be here
956 -- because this version of the package may be called by an 8.1.3 rman
957 -- executable.
958 
959 PROCEDURE initialize(rman_vsn IN number);
960 
961 -- Used by 8.1.5 to re-assign the order of the backup_type constants to their
962 -- correct order.  This procedure is not called by 8.1.4-, so the constants
963 -- will reamin set to the above values for those executables.
964 
965 PROCEDURE set_package_constants;
966 
967 -----------------------
968 -- Utility functions --
969 -----------------------
970 
971 FUNCTION stamp2date(stamp IN number) RETURN date;
972 
973 ------------------------------------
974 -- Get Current Database Incarnation
975 ------------------------------------
976 PROCEDURE getCurrentIncarnation(
977    db_id          IN  number
978   ,reset_scn      OUT number
979   ,reset_time     OUT date);
980 
981 ------------------------------
982 -- Set Database Incarnation --
983 ------------------------------
984 
985 -- setDatabase selects which target database subsequent dbms_rcvman
986 -- procedures operate on. Note that only the current incarnation can be
987 -- selected. If the target database or its current incarnation is not
988 -- registered then setDatabase will fail.
989 -- setDatabase sets the package state variables to point to the selected
990 -- database and its current incarnation.
991 -- The settings will be valid until the end of the session unless setDatabase
992 -- is called again
993 
994 -- When dbms_rcvman package executes against the target database controlfile,
995 -- setDatabase just returns without doing anything.
996 
997 -- Input parameters:
998 --   db_id
999 --     the value of kccfhdbi from the controlfile of the target database
1000 --   db_name
1001 --     the name of the database
1002 --   reset_scn
1003 --     the resetlogs SCN of this database
1004 --   reset_time
1005 --     the resetlogs time
1006 -- Exceptions:
1007 --   DATABASE_NOT_FOUND (ORA-20001)
1008 --     No database with the given db_id was found in the recovery catalog
1012 --     The database incarnation must be registered using resetDatabase first
1009 --     The database must be registered using registerDatabase first
1010 --   DATABASE_INCARNATION_NOT_FOUND (ORA-20003)
1011 --     No database incarnation matches the given arguments
1013 
1014 PROCEDURE setDatabase(
1015    db_name    IN varchar2
1016   ,reset_scn  IN number
1017   ,reset_time IN date
1018   ,db_id      IN number
1019   ,db_unique_name IN varchar2 default NULL
1020   ,site_aware IN boolean default FALSE
1021   ,dummy_instance  IN boolean default FALSE
1022   ,ors_instance    IN boolean default FALSE);
1023 
1024 -- Return the db_unique_name associated with the db_id if there is one
1025 -- db_unique_name. If there is more than one db_unique_name, then raise
1026 -- too_many_rows error. If there is no row, then return NULL.
1027 FUNCTION getDbUniqueName(
1028    db_id      IN number)
1029 RETURN varchar2;
1030 
1031 -- Return the db_key of a database if it is set
1032 FUNCTION getDbKey RETURN NUMBER;
1033 
1034 -- Return minrcvstartScn
1035 FUNCTION getMinRcvStartScn RETURN NUMBER;
1036 
1037 -- Resets this_db_key
1038 PROCEDURE resetDbKey;
1039 
1040 -- Return TRUE if the database site identified by current db_unique_name
1041 -- is standby
1042 FUNCTION DbUniqueNameIsStandby
1043 RETURN NUMBER;
1044 
1045 -- setCanConvertCf used to tell that client is capable of control file
1046 -- conversion
1047 PROCEDURE setCanConvertCf(flag IN boolean);
1048 
1049 -- setDbincKey used in lieu of setDatabase for when SET DBID command is
1050 -- issued.
1051 PROCEDURE setDbincKey(
1052    key IN number);
1053 
1054 -- getParent Incarnation returns the parent incarnation.  If resetlogs_change#
1055 -- is NULL on input, then the current incarnation is returned.  Returns TRUE
1056 -- if a row was returned, otherwise returns FALSE.
1057 
1058 FUNCTION getParentIncarnation(
1059    resetlogs_change# IN OUT number
1060   ,resetlogs_time    IN OUT date)
1061 RETURN number;
1062 
1063 -- getCheckpoint gets and returns the highest recovery catalog checkpoint SCN
1064 -- for FULL checkpoints.  This SCN indicates how current the datafilenames and
1065 -- lognames in the recovery catalog are.  This SCN can be compared with a
1066 -- backup controlfile SCN to decide which name to use if they differ.
1067 
1068 PROCEDURE getCheckpoint(
1069    scn OUT number
1070   ,seq OUT number);
1071 
1072 -- This version of getCheckpoint is only used internally by
1073 -- dbms_rcvcat.cleanupCKP, to find out which rows can't be deleted from ckp.
1074 
1075 PROCEDURE getCheckpoint(
1076    scn       OUT number
1077   ,seq       OUT number
1078   ,ckp_key_1 OUT number
1079   ,ckp_key_2 OUT number);
1080 
1081 -- This procedure sets the package variables to return all logs not
1082 -- backed ntimes to specific device type until sbpscn (standby became primary
1083 -- SCN) ignore needstby flag for the subsequent archivelog translations.
1084 PROCEDURE SetGetSinceLastBackedAL(ntimes  IN number DEFAULT 1,
1085                                   devtype IN varchar2 DEFAULT NULL,
1086                                   sbpscn  IN number);
1087 
1088 -------------------
1089 -- Query Filters --
1090 -------------------
1091 
1092 -- setCompletedRange sets completedBefore and/or completedAfter filters for
1093 -- use by computeRecoveryActions.
1094 -- setLikePattern sets fileName patter for computeRecoveryActions.
1095 --
1096 -- setUntilTime, setUntilScn, setUntilLog, setToLog, setUntilResetlogs,
1097 -- resetUntil.
1098 -- These procedures are used to inform dbms_rcvman of an until_clause.
1099 -- The setUntil remains in effect until another setUntil has been called,
1100 -- or until resetUntil has been called.
1101 -- If none of these have been called, then all queries for name
1102 -- translation, restore, and recovery should assume that a complete recovery
1103 -- is being done.  Otherwise, all restore and recovery queries should limit
1104 -- their replies to backup sets and datafile copies that are appropriate for
1105 -- use in an incomplete recovery until the specified until condition.  Name
1106 -- translations should be done relative to the specified epoch.
1107 --
1108 -- "appropriate" means that the fuzziness of the backup datafile or datafile
1109 -- copy ends at an SCN less than the untilChange SCN (for untilChange), or the
1110 -- low SCN of the specified log (for untilLog), or the fuzziness timestamp is
1111 -- less than the specified time (for unttime).  Note that datafiles have three
1112 -- kinds of fuzziness, all of which must be less than the specified SCN or
1113 -- time.  If the fuzziness of a datafile is unknown, then it should be
1114 -- ignored.
1115 --
1116 -- The setUntil procedures will signal an error when executed against
1117 -- the target database controlfile. The resetUntil procedure can be
1118 -- executed against the controlfile, it but doesn't have any effect.
1119 
1120 -- Input parameters:
1121 --   unttime
1122 --     The incomplete recovery will stop when this timestamp is reached
1123 --     in the redo log.
1124 --   scn
1125 --     The incomplete recovery will stop when this scn is reached in the redo
1126 --     log.
1127 --   sequence#, thread#
1128 --     The incomplete recovery will stop when this log becomes the very next
1129 --     log to be applied.
1130 --
1131 -- Exceptions:
1132 --   NO_RECOVERY_CATALOG (ORA-20300)
1133 --     this operation is not supported without the recovery catalog
1137 --     No log with the give thread# and sequence# was found
1134 --   SEQUENCE_IS_NULL (ORA-20205)
1135 --     A null log sequence# was given
1136 --   LOG_MISSING (ORA-20206)
1138 
1139 PROCEDURE setCompletedRange(
1140    after  IN date
1141   ,before IN date);
1142 
1143 PROCEDURE setLikePattern(
1144    pattern IN varchar2);
1145 
1146 PROCEDURE setcanApplyAnyRedo(
1147    flag IN boolean);
1148 
1149 -- Obsolete as of 8.1.6
1150 PROCEDURE setAllFlag(
1151    flag IN boolean);
1152 
1153 PROCEDURE setAllIncarnations(
1154    flag IN boolean);
1155 
1156 PROCEDURE setUntilTime(
1157    unttime IN date);
1158 
1159 -- If rlgscn, rlgtime is not provided, then the provided scn belongs to
1160 -- current or one of its parent. Otherwise, it should belong to the given
1161 -- rlgscn and lrgtime.
1162 -- If flbrp (flashback to restore point) is TRUE, then allow scn to be
1163 -- in orphan branch. Otherwise, we force scn be in one of its parent or
1164 -- current branch.
1165 PROCEDURE setUntilScn(
1166    scn     IN number
1167   ,rlgscn  IN number  DEFAULT NULL
1168   ,rlgtime IN date    DEFAULT NULL
1169   ,flbrp   IN boolean DEFAULT FALSE
1170   ,rpoint  IN boolean DEFAULT FALSE);
1171 
1172 PROCEDURE setUntilLog(
1173    sequence# IN number
1174   ,thread#   IN number);
1175 
1176 PROCEDURE setToLog(
1177    sequence# IN number
1178   ,thread#   IN number);
1179 
1180 PROCEDURE setGuid(guid IN varchar2 DEFAULT NULL);
1181 
1182 PROCEDURE setUntilResetlogs;
1183 
1184 FUNCTION getUntilTime return date;
1185 
1186 FUNCTION getUntilScn return number;
1187 
1188 PROCEDURE resetUntil;
1189 
1190 -- setFrom is used to limit the potential restore candidates to either
1191 -- backup sets or datafile copies, or to allow either kind of file to
1192 -- be used.
1193 --
1194 -- Input parameters:
1195 --   restorefrom
1196 --     One of BACKUP, COPY, or NULL.
1197 
1198 PROCEDURE setFrom(
1199    restorefrom IN number DEFAULT NULL);
1200 
1201 -- setDeviceType specifies the type of an allocated device.  It is called 1 or
1202 -- more (up to 8) times , depending on the number of different device types
1203 -- that are allocated.  dbms_rcvman should return only files that can be
1204 -- accessed through one of the device types specifed through this call.
1205 --
1206 -- Input parameters:
1207 --   type
1208 --     type of the device
1209 -- Exceptions:
1210 --   NULL_DEVICE_TYPE
1211 --     A null device type was specied
1212 --   TOO_MANY_DEVICE_TYPES
1213 --     At most 8 device types can be specified
1214 
1215 PROCEDURE setDeviceType(
1216    type IN varchar2);
1217 
1218 -- setDeviceTypeAny is an alternative to setDeviceType.  It causes dbms_rcvman
1219 -- to return a backup set on ANY device type.
1220 
1221 PROCEDURE setStandby(
1222    stby IN boolean);
1223 
1224 PROCEDURE setDeviceTypeAny;
1225 
1226 -- resetDeviceType resets the list of device types to null.
1227 
1228 PROCEDURE resetDeviceType;
1229 
1230 -- setTag is used to limit the restore candidates to backups and copies with
1231 -- the given tag. If the tag is NULL then all backups and copies are searched
1232 -- by the find functions. This tag is also used by report/delete obsolete
1233 -- functions to restrict what backups to consider and what backups to filter
1234 -- for backup optimization.
1235 --
1236 -- Input parameters:
1237 --   tag
1238 --     tag of the datafile copies/backup sets to be translated
1239 --     The tag must be passed in uppercase ### ok?
1240 --   use_like
1241 --     input tag parameter to be used similar to LIKE semantics in SQL
1242 
1243 PROCEDURE setTag(tag IN varchar2 DEFAULT NULL, use_like IN number DEFAULT 0);
1244 
1245 -- setRecoveryDestFile is used to limit the translation only to recovery
1246 -- area files.
1247 --
1248 -- Input parameters:
1249 --   onlyrdf
1250 --      TRUE  - only recovery area files
1251 --      FALSE - all files
1252 
1253 PROCEDURE setRecoveryDestFile(onlyrdf IN BOOLEAN);
1254 
1255 -- setOrsFile is used to limit the translation only to ORS managed files.
1256 --
1257 -- Input parameters:
1258 --   localOnly
1259 --      TRUE  - only files on local ORS storage
1260 --      FALSE - only files managed by ORS locally or SBT storage
1261 --      NULL  - turn off ORS limitting
1262 --   libKey   - only files on ORS SBT storage with this library key
1263 --      NULL  - turn off ORS limitting
1264 PROCEDURE setOrsFile(localOnly IN BOOLEAN, libKey IN NUMBER);
1265 
1266 -- Set a site name in catalog -- all the translation will happen against this
1267 -- site. The package variable will be cleared after translation.
1268 -- If for_realfiles parameter is non-zero, then the translation for files
1269 -- in working area (datafile/onlinelogs/tempfiles) are done against
1270 -- the requested site.
1271 PROCEDURE setSiteName(db_unique_name IN VARCHAR2, for_realfiles IN NUMBER);
1272 
1273 -- Clear package variables set by setSiteName procedure
1274 PROCEDURE clrSiteName;
1275 
1276 -- get site name for given site_key
1277 FUNCTION getSiteName(site_key IN NUMBER) RETURN VARCHAR2;
1278 
1279 -- get site key for given db_unique_name
1280 FUNCTION getSiteKey(db_unique_name IN VARCHAR2) RETURN NUMBER;
1281 
1282 -- set Archive log file sharing scope attributes for the session
1283 PROCEDURE setArchiveFileScopeAttributes(logs_shared IN NUMBER);
1287 
1284 
1285 -- set First Full Backup file sharing scope attributes for the session
1286 PROCEDURE setFirstFullBckScopeAttributes(baseline_cap IN NUMBER);
1288 -- set Backup file sharing scope attributes for the session
1289 PROCEDURE setBackupFileScopeAttributes(
1290                  disk_backups_shared IN NUMBER,
1291                  tape_backups_shared IN NUMBER);
1292 
1293 -- resetAll calls resetUntil, setFrom, resetDevice and setTag to reset
1294 -- everything.
1295 
1296 PROCEDURE resetAll(transclause IN BOOLEAN DEFAULT TRUE);
1297 
1298 ---------------------------
1299 -- Backup Set Validation --
1300 ---------------------------
1301 
1302 -- Use the findValidBackupSetRec public variable to save a backupset record
1303 -- for later use as an input argument to this procedure.
1304 
1305 findValidBackupSetRcvRec rcvRec_t;              -- place to save a rcvRec_t
1306 
1307 PROCEDURE findValidBackupSet(
1308    backupSetRec            IN     rcvRec_t
1309   ,deviceType              IN     varchar2       DEFAULT NULL
1310   ,tag                     IN     varchar2       DEFAULT NULL
1311   ,available               IN     number         DEFAULT TRUE#  -- for compat.
1312   ,unavailable             IN     number         DEFAULT FALSE# -- for compat.
1313   ,deleted                 IN     number         DEFAULT FALSE# -- for compat.
1314   ,expired                 IN     number         DEFAULT FALSE# -- for compat.
1315   ,availableMask           IN     binary_integer DEFAULT NULL); -- for compat.
1316 
1317 findValidBackupSetBsRec  bsRec_t;               -- place to save a bsRec_t
1318 
1319 -- Obsolete as of 8.1.7
1320 PROCEDURE findValidBackupSet(
1321    backupSetRec            IN     bsRec_t
1322   ,deviceType              IN     varchar2       DEFAULT NULL
1323   ,tag                     IN     varchar2       DEFAULT NULL
1324   ,available               IN     number         DEFAULT TRUE#  -- for compat.
1325   ,unavailable             IN     number         DEFAULT FALSE# -- for compat.
1326   ,deleted                 IN     number         DEFAULT FALSE# -- for compat.
1327   ,expired                 IN     number         DEFAULT FALSE# -- for compat.
1328   ,availableMask           IN     binary_integer DEFAULT NULL); -- for compat.
1329 
1330 FUNCTION getValidBackupSet(
1331    validBackupSetRec            OUT NOCOPY validBackupSetRec_t
1332   ,checkDeviceIsAllocated       IN  number DEFAULT FALSE#)
1333 RETURN number;                                  -- TRUE# -> got a record
1334                                                 -- FALSE# -> no_data_found
1335 
1336 ---------------------
1337 -- Get an rcvRec_t --
1338 ---------------------
1339 
1340 -- This function is a cover function for all procedures/functions that
1341 -- return a rcvRec_t.  It routes the call to the correct procedure.  It
1342 -- is provided for the convienence of krmk.pc.  The function return value
1343 -- is whatever the underlying function returns.  If we call a procedure,
1344 -- then getRcvRec returns 0.  Refer to the funCode list above in the
1345 -- types/variables section.
1346 
1347 FUNCTION getRcvRec(
1348    funCode      IN number
1349   ,rcvRec       OUT NOCOPY rcvRec_t
1350   ,callAgain    OUT number)
1351 RETURN number;
1352 
1353 --------------------------
1354 -- Datafile Translation --
1355 --------------------------
1356 
1357 -- translateTableSpace translates a tablespace name into a list of datafile
1358 -- numbers.  translateDataBase translates the database into a list of datafile
1359 -- numbers in the database excluding datafiles belonging to tablespaces
1360 -- specified using skipTableSpace.  The translation is performed relative to
1361 -- epoch setting currently in use.  getDataFile is used to obtain the datafile
1362 -- numbers, one at a time until null is returned.
1363 
1364 -- When doing the translation relative to current time the client should
1365 -- ensure that recovery catalog is up-to-date. When doing translations
1366 -- relative to an point-in-time in the past two potential anomalies may
1367 -- show up.
1368 --
1369 -- 1) files belonging to a tablespace that was dropped before the point-in-time
1370 -- may be returned since the drop_scn and drop_time are approximations.
1371 -- As a result of this point-in-time recovery will restore and recover
1372 -- a tablespace which will be dropped before the database is opened.
1373 -- No real harm, just extra work for the recovery. And this won't happen
1374 -- if rcvcat is resynced immediatly after dropping a tablespace.
1375 -- 2) A tablespace which is created and dropped between two consecutive
1376 -- recovery catalog resyncs will never be recorded in the rcvcat. It is
1377 -- conceivable that such a tablespace existed at the intended point-in-time.
1378 -- As a result the tablespace will not be recovered and must be dropped
1379 -- after the database is opened. The worst case scenario is that a rollback
1380 -- segment was also created in this tablespace. The recovered database
1381 -- might fail to rollback some transactions. Again, this won't happen if
1382 -- rcvcat is always resynced after creating a tablespace.
1383 -- PS. These anomalies won't occur if the point-in-time is chosen to be
1384 -- a rcvcat checkpoint.
1385 
1386 -- Input parameters:
1387 --   ts_name
1388 --     name of the tablespace to be translated or skipped.
1389 --     The name must be in uppercase
1390 -- Exceptions:
1391 --   TABLESPACE_DOES_NOT_EXIST (ORA-20202)
1392 --     the tablespace to be translated does not exists (does not have any
1396 --     To terminate get all datafiles with getDataFile.
1393 --     datafiles). Check that the recovery catalog is current.
1394 --   TRANSLATION_IN_PROGRESS (ORA-20203)
1395 --     the previous translation conversation is still in progess.
1397 --   TRANSLATION_NOT_IN_PROGRESS (ORA-20204)
1398 --     getDataFile was called with no translation in progress
1399 
1400 PROCEDURE translateDatabase(
1401    sinceUntilSCN IN number DEFAULT NULL);
1402 
1403 PROCEDURE skipTableSpace(
1404    tsName  IN varchar2
1405   ,pdbId   IN number DEFAULT 0);
1406 
1407 PROCEDURE translateTablespace(
1408    ts_name IN varchar2, pdb_id IN number DEFAULT 0);
1409 
1410 -- translateDataFile translates the datafile name/number into
1411 -- a datafile number and creation SCN and filename.  getDataFile must
1412 -- be called to obtain the translation info, just as for the other translate
1413 -- functions.
1414 -- Unlike the other translation functions, translateDatafile by name is always
1415 -- performed relative to current time.  If an until setting is in effect,
1416 -- and if the filename is ambiguous, then an exception is raised.  Ambiguous
1417 -- means that the filename refers to different datafile at the until time than
1418 -- it does at the current time.  This happens only when a filename has been
1419 -- reused.  When fno and ckpscn are passed, the filename and other info as of
1420 -- that scn is returned.
1421 
1422 -- Input parameters:
1423 --   fname
1424 --     name of the datafile to be translated.
1425 --     The name must be a normalized filename.
1426 --   fno
1427 --     The datafile number.  If the datafile number was not in use at the
1428 --     until time, then an exception is raised.
1429 -- Exceptions:
1430 --   DATAFILE_DOES_NOT_EXIST (ORA-20201)
1431 --     the datafile to be translated does not exists
1432 --     Check that the recovery catalog is current.
1433 
1434 PROCEDURE translateDataFile(
1435    fname IN varchar2);
1436 
1437 PROCEDURE translateDatafile(
1438    fno   IN number);
1439 
1440 PROCEDURE translateDatafile(
1441    fno    IN number
1442   ,ckpscn IN number);
1443 
1444 -- translateAllDatafile returns a list of all datafiles that ever
1445 -- existed in this database.
1446 
1447 PROCEDURE translateAllDatafile;
1448 
1449 PROCEDURE translateCorruptList;
1450 
1451 PROCEDURE getDatafile(
1452    dfRec     OUT NOCOPY dfRec_t
1453   ,oldClient IN  boolean DEFAULT FALSE);
1454 
1455 -- Obsolete as of 8.1.6
1456 PROCEDURE getDataFile(
1457    file#        OUT number
1458   ,crescn       OUT number
1459   ,creation_time OUT date
1460   ,fname        OUT varchar2
1461   ,ts_name      OUT varchar2
1462   ,status       OUT number
1463   ,blksize      OUT number
1464   ,kbytes       OUT number
1465   ,blocks       OUT number
1466   ,unrecoverable_change# OUT number
1467   ,stop_change# OUT number
1468   ,read_only    OUT number);
1469 
1470 --------------------------
1471 -- Tempfile Translation --
1472 --------------------------
1473 -- translateTempfile translates tempfiles known to database in current
1474 -- incarnation.
1475 PROCEDURE translateTempfile;
1476 
1477 PROCEDURE translateTempfile(fname IN varchar2);
1478 
1479 PROCEDURE translateTempfile(fno IN number);
1480 
1481 -- Fetch the cursor opened by translateTempfiles and return a row one
1482 -- at a time until all rows are returned. Signal ORA-1403 (no-data-found)
1483 -- when there are no more rows to return.
1484 PROCEDURE getTempfile(tfRec OUT NOCOPY tfRec_t);
1485 
1486 ----------------------------
1487 -- Online Log Translation --
1488 ----------------------------
1489 
1490 -- translateOnlineLogs translates the database to a list of online redo logs.
1491 -- The translation is always performed relative to current epoch.
1492 
1493 PROCEDURE translateOnlineLogs(srls IN number DEFAULT 0);
1494 
1495 PROCEDURE getOnlineLog(
1496    fname        OUT varchar2
1497   ,thread#      OUT number
1498   ,group#       OUT number);
1499 
1500 -----------------------------
1501 -- Archivedlog Translation --
1502 -----------------------------
1503 
1504 -- translateArchivedLogKey translates the archived log key to a archived
1505 -- log recid and stamp in V$ARCHIVED_LOG.
1506 
1507 -- translateArchivedLogRange* procedures translate a specified
1508 -- archive log range to a list of archived logs.
1509 -- getArchivedLog is used to get the recid and stamp for each archived log,
1510 -- one at a time until null is returned.
1511 
1512 -- The available, unavailable and deleted parameters are used to limit
1513 -- the translation to archived logs with the desired status. For example,
1514 -- only available archived logs can be backed up, but unavailable and deleted
1515 -- archived logs can be restored from backups.
1516 
1517 -- The duplicates parameter controls whether the translation returns all
1518 -- archived logs or eliminates duplicate ones. Archived logs that have the
1519 -- same thread#, sequence# and low_scn are considered duplicates. (duplicate
1520 -- archived logs are usually created by copying archived logs).
1521 
1522 -- Note that only archived logs recorded in the recovery catalog or
1523 -- controlfile file are returned. If there is an archived log that belongs
1524 -- to the range but is not known, there will be a "hole" in the range.
1525 
1526 -- Input parameters:
1527 --    al_key
1528 --      key of the archived log record in the recovery catalog
1532 --   fromseq#
1529 --   thread#
1530 --     return only logs that belong to this thread#
1531 --     if NULL return logs for all threads
1533 --     lowest log sequence number in the range
1534 --   toseq#
1535 --     highest log sequence number in the range
1536 --   fromtime
1537 --     exclude logs that were switched out before fromtime
1538 --   totime
1539 --     exclude logs that were switched in after totime
1540 --   fromscn
1541 --     exclude logs that were switched out before fromscn
1542 --   toscn
1543 --     exclude logs that were switched in after toscn
1544 --   pattern
1545 --     return only archived logs whose filename match the pattern
1546 --     The pattern is matched against normalized filenames ### ok?
1547 --   available
1548 --     if TRUE (1) return available archived logs
1549 --   unavailable
1550 --     if TRUE (1) return unavailable archived logs
1551 --   deleted
1552 --     if TRUE (1) return deleted archived logs
1553 --   online
1554 --     if TRUE (1) return also inspected online logs (in addition to
1555 --     archived logs)
1556 --   duplicates
1557 --     if TRUE (1) return all archived logs
1558 --     if FALSE (0) eliminate duplicate archived logs
1559 -- Output parameters:
1560 --    recid
1561 --      recid of the archived log record (in V$ARCHIVED_LOG)
1562 --    stamp
1563 --      stamp of the archived log record (in V$ARCHIVED_LOG)
1564 --    thread#
1565 --    sequence#
1566 --    low_scn
1567 --    fname
1568 --    reset_scn
1569 --    block_size
1570 -- Exceptions:
1571 --  NO_RECOVERY_CATALOG (ORA-20300)
1572 --    this operation is not supported without the recovery catalog
1573 --  ARCHIVED_LOG_DOES_NOT_EXIST
1574 --    the key does not match any archived log
1575 --   TRANSLATION_IN_PROGRESS (ORA-20203)
1576 --     the previous translation conversation is still in progess.
1577 --     To terminate get all datafiles with getArchivedLog.
1578 --   TRANSLATION_NOT_IN_PROGRESS (ORA-20204)
1579 --     getArchivedLog was called with no translation in progress
1580 --   THREAD_IS_NULL (ORA-20210)
1581 --     a null thread# was passed to translateArchivedLogSeqRange
1582 --   HIGH_SEQUENCE_IS_NULL
1583 --     a null toseq# was passed to translateArchivedLogSeqRange
1584 --   UNTIL_TIME_IS_NULL (ORA-20212)
1585 --     a null totime was passed to translateArchivedLogTimeRange
1586 --   UNTIL_SCN_IS_NULL (ORA-20213)
1587 --     a null toscn was passed to translateArchivedLogSCNRange
1588 --   ARCHIVED_LOG_RANGE_IS_EMPTY
1589 --     the specified range doesn't contain any archived log
1590 
1591 ------------------------------
1592 -- Archived Log Translation --
1593 ------------------------------
1594 
1595 PROCEDURE getArchivedLog(
1596    alRec       OUT NOCOPY alRec_t
1597   ,closeCursor IN  boolean DEFAULT FALSE);
1598 
1599 PROCEDURE translateArchivedLogKey(
1600    al_key       IN  number
1601   ,available    IN  number       DEFAULT 1 -- ignored (for compatability)
1602   ,unavailable  IN  number       DEFAULT 1 -- ignored (for compatability)
1603   ,deleted      IN  number       DEFAULT 1 -- ignored (for compatability)
1604   ,online       IN  number       DEFAULT 1 -- ignored (for compatability)
1605   ,recid        OUT number
1606   ,stamp        OUT number
1607   ,thread#      OUT number
1608   ,sequence#    OUT number
1609   ,low_scn      OUT number
1610   ,reset_scn    OUT number
1611   ,block_size   OUT number
1612   ,fname        OUT varchar2
1613   ,needstby     IN number        DEFAULT NULL);
1614 
1615 PROCEDURE translateArchivedLogName(
1616    fname        IN varchar2
1617   ,available    IN number         DEFAULT NULL   -- for compatability
1618   ,unavailable  IN number         DEFAULT NULL   -- for compatability
1619   ,deleted      IN number         DEFAULT NULL   -- for compatability
1620   ,online       IN number                        -- ignored
1621   ,duplicates   IN number
1622   ,statusMask   IN binary_integer DEFAULT NULL   -- for compatability
1623   ,needstby     IN number         DEFAULT NULL); -- for compatability
1624 
1625 -- For translate functions, the incarn parameter is interpreted as:
1626 --    -1   -- current incarnation
1627 --    0    -- any incarnation
1628 --    other-- a specific incarnation number
1629 --    NULL -- should be defaulted
1630 
1631 PROCEDURE translateArchivedLogSeqRange(
1632    thread#      IN number
1633   ,fromseq#     IN number
1634   ,toseq#       IN number
1635   ,pattern      IN varchar2
1636   ,available    IN number         DEFAULT NULL     -- for compatability
1637   ,unavailable  IN number         DEFAULT NULL     -- for compatability
1638   ,deleted      IN number         DEFAULT NULL     -- for compatability
1639   ,online       IN number                          -- ignored
1640   ,duplicates   IN number
1641   ,statusMask   IN binary_integer DEFAULT NULL     -- for compatability
1642   ,needstby     IN number         DEFAULT NULL     -- for compatability
1643   ,foreignal    IN binary_integer DEFAULT 0        -- for compatability
1644   ,incarn       IN number         DEFAULT NULL);   -- for compatibility
1645 
1646 PROCEDURE translateArchivedLogTimeRange(
1647    thread#      IN number
1648   ,fromTime     IN date
1649   ,toTime       IN date
1650   ,pattern      IN varchar2
1651   ,available    IN number         DEFAULT NULL     -- for compatability
1652   ,unavailable  IN number         DEFAULT NULL     -- for compatability
1653   ,deleted      IN number         DEFAULT NULL     -- for compatability
1657   ,needstby     IN number         DEFAULT NULL     -- for compatability
1654   ,online       IN number                          -- ignored
1655   ,duplicates   IN number
1656   ,statusMask   IN binary_integer DEFAULT NULL     -- for compatability
1658   ,foreignal    IN binary_integer DEFAULT 0        -- for compatability
1659   ,incarn       IN number         DEFAULT NULL);   -- for compatibility
1660 
1661 PROCEDURE translateArchivedLogSCNRange(
1662    thread#      IN number
1663   ,fromSCN      IN number
1664   ,toSCN        IN number
1665   ,pattern      IN varchar2
1666   ,available    IN number         DEFAULT NULL     -- for compatability
1667   ,unavailable  IN number         DEFAULT NULL     -- for compatability
1668   ,deleted      IN number         DEFAULT NULL     -- for compatability
1669   ,online       IN number
1670   ,duplicates   IN number
1671   ,statusMask   IN binary_integer DEFAULT NULL     -- for compatability
1672   ,needstby     IN number         DEFAULT NULL
1673   ,doingRecovery IN  number DEFAULT FALSE#
1674   ,onlyrdf      IN binary_integer DEFAULT 0        -- for compatability
1675   ,reset_scn    IN number         DEFAULT NULL     -- for compatability
1676   ,reset_time   IN date           DEFAULT NULL     -- for compatability
1677   ,sequence#    IN number         DEFAULT NULL     -- for compatability
1678   ,foreignal    IN binary_integer DEFAULT 0        -- for compatability
1679   ,incarn       IN number         DEFAULT NULL);   -- for compatibility
1680 
1681 PROCEDURE translateArchivedLogPattern(
1682    pattern      IN varchar2
1683   ,available    IN number         DEFAULT NULL     -- for compatability
1684   ,unavailable  IN number         DEFAULT NULL     -- for compatability
1685   ,deleted      IN number         DEFAULT NULL     -- for compatability
1686   ,online       IN number                          -- ignored
1687   ,duplicates   IN number
1688   ,statusMask   IN binary_integer DEFAULT NULL     -- for compatability
1689   ,needstby     IN number         DEFAULT NULL     -- for compatability
1690   ,foreignal    IN binary_integer DEFAULT 0);      -- for compatability
1691 
1692 PROCEDURE translateArchivedLogCancel;
1693 
1694 
1695 -- Set/Get filter functions for job views
1696 PROCEDURE sv_setSessionKey(skey IN NUMBER);
1697 PROCEDURE sv_setSessionTimeRange(fromTime IN DATE, untilTime IN DATE);
1698 
1699 FUNCTION sv_getSessionKey RETURN NUMBER;
1700 FUNCTION sv_getSessionfromTimeRange RETURN DATE;
1701 FUNCTION sv_getSessionUntilTimeRange RETURN DATE;
1702 
1703 -- translateBackupPieceKey looks up a backup piece by primary key.
1704 -- translateBackupPieceHandle looks up a backup piece by handle and deviceType.
1705 -- translatebackupPieceTag looks up backup pieces by tag.
1706 
1707 -- The available are unavailable parameters are used to limit the translation
1708 -- to backup pieces with the desired status. For example, only available
1709 -- backup pieces can be backed up, but unavailable pieces can be made
1710 -- available.  Deleted backup pieces are never returned.
1711 
1712 -- Input parameters:
1713 --    bp_key
1714 --      key of the backup piece record in the recovery catalog
1715 --    handle
1716 --      backup piece handle
1717 --    device type
1718 --      device type on which the backup piece resides
1719 -- Exceptions:
1720 --   NO_RECOVERY_CATALOG (ORA-20300)
1721 --     this operation is not supported without the recovery catalog
1722 --   BACKUP_PIECE_DOES_NOT_EXIST
1723 --     the key does not match any backup piece
1724 --   BACKUP_PIECE_HANDLE_IS_AMBIGUOUS
1725 --     the key does not match any backup piece
1726 
1727 -- Obsolete as of 8.1.6
1728 PROCEDURE getArchivedLog(
1729    recid        OUT number
1730   ,stamp        OUT number
1731   ,thread#      OUT number
1732   ,sequence#    OUT number
1733   ,low_scn      OUT number
1734   ,nxt_scn      OUT number
1735   ,fname        OUT varchar2
1736   ,reset_scn    OUT number
1737   ,block_size   OUT number
1738   ,blocks       OUT number);
1739 
1740 ---------------------------------
1741 -- Controlfilecopy Translation --
1742 ---------------------------------
1743 
1744 -- translateControlFileCopyName translates a control file name into a list of
1745 -- control file copies.
1746 -- Input parameters:
1747 --   fname
1748 --     name of the controlfile copy to be translated.
1749 --     The name must be a normalized filename
1750 -- Exceptions:
1751 --   CONTROLFILE_COPY_DOES_NOT_EXIST
1752 --     The filename does not match any controlfile copy
1753 
1754 PROCEDURE translateControlFileCopyName(
1755    fname        IN varchar2
1756   ,available    IN number         DEFAULT NULL -- for compatability
1757   ,unavailable  IN number         DEFAULT NULL -- for compatability
1758   ,duplicates   IN number
1759   ,statusMask   IN binary_integer DEFAULT NULL -- for compatability
1760   ,onlyone      IN number         DEFAULT 1);
1761 
1762 PROCEDURE translateControlFileCopyTag(
1763    cftag        IN varchar2
1764   ,available    IN number         DEFAULT NULL -- for compatability
1765   ,unavailable  IN number         DEFAULT NULL -- for compatability
1766   ,duplicates   IN number
1767   ,statusMask   IN binary_integer DEFAULT NULL -- for compatability
1768   ,onlyone      IN number         DEFAULT 1);
1769 
1770 PROCEDURE translateControlFileCopyKey(
1771    key          IN number
1772   ,available    IN number         DEFAULT NULL    -- for compatability
1773   ,unavailable  IN number         DEFAULT NULL    -- for compatability
1774   ,statusMask   IN binary_integer DEFAULT NULL);  -- for compatability
1778    rcvRec       IN OUT NOCOPY rcvRec_t);
1775 
1776 
1777 PROCEDURE getControlFileCopy(
1779 
1780 -- Obsolete as of 8.1.6
1781 PROCEDURE getControlFileCopy(
1782    recid        OUT number
1783   ,stamp        OUT number
1784   ,reset_scn    OUT number
1785   ,ckp_scn      OUT number
1786   ,block_size   OUT number);
1787 
1788 ------------------------------
1789 -- Datafilecopy Translation --
1790 ------------------------------
1791 
1792 PROCEDURE getDataFileCopy(
1793    rcvRec       OUT NOCOPY rcvRec_t
1794   ,closeCursor  IN  boolean DEFAULT FALSE);
1795 
1796 -- translateDataFileCopyKey translates the datafile copy key into a
1797 -- datafile copy recid and stamp in V$DATAFILE_COPY.
1798 
1799 -- translateDataFileCopyNumber translates a file number and (optional) tag
1800 -- to a datafile copy recid and stamp. Not used currently in 8.0.
1801 
1802 -- translatedDataFileCopyName translates the datafile copy name into a
1803 -- a list of datafile copies and getDataFileCopy returns the recid and stamp
1804 -- of each datafile copy. The duplicates parameter controls whether
1805 -- getDataFileCopy returns all matching datafile copies or just the most
1806 -- recent copy (highest stamp in rcvcat or highest recid in controlfile).
1807 
1808 -- translateDataFileCopyTag translates the tag into a list of datafile
1809 -- copies and getDataFileCopy returns the recid and stamp of each datafile copy
1810 -- one at a time until null is returned.
1811 
1812 -- translateDataFileCopyFno translates a file number into a list of datafile
1813 -- copies.  getDataFileCopy returns the recid and stamp of each datafile
1814 -- copy one at at time until null is returned.  The duplicates parameter
1815 -- controls whether getDataFileCopy returns all matching datafile copies or
1816 -- just the most recent copy (highest stamp in rcvcat or highest recid in
1817 -- controlfile).
1818 
1819 -- The available are unavailable parameters are used to limit the translation
1820 -- to datafile copies with the desired status. For example, only available
1821 -- datafile copies can be backed up, but unavailable copies can be made
1822 -- available. Deleted copies are never returned.
1823 
1824 -- The duplicates parameter controls whether getDataFileCopy returns all
1825 -- datafile copies or just the most recent (highest checkpoint scn) copy
1826 -- of each datafile (file#).
1827 
1828 -- Input parameters:
1829 --   cdf_key
1830 --     key of the datafile copy record in the recovery catalog
1831 --   fname
1832 --     name of the datafile copy to be translated.
1833 --     The name must be a normalized filename
1834 --   tag
1835 --     tag of the datafile copies to be translated
1836 --     The tag must be passed exactly as stored in the controlfile,
1837 --     it is not uppercased by translate
1838 --   available
1839 --     if TRUE (1) return available datafile copies
1840 --   unavailable
1841 --     if TRUE (1) return unavailable datafile copies
1842 --   duplicates
1843 --     if TRUE (1) return all datafile copies
1844 --     if FALSE (0) eliminate duplicate datafile copies
1845 --
1846 --    The remaining parameters are returned for deleteDataFileCopy
1847 --
1848 --    file#
1849 --    fname
1850 --    reset_scn
1851 --    create_scn
1852 --    ckp_scn
1853 --    blocks_size
1854 --
1855 -- Exceptions:
1856 --   NO_RECOVERY_CATALOG (ORA-20300)
1857 --     translation by key is not supported without the recovery catalog
1858 --   DATAFILE_COPY_DOES_NOT_EXIST
1859 --     the specified key or filename does not match any datafile copy
1860 --   DATAFILE_COPY_NAME_AMBIGUOUS
1861 --     the specified filename matches more than one datafile copy
1862 --   TAG_DOES_NOT_MATCH
1863 --     the specified tag doesn't match any datafile copies
1864 --   TRANSLATION_IN_PROGRESS (ORA-20203)
1865 --     the previous translation conversation is still in progess.
1866 --     To terminate get all datafiles with getDataFileCopy.
1867 --   TRANSLATION_NOT_IN_PROGRESS (ORA-20204)
1868 --     getDataFileCopy was called with no translation in progress
1869 
1870 PROCEDURE translateDataFileCopyKey(
1871    cdf_key      IN number
1872   ,available    IN number         DEFAULT NULL   -- for compatability
1873   ,unavailable  IN number         DEFAULT NULL   -- for compatability
1874   ,statusMask   IN binary_integer DEFAULT NULL); -- for compatability
1875 
1876 -- Obsolete as of 8.1.6
1877 PROCEDURE translateDataFileCopyKey(
1878    cdf_key      IN number
1879   ,available    IN number
1880   ,unavailable  IN number
1881   ,recid        OUT number
1882   ,stamp        OUT number
1883   ,file#        OUT number
1884   ,fname        OUT varchar2
1885   ,reset_scn    OUT number
1886   ,create_scn   OUT number
1887   ,ckp_scn      OUT number
1888   ,block_size   OUT number
1889   ,blocks       OUT number);
1890 
1891 PROCEDURE translateDataFileCopyName(
1892    fname        IN varchar2
1893   ,available    IN number         DEFAULT NULL   -- for compatability
1894   ,unavailable  IN number         DEFAULT NULL   -- for compatability
1895   ,duplicates   IN number
1896   ,statusMask   IN binary_integer DEFAULT NULL   -- for compatability
1897   ,onlyone      IN number         DEFAULT 1
1898   ,pluginSCN    IN number         DEFAULT 0);
1899 
1900 PROCEDURE translateDataFileCopyTag(
1901    tag          IN varchar2
1902   ,available    IN number         DEFAULT NULL     -- for compatibility
1903   ,unavailable  IN number         DEFAULT NULL     -- for compatibility
1904   ,duplicates   IN number
1908 
1905   ,statusMask   IN binary_integer DEFAULT NULL     -- for compatibility
1906   ,pluginSCN    IN number         DEFAULT 0
1907   ,onlytc       IN binary_integer DEFAULT FALSE#); -- for compatibility
1909 PROCEDURE translateDataFileCopyFno(
1910    fno          IN number
1911   ,available    IN number         DEFAULT NULL
1912   ,unavailable  IN number         DEFAULT NULL
1913   ,duplicates   IN number
1914   ,statusMask   IN binary_integer DEFAULT NULL
1915   ,pluginSCN    IN number         DEFAULT 0);
1916 
1917 PROCEDURE translateDataFileCopy(
1918    duplicates   IN number
1919   ,statusMask   IN binary_integer
1920   ,onlyrdf      IN binary_integer
1921   ,pluginSCN    IN number         DEFAULT 0);
1922 
1923 -- Bug 2391697
1924 PROCEDURE translateDatafileCancel;
1925 
1926 -- Obsolete as of 8.1.6
1927 PROCEDURE getDataFileCopy(
1928    recid        OUT number
1929   ,stamp        OUT number
1930   ,file#        OUT number
1931   ,fname        OUT varchar2
1932   ,reset_scn    OUT number
1933   ,create_scn   OUT number
1934   ,ckp_scn      OUT number
1935   ,block_size   OUT number
1936   ,blocks       OUT number);
1937 
1938 ----------------------------
1939 -- Proxy Copy Translation --
1940 ----------------------------
1941 
1942 PROCEDURE getProxyCopy(
1943    rcvRec       OUT NOCOPY rcvRec_t
1944   ,closeCursor  IN  boolean DEFAULT FALSE);
1945 
1946 PROCEDURE translateProxyCopyKey(
1947    pc_key       IN number
1948   ,deviceType   IN varchar2
1949   ,available    IN number           DEFAULT NULL   -- for compatability
1950   ,unavailable  IN number           DEFAULT NULL   -- for compatability
1951   ,deleted      IN number           DEFAULT NULL   -- for compatability
1952   ,expired      IN number           DEFAULT NULL   -- for compatability
1953   ,statusMask   IN binary_integer   DEFAULT NULL); -- for compatability
1954 
1955 -- Obsolete as of 8.1.6
1956 PROCEDURE translateProxyCopyKey(
1957    pc_key       IN number
1958   ,device_type  IN varchar2
1959   ,available    IN number
1960   ,unavailable  IN number
1961   ,deleted      IN number
1962   ,recid        OUT number
1963   ,stamp        OUT number
1964   ,handle       OUT varchar2);
1965 
1966 PROCEDURE translateProxyCopyHandle(
1967    handle       IN varchar2
1968   ,deviceType   IN varchar2
1969   ,available    IN number           DEFAULT NULL   -- for compatability
1970   ,unavailable  IN number           DEFAULT NULL   -- for compatability
1971   ,deleted      IN number           DEFAULT NULL   -- for compatability
1972   ,expired      IN number           DEFAULT NULL   -- for compatability
1973   ,statusMask   IN binary_integer   DEFAULT NULL); -- for compatability
1974 
1975 -- Obsolete as of 8.1.6
1976 PROCEDURE translateProxyCopyHandle(
1977    handle       IN varchar2
1978   ,device_type  IN varchar2
1979   ,available    IN number
1980   ,unavailable  IN number
1981   ,deleted      IN number
1982   ,recid        OUT number
1983   ,stamp        OUT number);
1984 
1985 PROCEDURE translateProxyCopyTag(
1986    tag          IN varchar2
1987   ,device_type  IN varchar2
1988   ,available    IN number           DEFAULT NULL   -- for compatability
1989   ,unavailable  IN number           DEFAULT NULL   -- for compatability
1990   ,deleted      IN number           DEFAULT NULL   -- for compatability
1991   ,statusMask   IN binary_integer   DEFAULT NULL); -- for compatability
1992 
1993 PROCEDURE translateProxyCopyGuid(
1994    guid         IN varchar2
1995   ,device_type  IN varchar2
1996   ,statusMask   IN binary_integer);
1997 
1998 -- translateProxyCopyKey translates a proxy copy key to a
1999 -- recid and stamp in V$PROXY_DATAFILE/V$PROXY_ARCHIVEDLOG
2000 -- translateProxyCopyHandle translates handle and device type to a
2001 -- proxy copy recid and stamp.
2002 
2003 -- getProxyCopy returns one proxy copy after calling translateProxyCopyTag.
2004 -- keep calling getProxyCopy until recid is null.
2005 
2006 -- The available and unavailable parameters are used to limit the
2007 -- translation to backup pieces with the desired status.
2008 
2009 -- Input parameters:
2010 --    pc_key
2011 --      key of the proxy copy record in the recovery catalog
2012 --    handle
2013 --      proxy copy handle
2014 --    device type
2015 --      device type on which the proxy copy resides
2016 -- Output parameters:
2017 --    recid
2018 --      recid/stamp of the proxy copy record (in V$PROXY_DATAFILE or
2019 --                                               V$PROXY_ARCHIVEDLOG)
2020 -- Exceptions:
2021 --   NO_RECOVERY_CATALOG (ORA-20300)
2022 --     this operation is not supported without the recovery catalog
2023 --   PROXY_COPY_DOES_NOT_EXIST
2024 --     the key does not match any proxy copy
2025 --   PROXY_COPY_HANDLE_IS_AMBIGUOUS
2026 --     the key matches more than one proxy copy
2027 
2028 -- Obsolete as of 8.1.6
2029 PROCEDURE getProxyCopy(
2030    recid OUT number
2031   ,stamp OUT number
2032   ,handle OUT varchar2);
2033 
2034 ------------------------------
2035 -- Backup Piece Translation --
2036 ------------------------------
2037 
2038 PROCEDURE getBackupPiece(
2039    bpRec        OUT NOCOPY bpRec_t
2040   ,closeCursor  IN  boolean DEFAULT FALSE);
2041 
2042 PROCEDURE translateBackupPieceKey(
2043    key         IN  number
2044   ,available   IN  number            DEFAULT TRUE#
2045   ,unavailable IN  number            DEFAULT TRUE#
2046   ,expired     IN  number            DEFAULT TRUE#
2050    bp_key       IN  number
2047   ,statusMask  IN  binary_integer    DEFAULT NULL);   -- for compatability
2048 
2049 PROCEDURE translateBackupPieceKey(                        -- only used in 8.1.6
2051   ,available    IN  number
2052   ,unavailable  IN  number
2053   ,recid        OUT number
2054   ,stamp        OUT number
2055   ,handle       OUT varchar2
2056   ,set_stamp    OUT number
2057   ,set_count    OUT number
2058   ,piece#       OUT number);
2059 
2060 PROCEDURE translateBackupPieceHandle(
2061    handle      IN  varchar2
2062   ,deviceType  IN  varchar2
2063   ,available   IN  number            DEFAULT NULL     -- for compatability
2064   ,unavailable IN  number            DEFAULT NULL     -- for compatability
2065   ,expired     IN  number            DEFAULT NULL     -- for compatability
2066   ,statusMask  IN  binary_integer    DEFAULT NULL);   -- for compatability
2067 
2068 PROCEDURE translateBackupPieceHandle(                     -- only used in 8.1.6
2069    handle       IN  varchar2
2070   ,device_type  IN  varchar2
2071   ,available    IN  number
2072   ,unavailable  IN  number
2073   ,recid        OUT number
2074   ,stamp        OUT number
2075   ,set_stamp    OUT number
2076   ,set_count    OUT number
2077   ,piece#       OUT number);
2078 
2079 PROCEDURE translateBackupPieceTag(
2080    tag          IN varchar2
2081   ,available    IN number             DEFAULT NULL     -- for compatability
2082   ,unavailable  IN number             DEFAULT NULL     -- for compatability
2083   ,statusMask   IN binary_integer     DEFAULT NULL);   -- for compatability
2084 
2085 PROCEDURE translateBackupPieceGuid(
2086    guid         IN varchar2
2087   ,statusMask   IN binary_integer);
2088 
2089 PROCEDURE translateBackupPieceBSKey(
2090    key          IN number
2091   ,tag          IN varchar2           DEFAULT NULL
2092   ,deviceType   IN varchar2           DEFAULT NULL
2093   ,pieceCount   IN number
2094   ,duplicates   IN number             DEFAULT TRUE#
2095   ,copyNumber   IN number             DEFAULT NULL
2096   ,available    IN number             DEFAULT TRUE#
2097   ,unavailable  IN number             DEFAULT FALSE#
2098   ,deleted      IN number             DEFAULT FALSE#
2099   ,expired      IN number             DEFAULT FALSE#
2100   ,statusMask   IN binary_integer     DEFAULT NULL);   -- for compatability
2101 
2102 PROCEDURE translateBackupPieceBsKey(
2103    startBsKey   IN number
2104   ,tag          IN varchar2        DEFAULT NULL
2105   ,statusMask   IN binary_integer  DEFAULT NULL);
2106 -- Translates all backupsets starting with specified backupset key, tag and
2107 -- status. Used to fetch a list of backuppieces in one cursor.
2108 
2109 PROCEDURE translateSeekBpBsKey(
2110    bsKey        IN number
2111   ,deviceType   IN varchar2
2112   ,pieceCount   IN number
2113   ,duplicates   IN number   DEFAULT TRUE#
2114   ,copyNumber   IN number   DEFAULT NULL);
2115 -- Seek follows translateBackupPieceBsKey. It is used seek to a specified
2116 -- backupset key, device, copyNumber. May return no_data_found if the
2117 -- backupset key is not found or the cursor have passed over the
2118 -- backupset key, device, copyNumber.
2119 -- If this function doesn't return any error, then use getBackupPiece to
2120 -- fetch all backuppieces until no_data_found.
2121 -- Then seek again for a backupset key that is greater than previous.
2122 -- The seek is expected to succeed always if the feeded backupset key is
2123 -- in ascending order.
2124 
2125 PROCEDURE translateBpBsKeyCancel;
2126 -- End the translation once you are done with fetching pieces of all
2127 -- backupsets. This will close the cursor and reset the package translation
2128 -- variables.
2129 
2130 -- Obsolete as of 8.1.6
2131 PROCEDURE translateBackupSetKey(
2132    bs_key          IN  number
2133   ,device_type     IN  varchar2
2134   ,available       IN  number
2135   ,unavailable     IN  number
2136   ,deleted         IN  number
2137   ,duplicates      IN  number
2138   ,backup_type     OUT varchar2
2139   ,recid           OUT number
2140   ,stamp           OUT number
2141   ,set_stamp       OUT number
2142   ,set_count       OUT number
2143   ,bslevel         OUT number
2144   ,completion_time OUT date);
2145 
2146 -- Obsolete as of 8.1
2147 PROCEDURE translateBackupSetKey(
2148    bs_key      IN  number
2149   ,device_type IN  varchar2
2150   ,available   IN  number
2151   ,unavailable IN  number
2152   ,deleted     IN  number
2153   ,duplicates  IN  number
2154   ,backup_type OUT varchar2
2155   ,recid       OUT number
2156   ,stamp       OUT number);
2157 
2158 -- Obsolete as of 8.1.6
2159 PROCEDURE translateBackupSetRecid(
2160    recid       IN  number
2161   ,stamp       IN  number
2162   ,device_type IN  varchar2
2163   ,bs_key      OUT number
2164   ,bslevel     OUT number
2165   ,completed   OUT date);
2166 
2167 -- Obsolete as of 8.1
2168 PROCEDURE translateBackupSetRecid(
2169    recid       IN  number
2170   ,stamp       IN  number
2171   ,device_type IN  varchar2);
2172 
2173 -- translateBackupPieceBSKey translates the specified backup set into a list of
2174 -- backup pieces.  If there are multiple available copies of a piece then
2175 -- only the latest (with highest stamp) is returned.  If there is no available
2176 -- copy of a piece then raise an exception.
2177 --
2178 -- Input parameters:
2179 --    key
2180 --      key of the backup set record in the recovery catalog
2181 --    recid
2182 --      recid of the backup set record (in V$BACKUP_SET)
2183 --    stamp
2187 --    tag
2184 --      stamp of the backup set record (in V$BACKUP_SET)
2185 --    startBsKey
2186 --      translate all backupsets with this key and above.
2188 --      translate backuppieces with this tag
2189 --    statusMask
2190 --      translate backuppieces with this status
2191 --    deviceType
2192 --      translate backuppieces that are resides on this device
2193 -- Exceptions:
2194 --   BACKUP_SET_MISSING
2195 --     no backup set with the specified recid and stamp found
2196 --   NO_RECOVERY_CATALOG (ORA-20300)
2197 --     translation by bs_key is not supported without the recovery catalog
2198 
2199 -- Obsolete as of 8.1.6
2200 PROCEDURE getBackupPiece(
2201    recid      OUT number
2202   ,stamp      OUT number
2203   ,bpkey      OUT number
2204   ,set_stamp  OUT number
2205   ,set_count  OUT number
2206   ,piece#     OUT number
2207   ,copy#      OUT number
2208   ,status     OUT varchar2
2209   ,completion OUT date
2210   ,handle     OUT varchar2);
2211 
2212 -- Obsolete as of 8.1
2213 PROCEDURE getBackupPiece(
2214    recid      OUT number
2215   ,stamp      OUT number
2216   ,set_stamp  OUT number
2217   ,set_count  OUT number
2218   ,piece#     OUT number
2219   ,handle     OUT varchar2);
2220 
2221 ----------------------------
2222 -- Backup Set Translation --
2223 ----------------------------
2224 
2225 PROCEDURE translateBackupSetKey(
2226    key        IN  number
2227   ,bsRec      OUT NOCOPY bsRec_t);
2228 
2229 PROCEDURE translateAllBackupSet(
2230    backupType            IN  binary_integer
2231   ,tag                   IN  varchar2
2232   ,statusMask            IN  binary_integer
2233   ,completedAfter        IN  date
2234   ,completedBefore       IN  date
2235   ,onlyrdf               IN  binary_integer DEFAULT 0);
2236 
2237 PROCEDURE getAllBackupSet(
2238    rcvRec OUT NOCOPY rcvRec_t);
2239 
2240 -----------------------------------------
2241 -- Pluggable Database Name Translation --
2242 -----------------------------------------
2243 
2244 FUNCTION translatePdb2Name(
2245    pdbId IN NUMBER)
2246 RETURN VARCHAR2;
2247 
2248 ------------------------
2249 -- Controlfile Backup --
2250 ------------------------
2251 
2252 -- allCopies = TRUE fetches duplex ones
2253 -- fromSCN > 0 means that find controlfile backup whose checkpoint scn is
2254 -- greater or equal to this scn. This is used to find the right controlfile
2255 -- backup for PDB PITR.
2256 -- pdbid > 1 means that ignore controlfile backup that are in orphan branch
2257 -- pdb incarnation of this pdb.
2258 PROCEDURE findControlfileBackup(
2259    allCopies      IN boolean default FALSE,
2260    allBackups     IN boolean default FALSE,
2261    allIncarnation IN boolean default FALSE,
2262    fromSCN        IN number  default 0,
2263    pdbid          IN number  default 0);
2264 
2265 -- getControlfileBackup is not a public function, but needs to be here due
2266 -- to bug 1269570.
2267 FUNCTION getControlfileBackup(
2268    rcvRec     OUT NOCOPY rcvRec_t)
2269 RETURN number;
2270 
2271 -- getPrimaryDfName: return the name of a datafile as it appears on the primary
2272 FUNCTION getPrimaryDfName(fno IN NUMBER) RETURN VARCHAR2;
2273 
2274 -- findControlFileBackup finds the optimal copy or backup of the controlfile
2275 -- based on the given criteria.
2276 -- The optimal copy is the one with highest checkpoint SCN.  Returns one of:
2277 -- SUCCESS, AVAILABLE, UNAVAILABLE.
2278 
2279 -- This is for 8.0.4 thru 8.1.5 compatibility
2280 FUNCTION findControlFileBackup(
2281    type         OUT number
2282   ,recid        OUT number
2283   ,stamp        OUT number
2284   ,fname        OUT varchar2
2285   ,device_type  OUT varchar2
2286   ,ckp_scn      OUT number)
2287 RETURN number;
2288 
2289 -- Obsolete as of 8.1.6 (8.1.5 uses this)
2290 FUNCTION findControlFileBackup(
2291    type         OUT number
2292   ,recid        OUT number
2293   ,stamp        OUT number
2294   ,fname        OUT varchar2
2295   ,device_type  OUT varchar2
2296   ,ckp_scn      OUT number
2297   ,rlg_scn      OUT number
2298   ,blksize      OUT number)
2299 RETURN number;
2300 
2301 -------------------------
2302 -- Archived Log Backup --
2303 -------------------------
2304 
2305 PROCEDURE findRangeArchivedLogBackup(
2306    minthread    IN number
2307   ,minsequence  IN number
2308   ,minlowSCN    IN number
2309   ,maxthread    IN number
2310   ,maxsequence  IN number
2311   ,maxlowSCN    IN number
2312   ,allCopies    IN boolean default FALSE);
2313 
2314 -- findRangeArchivedLogBackup finds all the backup sets that are required to
2315 -- restore the archivelog specified in the range.
2316 -- getRangeArchivedLogBackup returns the record for the backup set. The
2317 -- return value is one of:  SUCCESS, AVAILABLE, UNAVAILABLE for each of the
2318 -- backup sets.
2319 --
2320 -- Input Parameter:
2321 --    minthread#, maxthread#     - range of threads
2322 --    minsequence#, maxsequence# - range of sequence#
2323 --    minlowSCN, maxlowSCN       - range of lowSCN
2324 --    allCopies                  - TRUE fetches duplex ones
2325 
2326 -- Obsolete as of 11g
2327 PROCEDURE findArchivedLogBackup(
2328    thread    IN number
2329   ,sequence  IN number
2330   ,lowSCN    IN number
2331   ,allCopies IN boolean default FALSE);
2332 
2336 --
2333 -- findArchivedLogBackup finds a backup set containing the given archived log.
2334 -- getArchivedLogBackup returns the record for the backup set.  The return
2335 -- value is one of:  SUCCESS, AVAILABLE, UNAVAILABLE.
2337 -- Input Parameter:
2338 --    thread#
2339 --    sequence#
2340 --    low_scn
2341 --    allCopies - TRUE fetches duplex ones
2342 
2343 -- Obsolete as of 11g
2344 FUNCTION getArchivedLogBackup(
2345    rcvRec       OUT NOCOPY rcvRec_t)
2346 RETURN binary_integer;
2347 
2348 -- Obsolete as of 8.1.6
2349 FUNCTION findArchivedLogBackup(
2350    thread#    IN  number
2351   ,sequence#  IN  number
2352   ,low_scn    IN  number
2353   ,type       OUT number
2354   ,recid      OUT number
2355   ,stamp      OUT number
2356   ,device_type OUT varchar2)
2357 RETURN number;
2358 
2359 -------------------
2360 -- SPFILE Backup --
2361 -------------------
2362 
2363 -- allCopies = TRUE fetches duplex ones
2364 -- redundancy determine the number of redundant copies to fetch.
2365 -- rmanCmd = is the specific rman command
2366 -- scn_warn = 1 if we must estimate the time, 0 otherwise
2367 PROCEDURE findSpfileBackup(
2368    allCopies  IN boolean default FALSE
2369   ,redundancy IN number  default NULL
2370   ,rmanCmd    IN number  default unknownCmd_t);
2371 
2372 PROCEDURE findSpfileBackup(
2373    allCopies  IN boolean default FALSE
2374   ,redundancy IN number  default NULL
2375   ,rmanCmd    IN number  default unknownCmd_t
2376   ,scn_warn  OUT number);
2377 
2378 -- redundancy determine the number of redundant copies to fetch if
2379 -- findSpfileBackup wasn't called earlier.
2380 FUNCTION getSpfileBackup(
2381    rcvRec       OUT NOCOPY rcvRec_t
2382   ,redundancy   IN         number default NULL
2383   ,rmanCmd      IN         number default unknownCmd_t)
2384 RETURN number;
2385 
2386 ---------------
2387 -- List Copy --
2388 ---------------
2389 
2390 PROCEDURE listTranslateControlfileCopy(
2391    tag             IN  varchar2
2392   ,completedAfter  IN  date
2393   ,completedBefore IN  date
2394   ,statusMask      IN  binary_integer   DEFAULT
2395                        BSavailable+BSunavailable+BSexpired
2396   ,liststby        IN  binary_integer   DEFAULT NULL -- default for 8.1
2397   ,file_pattern    IN varchar2       DEFAULT NULL);
2398 
2399 PROCEDURE listGetControlfileCopy(
2400    rcvRec OUT NOCOPY rcvRec_t);
2401 
2402 -- Obsolete as of 8.1.6
2403 FUNCTION listGetControlfileCopy(
2404    bcfkey     OUT number
2405   ,ckpscn     OUT number
2406   ,ckptime    OUT date
2407   ,status     OUT varchar2
2408   ,completion OUT date
2409   ,fname      OUT varchar2)
2410 RETURN number;
2411 
2412 PROCEDURE listTranslateDataFileCopy(
2413    file#             IN number
2414   ,creation_change#  IN number
2415   ,tag               IN varchar2        DEFAULT NULL
2416   ,file_name_pattern IN varchar2        DEFAULT NULL
2417   ,completedAfter    IN date            DEFAULT NULL
2418   ,completedBefore   IN date            DEFAULT NULL
2419   ,statusMask        IN binary_integer  DEFAULT BSavailable+BSunavailable
2420                                                              -- default for 8.1
2421   ,pluginSCN         IN number          DEFAULT 0);
2422 
2423 PROCEDURE listGetDataFileCopy(
2424    rcvRec OUT NOCOPY rcvRec_t);
2425 
2426 -- Obsolete as of 8.1.6
2427 FUNCTION listGetDataFileCopy(
2428    cdf_key            OUT number
2429   ,status             OUT varchar2
2430   ,fname              OUT varchar2
2431   ,completion_time    OUT date
2432   ,checkpoint_change# OUT number
2433   ,checkpoint_time    OUT date)
2434 RETURN number;
2435 
2436 PROCEDURE listTranslateArchivedLogCopy(
2437    thread#           IN number
2438   ,sequence#         IN number
2439   ,first_change#     IN number
2440   ,file_name_pattern IN varchar2        DEFAULT NULL
2441   ,completedAfter    IN date            DEFAULT NULL
2442   ,completedBefore   IN date            DEFAULT NULL
2443   ,statusMask        IN binary_integer  DEFAULT
2444                        BSavailable+BSunavailable+BSexpired  -- 8.0/8.1 defaults
2445   ,needstby          IN number          DEFAULT NULL);
2446 
2447 PROCEDURE listGetArchivedLogCopy(
2448    rcvRec       OUT NOCOPY rcvRec_t);
2449 
2450 -- Obsolete as of 8.1.6
2451 FUNCTION listGetArchivedLogCopy(
2452    al_key          OUT number
2453   ,status          OUT varchar2
2454   ,fname           OUT varchar2
2455   ,completion_time OUT date)
2456 RETURN number;
2457 
2458 -----------------
2459 -- List Backup --
2460 -----------------
2461 
2462 PROCEDURE listTranslateControlfileBackup(
2463    tag             IN  varchar2
2464   ,completedAfter  IN  date
2465   ,completedBefore IN  date
2466   ,statusMask      IN  binary_integer   DEFAULT
2467                       BSavailable+BSunavailable+BSexpired   -- 8.0/8.1 defaults
2468   ,autobackup      IN  binary_integer    DEFAULT BScfile_all
2469   ,liststby        IN  binary_integer    DEFAULT NULL);
2470 
2471 PROCEDURE listGetControlfileBackup(
2472    rcvRec OUT NOCOPY rcvRec_t);
2473 
2474 -- Obsolete as of 8.1.6
2475 FUNCTION listGetControlfileBackup(
2476    bskey      OUT number,
2477    ckpscn     OUT number,
2478    ckptime    OUT date)
2479 RETURN number;
2480 
2481 PROCEDURE listTranslateSpfileBackup(
2482    completedAfter  IN  date
2483   ,completedBefore IN  date);
2484 
2485 PROCEDURE listGetSpfileBackup(
2486    rcvRec OUT NOCOPY rcvRec_t);
2487 
2491   ,tag               IN varchar2        DEFAULT NULL
2488 PROCEDURE listTranslateDataFileBackup(
2489    file#             IN number
2490   ,creation_change#  IN number
2492   ,completedAfter    IN date            DEFAULT NULL
2493   ,completedBefore   IN date            DEFAULT NULL
2494   ,statusMask        IN binary_integer  DEFAULT
2495                       BSavailable+BSunavailable+BSexpired   -- 8.0/8.1 defaults
2496   ,pluginSCN         IN number          DEFAULT 0);
2497 
2498 PROCEDURE listGetDataFileBackup(
2499    rcvRec OUT NOCOPY rcvRec_t);
2500 
2501 -- Obsolete as of 8.1.6
2502 FUNCTION listGetDataFileBackup(
2503    bs_key             OUT number
2504   ,backup_type        OUT varchar2
2505   ,incremental_level  OUT number
2506   ,completion_time    OUT date
2507   ,checkpoint_change# OUT number
2508   ,checkpoint_time    OUT date)
2509 RETURN number;
2510 
2511 -- 8.1.5 LIST implementation
2512 PROCEDURE translateBackupFile(
2513    bs_recid    IN  number
2514   ,bs_stamp    IN  number
2515   ,fno         IN  number
2516   ,bskey       OUT number
2517   ,inclevel    OUT number
2518   ,backup_type OUT varchar2
2519   ,completed   OUT date);
2520 
2521 -- Used by 8.0 and 8.1.6, but not 8.1.5
2522 PROCEDURE listTranslateArchivedLogBackup(
2523    thread#           IN number
2524   ,sequence#         IN number
2525   ,first_change#     IN number
2526   ,completedAfter    IN date           DEFAULT NULL
2527   ,completedBefore   IN date           DEFAULT NULL
2528   ,statusMask        IN binary_integer DEFAULT
2529                       BSavailable+BSunavailable+BSexpired); -- 8.0/8.1 defaults
2530 
2531 PROCEDURE listGetArchivedLogBackup(
2532    rcvRec OUT NOCOPY rcvRec_t);
2533 
2534 -- Obsolete as of 8.1
2535 FUNCTION listGetArchivedLogBackup(
2536    bs_key          OUT number
2537   ,completion_time OUT date)
2538 RETURN number;
2539 
2540 -- Obsolete as of 8.1.6, but used in 9.0
2541 PROCEDURE listTranslateArchivedLogBackup(
2542    thread#      IN number   DEFAULT NULL
2543   ,lowseq       IN number   DEFAULT NULL
2544   ,highseq      IN number   DEFAULT NULL
2545   ,lowscn       IN number   DEFAULT NULL
2546   ,highscn      IN number   DEFAULT NULL
2547   ,from_time    IN date     DEFAULT NULL
2548   ,until_time   IN date     DEFAULT NULL
2549   ,pattern      IN varchar2 DEFAULT NULL);
2550 
2551 -- Obsolete as of 8.1.6
2552 FUNCTION listGetArchivedLogBackup(
2553    bs_key          OUT number
2554   ,thread#         OUT number
2555   ,sequence#       OUT number
2556   ,first_change#   OUT number
2557   ,next_change#    OUT number
2558   ,first_time      OUT date
2559   ,next_time       OUT date)
2560 RETURN number;
2561 
2562 --------------------
2563 -- List Backupset --
2564 --------------------
2565 
2566 PROCEDURE listTranslateBackupsetFiles(
2567    bs_key          IN  number);
2568 
2569 PROCEDURE listGetBackupsetFiles(
2570    rcvRec          OUT NOCOPY rcvRec_t);
2571 
2572 ---------------------
2573 -- List Proxy Copy --
2574 ---------------------
2575 
2576 -- Note that this is used for both datafiles and the controlfile
2577 PROCEDURE listTranslateProxyDataFile(
2578    file#             IN number
2579   ,creation_change#  IN number
2580   ,tag               IN varchar2        DEFAULT NULL
2581   ,handle_pattern    IN varchar2        DEFAULT NULL
2582   ,completedAfter    IN date            DEFAULT NULL
2583   ,completedBefore   IN date            DEFAULT NULL
2584   ,statusMask        IN binary_integer  DEFAULT
2585                        BSavailable+BSunavailable+BSexpired
2586   ,liststby          IN binary_integer  DEFAULT NULL -- default for 8.1
2587   ,pluginSCN         IN number          DEFAULT 0);
2588 
2589 PROCEDURE listGetProxyDataFile(
2590    rcvRec OUT NOCOPY rcvRec_t);
2591 
2592 -- Obsolete as of 8.1.6
2593 FUNCTION listGetProxyDataFile(
2594    xdf_key            OUT number
2595   ,recid              OUT number
2596   ,stamp              OUT number
2597   ,status             OUT varchar2
2598   ,handle             OUT varchar2
2599   ,completion_time    OUT date
2600   ,checkpoint_change# OUT number
2601   ,checkpoint_time    OUT date)
2602 RETURN number;
2603 
2604 -- This procedure serves absolutely no purpose.  It is here only for
2605 -- backwards compatbility with 8.1.5.  The only call to this is from
2606 -- krmkafs(), which gets called from krmkgra().  Since the calls are always
2607 -- in sequence, we can simply save the last record returned from
2608 -- getRecoveryAction and avoid doing an extra query.
2609 -- The only value this functions returns that krmkgra() didn't already have
2610 -- in 8.1.5 is the xdf_key.  Completion time was being estimated from the
2611 -- stamp.
2612 PROCEDURE listTranslateProxyDFRecid(
2613    recid              IN number
2614   ,stamp              IN number
2615   ,xdf_key            OUT number
2616   ,file#              OUT number
2617   ,status             OUT varchar2
2618   ,handle             OUT varchar2
2619   ,completion_time    OUT date
2620   ,checkpoint_change# OUT number
2621   ,checkpoint_time    OUT date);
2622 
2623 PROCEDURE listTranslateProxyArchivedLog(
2624    thread#           IN number
2625   ,sequence#         IN number
2626   ,first_change#     IN number
2627   ,tag               IN varchar2        DEFAULT NULL
2628   ,handle_pattern    IN varchar2        DEFAULT NULL
2629   ,completedAfter    IN date            DEFAULT NULL
2633 
2630   ,completedBefore   IN date            DEFAULT NULL
2631   ,statusMask        IN binary_integer  DEFAULT
2632                                         BSavailable+BSunavailable+BSexpired);
2634 PROCEDURE listGetProxyArchivedLog(
2635    rcvRec OUT NOCOPY rcvRec_t);
2636 
2637 -------------------------------
2638 -- List Database Incarnation --
2639 -------------------------------
2640 
2641 PROCEDURE listTranslateDBIncarnation(
2642    db_name       IN varchar2 DEFAULT NULL,
2643    all_databases IN number  DEFAULT 0);
2644 
2645 FUNCTION listGetDBIncarnation(
2646    db_key            OUT number
2647   ,dbinc_key         OUT number
2648   ,db_name           OUT varchar2
2649   ,db_id             OUT number
2650   ,current_inc       OUT varchar2
2651   ,resetlogs_change# OUT number
2652   ,resetlogs_time    OUT date
2653   ,dbinc_status      OUT varchar2)
2654 RETURN number;
2655 
2656 FUNCTION listGetDBIncarnation(
2657    db_key            OUT number
2658   ,dbinc_key         OUT number
2659   ,db_name           OUT varchar2
2660   ,db_id             OUT number
2661   ,current_inc       OUT varchar2
2662   ,resetlogs_change# OUT number
2663   ,resetlogs_time    OUT date)
2664 RETURN number;
2665 
2666 -------------------------------
2667 -- List Database Sites --
2668 -------------------------------
2669 
2670 PROCEDURE listTranslateDBSite(
2671    db_name      IN varchar2 DEFAULT NULL,
2672    alldbs       IN binary_integer DEFAULT 1);
2673 
2674 FUNCTION listGetDBSite(
2675    db_key            OUT number
2676   ,db_id             OUT number
2677   ,db_name           OUT varchar2
2678   ,db_role           OUT varchar2
2679   ,db_unique_name    OUT varchar2)
2680 RETURN number;
2681 
2682 --------------------------------------
2683 -- List Rollback Segment Tablespace --
2684 --------------------------------------
2685 
2686 PROCEDURE listRollbackSegTableSpace;
2687 
2688 FUNCTION listGetTableSpace(
2689    ts#               OUT number
2690   ,ts_name           OUT varchar2)
2691 RETURN number;
2692 
2693 ------------------------
2694 -- Incremental Backup --
2695 ------------------------
2696 
2697 -- getIncrementalScn returns the starting scn for an incremental backup.
2698 -- Input Parameters:
2699 --   file#
2700 --     datafile number
2701 --   reset_scn
2702 --     the resetlogs SCN of the datafile
2703 --   reset_time
2704 --     the resetlogs time of the datafile
2705 --   incr_scn
2706 --     level of the incremental backup
2707 --   cumulative
2708 --      TRUE# if the backup is cumulative
2709 --   first
2710 --      TRUE open the cursor, otherwise just fetch from already opened cursor
2711 --   sourcemask
2712 --      the source on which this incremental is based on
2713 --   tag
2714 --      the source tag on which this incremental is based on
2715 
2716 -- Exceptions
2717 --   DATAFILE_DOES_NOT_EXIST
2718 --   INVALID_LEVEL
2719 --   NO_PARENT_BACKUP_FOUND
2720 
2721 FUNCTION getIncrementalScn(
2722    file#        IN number
2723   ,create_scn   IN number
2724   ,reset_scn    IN number
2725   ,reset_time   IN date
2726   ,incr_level   IN number
2727   ,cumulative   IN number
2728   ,sourcemask   IN number   DEFAULT NULL
2729   ,tag          IN varchar2 DEFAULT NULL
2730   ,pluginSCN    IN number   DEFAULT 0)
2731 RETURN number;
2732 
2733 -- This one is an improved version of above. If you want to get
2734 -- incremental scn for all datafiles by opening the cursor only once, then
2735 -- using this will give enormous performance improvement.
2736 --
2737 -- NOTE!! NOTE!! NOTE!!
2738 -- If you pass NULL to file# then it means all of the following
2739 --  o all datafiles
2740 --  o datafiles which has reset_scn and reset_time of current incarnation.
2741 -- It is the callers responsibility to fetch the incremental scn of remaining
2742 -- datafiles which doesn't have reset_scn and reset_time of current
2743 -- incarnation.
2744 
2745 PROCEDURE getIncrementalScn(
2746    first        IN  boolean                  -- open the cursor if this is TRUE
2747   ,file#        IN  number
2748   ,create_scn   IN  number
2749   ,reset_scn    IN  number
2750   ,reset_time   IN  date
2751   ,incr_level   IN  number
2752   ,cumulative   IN  number
2753   ,rcvRec       OUT NOCOPY rcvRec_t
2754   ,sourcemask   IN  number    DEFAULT NULL
2755   ,tag          IN  varchar2  DEFAULT NULL
2756   ,pluginSCN    IN  number    DEFAULT 0
2757   ,keep         IN  boolean   DEFAULT NULL);
2758 
2759 
2760 --------------------
2761 -- Offline Ranges --
2762 --------------------
2763 
2764 PROCEDURE findOfflineRangeCopy(
2765    offr_recid   IN number
2766   ,offr_ckpscn  IN number
2767   ,cf_cretime   IN date
2768   ,dbinc_key    IN number);
2769 
2770 PROCEDURE getOfflineRangeCopy(
2771    rcvRec       OUT  NOCOPY rcvRec_t);
2772 
2773 -- Obsolete as of 8.1.6
2774 FUNCTION getOfflineRangeCopy
2775 RETURN varchar2;
2776 
2777 -- findOfflineRangeCopy begins the search for a controlfile copy
2778 -- containing a specified offline range.  getOfflinRangeCopy is called
2779 -- to retrieve the controlfile names one by one.  NULL is returned at
2780 -- end of fetch.
2781 
2782 -- Input Parameters:
2783 --   offr_recid
2784 --     recid of offline range
2785 --   offr_ckpscn
2786 --     online checkpoint SCN (end) of offline range
2790 --   offr_recid
2787 --   dbinc_rlgscn
2788 --     resetlogs SCN of the db incarnation that contains this range
2789 -- Output Parameters:
2791 --     recid of the offline range record
2792 --   offr_stamp
2793 --     stamp of the offline range record
2794 --   type
2795 --     type of the controlfile that contains the offline range.
2796 --     COPY or BACKUP
2797 --   recid
2798 --     the recid of datafile copy record or
2799 --     the recid of the backup set record
2800 --   stamp
2801 --     The timestamp associated with the recid in the controlfile.
2802 --   fname
2803 --     filename of the controlfile copy
2804 --     NULL if a backup controlfile is returned
2805 
2806 -- returns TRUE (1) if a copy or backup was found
2807 -- returns FALSE (0) if no copy or backup was found
2808 
2809 -- Exceptions:
2810 --   OFFLINE_RANGE_NOT_FOUND (ORA-20250)
2811 --     No offline range was found for the datafile starting at the offline SCN
2812 
2813 ---------------------------------------
2814 -- Recovery Functions and Procedures --
2815 ---------------------------------------
2816 
2817 PROCEDURE setComputeRecoveryActionMasks(
2818    containerMask        IN number
2819   ,actionMask           IN number
2820   ,allRecords           IN number
2821   ,availableMask        IN binary_integer
2822   ,fullBackups          IN number DEFAULT NULL);
2823 -- Input parameters:
2824 --   fullBackups
2825 --     Stop when these many full backups are fetched. Dependency on
2826 --     allRecords value is as follows:
2827 --     1. When allRecords = FALSE# and fullBackups = NULL, we stop when
2828 --        one full backup is fetched.
2829 --     2. When allRecords = FALSE# and fullBackups = N, we stop when
2830 --        N full backups are fetched.
2831 --     3. When allRecords = TRUE# and fullBackups = NULL, we get all
2832 --        records.
2833 --     4. When allRecords = TRUE# and fullBackups = N, we stack N
2834 --        full backups and all non-full backup records.
2835 --
2836 
2837 --Obsolete as of 8.1.7
2838 PROCEDURE setComputeRecoveryActionMasks(
2839    containerMask        IN number
2840   ,actionMask           IN number
2841   ,allRecords           IN number);
2842 
2843 -- Obsolete as of 8.1.6
2844 PROCEDURE setRAflags(
2845    kindMask    IN number
2846   ,allRecords  IN boolean);
2847 
2848 FUNCTION computeRecoveryActions(
2849 fno        IN number,   -- Datafile number.
2850 crescn     IN number,   -- Datafile creation SCN.
2851 df_rlgscn  IN number    -- Datafile resetlogs SCN.  Null if this is a RESTORE
2852    default null,        -- command, else this is the value in the datafile
2853                         -- header for the datafile we are RECOVERing.
2854 df_rlgtime IN date      -- Datafile resetlogs time.  Null if df_rlgscn is
2855    default null,        -- null, else value from datafile header.
2856 df_ckpscn  IN number    -- Datafile checkpoint SCN.  Null if df_rlgscn is
2857    default null,        -- null, else value from datafile header.
2858 offlscn    IN number    -- kccfeofs (may be null).
2859    default 0,
2860 onlscn     IN number    -- kccfeonc (null if offlscn is null).
2861    default 0,
2862 onltime    IN date      -- kccfeonc_time
2863    default null,
2864 cleanscn   IN number    -- kccfecps if either SOR or WCC set, else null.
2865    default 0,
2866 clean2scn  IN number    -- CF ckpt SCN if WCC set, infinity if SOR bit set
2867    default 0,           -- else null.
2868 clean2time IN date      -- cf ckpt time if WCC, SYSDATE if SOR
2869    default null,
2870 allowfuzzy IN boolean   -- TRUE if can be fuzzy at until SCN/time, FALSE if
2871   default FALSE,        -- not.  default is FALSE.
2872 partial_rcv IN boolean  -- TRUE if can do partial recovery, FALSE if not
2873   default FALSE,
2874 cf_scn     IN number    -- controlfile checkpoint SCN (NULL if none mounted)
2875   default NULL,
2876 cf_cretime IN date      -- controlfile creation time (NULL if none mounted)
2877   default NULL,
2878 cf_offrrid IN number    -- recid of oldest offline range in controlfile
2879   default NULL,         -- (NULL if none mounted)
2880 allCopies  IN boolean   -- if TRUE, then stack all valid copies of a bu set
2881   default FALSE,
2882 df_cretime IN date      -- datafile creation time
2883   default NULL,
2884 rmanCmd    IN binary_integer
2885   default unknownCmd_t,
2886 foreignDbid   IN number
2887   default 0,
2888 pluggedRonly  IN binary_integer
2889   default 0,
2890 pluginSCN     IN number
2891   default 0,
2892 pluginRlgSCN  IN number
2893   default 0,
2894 pluginRlgTime IN date
2895   default NULL,
2896 creation_thread IN number
2897   default NULL,
2898 creation_size   IN number
2899   default NULL,
2900 pdbId           IN number
2901   default 1,
2902 pdbForeignDbid  IN number
2903   default 0
2904 ) return binary_integer;
2905 
2906 -- Returns:
2907 --   SUCCESS -> the file can be restored/recovered.
2908 --   else one of RESTORABLE, AVAILABLE, UNAVAILABLE, NO_ACTION.
2909 
2910 -- computeRecoveryActions return values --
2911 
2912 SUCCESS     CONSTANT binary_integer := 0;
2913 UNAVAILABLE CONSTANT binary_integer := 1;
2914 AVAILABLE   CONSTANT binary_integer := 2;
2915 RESTORABLE  CONSTANT binary_integer := 3;
2916 NO_ACTION   CONSTANT binary_integer := 4;
2917 
2918 -- SUCCESS:      A file has been found for RESTORE, or the file on disk
2919 --               can be recovered.
2923 -- AVAILABLE:    If RESTORE, then some level 0 or datafilecopy exists, but
2920 -- UNAVAILABLE:  If RESTORE, then no datafilecopy or level 0 backup was found.
2921 --               If RECOVER, then some incremental backup is missing, or the
2922 --               datafile on disk is too old to recover.
2924 --               the required device type is not allocated.
2925 -- RESTORABLE:   This is returned only when doing a RECOVER.  It means that
2926 --               the file on disk cannot be recovered, but there is some level
2927 --               0 or datafilecopy that could be restored and then recovered.
2928 -- NO_ACTION:    There are no incrementals or offline ranges to apply, but
2929 --               the file should be recoverable with redo.  No guarantee is
2930 --               made that the logs needed are actually available.
2931 
2932 FUNCTION getRecoveryAction(
2933    action OUT NOCOPY rcvRec_t)
2934 RETURN binary_integer;
2935 
2936 -- Obsolete as of 8.1.6
2937 FUNCTION getRecoveryAction(
2938    kind       OUT number
2939   ,set_stamp  OUT number
2940   ,set_count  OUT number
2941   ,recid      OUT number
2942   ,stamp      OUT number
2943   ,fname      OUT varchar2
2944   ,blocksize  OUT number
2945   ,blocks     OUT number
2946   ,devtype    OUT varchar2
2947   ,from_scn   OUT number
2948   ,to_scn     OUT number
2949   ,to_time    OUT date
2950   ,rlgscn     OUT number
2951   ,rlgtime    OUT date
2952   ,cfcretime  OUT date
2953   ,dbinc_key  OUT number)
2954 RETURN binary_integer;
2955 
2956 PROCEDURE printRecoveryActions;
2957 
2958 PROCEDURE trimRecoveryActions(
2959    maxActions           IN number
2960   ,containerMask        IN number
2961   ,actionMask           IN number);
2962 
2963 -- trimRecoveryActions will trim the stack down to the specified number
2964 -- actions if it contains more.  This is used by report obsolete to implement
2965 -- the redundancy count.  The reason for it is that getRecoveryActions
2966 -- returns actions in LIFO order.  This means the oldest actions, which
2967 -- were stacked most recently, are returned first.  However, report obsolete
2968 -- wants to keep only the most recent backups when constructing the
2969 -- "must keep" list.  We solve the problem by getting rid of any excess
2970 -- actions first, and so the order in which getRecoveryActions returns them
2971 -- won't matter.  Note that only actions whose type_con and type_act are
2972 -- selected by the masks will be deleted.  Other actions are left on the
2973 -- stack.
2974 
2975 ---------------------
2976 -- Report Obsolete --
2977 ---------------------
2978 
2979 PROCEDURE reportTranslateDFDel ;
2980 
2981 -- pre 8.1.5 version
2982 FUNCTION reportGetDFDel(
2983    file#               OUT number
2984   ,filetype            OUT number
2985   ,checkpoint_change#  OUT number
2986   ,checkpoint_time     OUT date
2987   ,resetlogs_change#   OUT number
2988   ,resetlogs_time      OUT date
2989   ,incremental_change# OUT number
2990   ,fuzzy_change#       OUT number
2991   ,recid               OUT number
2992   ,stamp               OUT number
2993   ,fname               OUT varchar2
2994   ,restorable          OUT number)
2995 RETURN number;
2996 
2997 -- 8.1.5+ version
2998 FUNCTION reportGetDFDel(
2999    file#               OUT number
3000   ,filetype            OUT number
3001   ,checkpoint_change#  OUT number
3002   ,checkpoint_time     OUT date
3003   ,resetlogs_change#   OUT number
3004   ,resetlogs_time      OUT date
3005   ,incremental_change# OUT number
3006   ,fuzzy_change#       OUT number
3007   ,recid               OUT number
3008   ,stamp               OUT number
3009   ,fname               OUT varchar2
3010   ,restorable          OUT number
3011   ,key                 OUT number
3012   ,completion_time     OUT date)
3013 RETURN number;
3014 
3015 ------------
3016 -- TSPITR --
3017 ------------
3018 
3019 FUNCTION getCloneName(
3020    fno    IN number
3021   ,crescn IN number
3022   ,pluscn IN number DEFAULT 0)
3023 RETURN varchar2;
3024 
3025 
3026 ---------------
3027 -- DUPLICATE --
3028 ---------------
3029 
3030 FUNCTION wasFileOffline(
3031    fno    IN number
3032   ,untilscn IN number)
3033 RETURN number;
3034 
3035 -------------------------
3036 -- RMAN Configuration ---
3037 -------------------------
3038 
3039 procedure getConfig(
3040    conf#          OUT    number
3041   ,name           IN OUT varchar2
3042   ,value          IN OUT varchar2
3043   ,first          IN     boolean);
3044 
3045 ------------------------------
3046 -- Get max(copy#) --
3047 ------------------------------
3048 
3049 FUNCTION getmaxcopyno(
3050    bsstamp         IN    number
3051   ,bscount         IN    number)
3052 RETURN number;
3053 
3054 --------------------------
3055 -- Add Corruption Table --
3056 --------------------------
3057 
3058 PROCEDURE bmrAddCorruptTable(
3059    dfnumber    OUT number
3060   ,blknumber   OUT number
3061   ,range       OUT number
3062   ,first       IN  boolean);
3063 
3064 ------------------------
3065 -- Get Backup History --
3066 ------------------------
3067 
3068 PROCEDURE getDfBackupHistory(
3069    backedUpDev     IN   varchar2
3070   ,first           IN   boolean
3071   ,bhistoryRec     OUT  NOCOPY bhistoryRec_t
3072   ,recentbackup    IN   boolean DEFAULT FALSE  -- get no: recent backups
3076   ,toDest2         IN   varchar2 DEFAULT NULL
3073   ,doingCmd        IN   varchar2 DEFAULT NULL
3074   ,keepTag         IN   varchar2 DEFAULT NULL
3075   ,toDest1         IN   varchar2 DEFAULT NULL
3077   ,toDest3         IN   varchar2 DEFAULT NULL
3078   ,toDest4         IN   varchar2 DEFAULT NULL);
3079 
3080 PROCEDURE getAlBackupHistory(
3081    backedUpDev     IN   varchar2
3082   ,first           IN   boolean
3083   ,bhistoryRec     OUT  NOCOPY bhistoryRec_t
3084   ,doingCmd        IN   varchar2 DEFAULT NULL
3085   ,keepTag         IN   varchar2 DEFAULT NULL
3086   ,toDest1         IN   varchar2 DEFAULT NULL
3087   ,toDest2         IN   varchar2 DEFAULT NULL
3088   ,toDest3         IN   varchar2 DEFAULT NULL
3089   ,toDest4         IN   varchar2 DEFAULT NULL);
3090 
3091 PROCEDURE getBsBackupHistory(
3092    backedUpDev     IN   varchar2
3093   ,first           IN   boolean
3094   ,set_stamp       IN   number DEFAULT NULL
3095   ,set_count       IN   number DEFAULT NULL
3096   ,bhistoryRec     OUT  NOCOPY bhistoryRec_t
3097   ,doingCmd        IN   varchar2 DEFAULT NULL
3098   ,keepTag         IN   varchar2 DEFAULT NULL
3099   ,toDest1         IN   varchar2 DEFAULT NULL
3100   ,toDest2         IN   varchar2 DEFAULT NULL
3101   ,toDest3         IN   varchar2 DEFAULT NULL
3102   ,toDest4         IN   varchar2 DEFAULT NULL);
3103 
3104 PROCEDURE getDcBackupHistory(
3105    backedUpDev     IN   varchar2
3106   ,first           IN   boolean
3107   ,bhistoryRec     OUT  NOCOPY bhistoryRec_t
3108   ,doingCmd        IN   varchar2 DEFAULT NULL
3109   ,keepTag         IN   varchar2 DEFAULT NULL
3110   ,toDest1         IN   varchar2 DEFAULT NULL
3111   ,toDest2         IN   varchar2 DEFAULT NULL
3112   ,toDest3         IN   varchar2 DEFAULT NULL
3113   ,toDest4         IN   varchar2 DEFAULT NULL
3114   ,atAnyScn        IN   boolean  DEFAULT FALSE);
3115 
3116 -- Obsolute as of 9.2.0.1
3117 PROCEDURE getBackupHistory(
3118    dfRec            IN  dfRec_t
3119   ,backedUpDev      IN  varchar2
3120   ,nbackupsFlag     IN  number
3121   ,bscompletionFlag IN  number
3122   ,nbackups         OUT number
3123   ,bscompletion     OUT date);
3124 
3125 -- Obsolute as of 9.2.0.1
3126 PROCEDURE getBackupHistory(
3127    alRec            IN  alRec_t
3128   ,backedUpDev      IN  varchar2
3129   ,nbackupsFlag     IN  number
3130   ,bscompletionFlag IN  number
3131   ,nbackups         OUT number
3132   ,bscompletion     OUT date);
3133 
3134 PROCEDURE getBackupHistory(
3135    bpRec            IN  bpRec_t
3136   ,backedUpDev      IN  varchar2
3137   ,nbackupsFlag     IN  number
3138   ,bscompletionFlag IN  number
3139   ,nbackups         OUT number
3140   ,bscompletion     OUT date
3141   ,toDest1          IN  varchar2 DEFAULT NULL
3142   ,toDest2          IN  varchar2 DEFAULT NULL
3143   ,toDest3          IN  varchar2 DEFAULT NULL
3144   ,toDest4          IN  varchar2 DEFAULT NULL);
3145 
3146 ------------------
3147 -- Version Info --
3148 ------------------
3149 
3150 FUNCTION getPackageVersion
3151 RETURN varchar2;
3152 
3153 ------------------
3154 -- Simple Calls --
3155 ------------------
3156 FUNCTION isStatusMatch(status      IN VARCHAR2,
3157                        mask        IN NUMBER) RETURN NUMBER;
3158 FUNCTION isDeviceTypeAllocated(deviceType IN varchar2)
3159                       RETURN NUMBER;
3160 FUNCTION isBackupTypeMatch(btype       IN VARCHAR2,
3161                            mask        IN binary_integer)
3162                                               RETURN NUMBER;
3163 ------------------------------
3164 -- set rcvRecBackupAge value --
3165 -------------------------------
3166 PROCEDURE setRcvRecBackupAge(age IN number);
3167 
3168 ------------------------------
3169 -- reset thisBackupAge value --
3170 -------------------------------
3171 PROCEDURE resetthisBackupAge;
3172 
3173 -------------------------------------
3174 -- List (Obsolete) Backup Function --
3175 -------------------------------------
3176 
3177 PROCEDURE getRetentionPolicy(recovery_window OUT number
3178                             ,redundancy      OUT number);
3179 --
3180 -- The function getRetentionPolicy is used to get currently configured
3181 -- retention policy.
3182 --
3183 
3184 FUNCTION listBackup(lbRecOut         OUT     NOCOPY lbRec_t
3185                    ,firstCall        IN      boolean
3186                    ,only_obsolete    IN      boolean
3187                    ,redundancy       IN      number
3188                    ,piped_call       IN      boolean
3189                    ,lbCursor         IN  OUT NOCOPY lbCursor_t
3190                    ,lbState          IN  OUT NOCOPY lbState_t
3191                    ,extRlKeepSCN     IN      number DEFAULT NULL)
3192   RETURN boolean;
3193 
3194 --
3195 -- The function listBackup lists (obsolete) backups (backup sets, pieces,
3196 -- copies, proxy copies, and archived logs).
3197 --
3198 -- The parameter firstCall must be TRUE on the very first call of the function.
3199 -- The return of the function is stored in lbRecOut. However the function can
3200 -- return without putting data in lbRecOut, so the caller should always check
3201 -- whether lbRecOut is NULL.
3202 -- If the exit code of the function is FALSE, then it means that all there
3203 -- no more data to be returned.
3204 --
3205 -- piped_call   - If FALSE, you must pass dbms_rcvman.lbStatePck as lbState.
3206 -- extRlKeepSCN - When passed a non-null value, the algorithm ensure to
3207 --                keep all archivelogs at and above this scn.
3208 
3212 FUNCTION getRestoreRangeSet(restoreRangeTab OUT restoreRangeTab_t
3209 
3210 ------------------------------ getRestoreRangeSet -----------------------------
3211 
3213                            ,opCode  IN  varchar2
3214                            ,db_id   IN  number)
3215 
3216   RETURN boolean;
3217 
3218 -- Function getRestoreRangeSet finds the set of restore ranges of a database.
3219 
3220 PROCEDURE setNeedObsoleteData(NeedObsoleteData IN boolean DEFAULT TRUE);
3221 -- The function is an optimization fix to not to call computeRecoveryAction if
3222 -- client is not interested in obsolete column value.
3223 
3224 ----------------------------- getCopyofDatafile -------------------------------
3225 
3226 -- This function obtains the latest AVAILABLE datafilecopy for all translated
3227 -- datafiles (and possibly the datafilecopies having a specific tag).
3228 PROCEDURE getCopyofDatafile(
3229    first          IN      boolean     -- TRUE if this is the first time called
3230   ,itag           IN      varchar2    -- tag that the copy should have or NULL
3231   ,fno            OUT     number      -- datafile number
3232   ,crescn         OUT     number      -- creation scn of the datafile
3233   ,rlogscn        OUT     number      -- resetlogs scn of the datafile
3234   ,rlgtime        OUT     date        -- resetlogs time of the datafile
3235   ,recid          OUT     binary_integer -- recid of the latest datafilecopy
3236   ,stamp          OUT     binary_integer -- stamp of the latest datafilecopy
3237   ,name           OUT     varchar2    -- name of the datafilecopy
3238   ,otag           OUT     varchar2    -- tag of the datafilecopy
3239   ,status         OUT     varchar2    -- status of the datafilecopy
3240   ,nblocks        OUT     binary_integer -- number of blocks of datafilecopy
3241   ,bsz            OUT     binary_integer -- blocksize of the datafilecopy
3242   ,ctime          OUT     date        -- creation time of the datafilecopy
3243   ,toscn          OUT     number      -- checkpoint scn of the datafilecopy
3244   ,totime         OUT     date        -- checkpoint time of the datafilecopy
3245   ,pluggedRonly   OUT     binary_integer -- 1 for read-only. Otherwise, 0
3246   ,pluginSCN      OUT     number      -- plugin scn
3247   ,pluginRlgSCN   OUT     number      -- resetlogs when datafile was plugged
3248   ,pluginRlgTime  OUT     date);      -- resetlog time when df was plugged
3249 
3250 -- This function obtains the latest AVAILABLE datafilecopy for a given
3251 -- datafile number (and possibly the datafilecopy having a specific tag).
3252 -- It returns all the information identifying the datafilecopy.
3253 -- Obsolete as of 12g
3254 
3255 PROCEDURE getCopyofDatafile(
3256    dfnumber       IN      number      -- datafile number
3257   ,itag           IN      varchar2    -- tag that the copy should have or NULL
3258   ,crescn         IN  OUT number      -- creation scn of the datafile
3259   ,rlogscn        IN  OUT number      -- resetlogs scn of the datafile
3260   ,rlgtime        IN  OUT date        -- resetlogs time of the datafile
3261   ,recid          OUT     binary_integer -- recid of the latest datafilecopy
3262   ,stamp          OUT     binary_integer -- stamp of the latest datafilecopy
3263   ,name           OUT     varchar2    -- name of the datafilecopy
3264   ,otag           OUT     varchar2    -- tag of the datafilecopy
3265   ,status         OUT     varchar2    -- status of the datafilecopy
3266   ,nblocks        OUT     binary_integer -- number of blocks of datafilecopy
3267   ,bsz            OUT     binary_integer -- blocksize of the datafilecopy
3268   ,ctime          OUT     date        -- creation time of the datafilecopy
3269   ,toscn          OUT     number      -- checkpoint scn of the datafilecopy
3270   ,totime         OUT     date        -- checkpoint time of the datafilecopy
3271   ,pluggedRonly   OUT     binary_integer -- 1 for read-only. Otherwise, 0
3272   ,pluginSCN      IN      number);    -- plugin scn
3273 
3274 -- This function obtains the latest AVAILABLE datafilecopy for a given
3275 -- datafile number (and possibly the datafilecopy having a specific tag).
3276 -- It returns all the information identifying the datafilecopy.
3277 -- Obsolete as of 11g
3278 
3279 PROCEDURE getCopyofDatafile(
3280    dfnumber    IN  number          -- datafile number
3281   ,itag        IN  varchar2        -- tag that the copy should have or NULL
3282   ,crescn      IN  number          -- creation scn of the datafile
3283   ,rlogscn     IN  number          -- resetlogs scn of the datafile
3284   ,rlgtime     IN  date            -- resetlogs time of the datafile
3285   ,recid       OUT binary_integer  -- recid of the latest datafilecopy
3286   ,stamp       OUT binary_integer  -- stamp of the latest datafilecopy
3287   ,name        OUT varchar2        -- name of the datafilecopy
3288   ,otag        OUT varchar2        -- tag of the datafilecopy
3289   ,status      OUT varchar2        -- status of the datafilecopy
3290   ,nblocks     OUT binary_integer  -- number of blocks of the datafilecopy
3291   ,bsz         OUT binary_integer  -- blocksize of the datafilecopy
3292   ,ctime       OUT date            -- creation time of the datafilecopy
3293   ,toscn       OUT number          -- checkpoint scn of the datafilecopy
3294   ,totime      OUT date);          -- checkpoint time of the datafilecopy
3295 
3296 ---------------
3297 -- Aged File --
3298 ---------------
3299 PROCEDURE getdropOSFiles(
3300    first         IN  boolean
3301   ,agedFileRec   OUT NOCOPY agedFileRec_t);
3302 
3303 PROCEDURE getBackedUpFiles(
3304    first         IN  boolean
3305   ,agedFileRec   OUT NOCOPY agedFileRec_t);
3306 
3307 -- getRedoLogDeletion Policy --
3311 
3308 -- Returns the policyType string as 'TO NONE' or 'TO APPLIED ON STANDBY' --
3309 PROCEDURE getRedoLogDeletionPolicy(
3310    policy        OUT varchar2);
3312 -- setRedoLogDeletion Policy --
3313 -- Initialize global variables
3314 -- a) policyType to 'TO NONE' or 'TO APPLIED ON STANDBY'
3315 -- b) policyBind to 'MANDATORY' or 'NULL'
3316 -- c) policyTarget to 'NULL', 'STANDBY' or 'REMOTE'
3317 --
3318 -- If standbyConfig validation failed to enfore the specified policyType,
3319 -- then we fallback to 'NONE' policy.
3320 --
3321 -- Input parameters:
3322 --  policy  - 'TO NONE' or 'TO APPLIED ON STANDBY'
3323 --  alldest - TRUE indicates the policyType is enforced on all destinations.
3324 --            Otherwise, only MANDATORY destination is honored.
3325 --
3326 PROCEDURE setRedoLogDeletionPolicy(
3327    policy  IN  varchar2
3328   ,alldest IN  number);
3329 
3330 -- For a specified policyType, validate the standby configuration.
3331 -- Basically, it checks if there is atleast one destination on which the
3332 -- APPLIED policy can be enforced. Returns TRUE on success. Otherwise,
3333 -- FALSE.
3334 --
3335 FUNCTION validateStandbyConfig(
3336    policy  IN  varchar2
3337   ,alldest IN  number)
3338 RETURN NUMBER;
3339 
3340 -- getSCNForAppliedPolicy--
3341 -- Must be called after setRedoLogDeletionPolicy call.
3342 -- The function is intended to compute the SCN
3343 -- above which all archivelogs are kept for TO APPLIED|SHIPPED policy.
3344 --
3345 -- Output Parameters:
3346 --    minscn  - minimum scn that is applied on all standby and
3347 --              guaranteed restore point
3348 --    rlgscn  - resetlogs scn corresponding to minscn
3349 --
3350 PROCEDURE getSCNForAppliedPolicy(
3351    minscn    OUT  number
3352   ,rlgscn    OUT  number);
3353 
3354 -- getAppliedAl --
3355 -- Return archivelogs records that has been applied on all destinations
3356 -- specified by validateStandbyConfig TARGET string and redoLogDeletionPolicy.
3357 --
3358 -- Input parameters:
3359 --    first        - Pass it TRUE when you are calling for first time.
3360 --    agedFileRec  - Archivelog record that can be deleted.
3361 --
3362 PROCEDURE getAppliedAl(
3363    first         IN  boolean
3364   ,agedFileRec   OUT NOCOPY agedFileRec_t);
3365 
3366 -- getRequiredSCN --
3367 -- Calculate the lowest gap for all destinations.  Calculate the highest
3368 -- scn available on all valid standby destinations.  If no gap, return the
3369 -- high scn, otherwise return the gap. If streams is true consider streams
3370 -- also when computing remote destination required SCN.
3371 PROCEDURE getRequiredSCN(
3372    reqscn   OUT  number
3373   ,rlgscn   OUT  number
3374   ,streams  IN   number DEFAULT 0
3375   ,alldest  IN   number DEFAULT 0);
3376 
3377 -- getAppliedSCN --
3378 -- returns the SCN till where the logs are applied at physical standby database
3379 PROCEDURE getAppliedSCN(
3380    appscn   OUT  number
3381   ,rlgscn   OUT  number
3382   ,alldest  IN   number);
3383 
3384 -- Is this file translated by RMAN?
3385 -- Returns TRUE# if translated. Otherwise, FALSE#
3386 FUNCTION isTranslatedFno(fno IN number) RETURN NUMBER;
3387 
3388 -- Is this a match in cacheBsRec Table?.
3389 -- Returns TRUE# if hit. Otherwise, FALSE#
3390 FUNCTION isBsRecCacheMatch(
3391    key         IN   number
3392   ,deviceType  IN   varchar2
3393   ,tag         IN   varchar2
3394   ,status      IN   varchar2)
3395 RETURN NUMBER;
3396 
3397 -- Reset reclaimable record.
3398 PROCEDURE resetReclRecid;
3399 
3400 -- Set Reclaimable record.
3401 PROCEDURE setReclRecid(
3402    rectype  IN  binary_integer
3403   ,recid    IN  number);
3404 
3405 -- Is this record reclaimable?
3406 -- Returns TRUE# if so. Otherwise, FALSE#.
3407 FUNCTION IsReclRecid(
3408    rectype  IN  binary_integer
3409   ,recid    IN  number)
3410 RETURN NUMBER;
3411 
3412 -- Return space reclaimable in bytes for files in reclaimable record table
3413 -- ceilAsm - when TRUE, ceil ASM file size in MB
3414 FUNCTION getSpaceRecl(ceilAsm IN binary_integer default 0) RETURN NUMBER;
3415 
3416 -- Given a name return information about the restore point.
3417 PROCEDURE getRestorePoint(
3418    name         IN varchar2
3419   ,rlgscn       OUT number
3420   ,rlgtime      OUT date
3421   ,scn          OUT number
3422   ,guaranteed   OUT number);
3423 
3424 -- Prep for LIST RESTORE POINT [name/null]
3425 PROCEDURE listTranslateRestorePoint(
3426    name       IN  varchar2);
3427 
3428 -- Fetch for LIST RESTORE POINT [name/null]
3429 PROCEDURE listGetRestorePoint(
3430    name         OUT varchar2
3431   ,scn          OUT number
3432   ,rsptime      OUT date
3433   ,cretime      OUT date
3434   ,rsptype      OUT varchar2);
3435 
3436 -- Convert input number to displayable canonical format. The number is
3437 -- converted to nearest M (mega bytes)/ G (giga bytes)/ T (tera bytes)
3438 -- /P (peta bytes).
3439 FUNCTION Num2DisplaySize(input_size IN NUMBER) return VARCHAR2;
3440 
3441 -- Convert input seconds to displayable canonical format [HH:MM:SI]
3442 FUNCTION Sec2DisplayTime(input_secs IN NUMBER) return VARCHAR2;
3443 
3444 FUNCTION getEncryptTSCount RETURN BINARY_INTEGER;
3445 
3446 -- Hint to indicate the archivelog that is interested. Later,
3447 -- isTranslatedArchivedLog can be called to verify the presence. It doesn't
3448 -- take resetlogs information in order to keep it simple. It is responsible
3452   ,sequence# IN  number
3449 -- for the client to validate further by comparing resetlogs information.
3450 PROCEDURE setArchivedLogRecord(
3451    thread#   IN  number
3453   ,first     IN  boolean);
3454 
3455 -- To indicate that the database can handle backup transportable tablespace.
3456 -- Hence, RMAN client should make the plugged readonly files visible for
3457 -- translation.
3458 PROCEDURE setCanHandleTransportableTbs(
3459    flag IN boolean);
3460 
3461 -- Return the maximum next SCN to which the database can be recovered using
3462 -- archived logs.
3463 FUNCTION getArchivedNextSCN RETURN NUMBER;
3464 
3465 -- Check if there a log is missing between fromscn to untilscn. Return TRUE
3466 -- if a log is missing. Otherwise, FALSE.
3467 FUNCTION isArchivedLogMissing(fromSCN IN NUMBER, untilSCN IN NUMBER)
3468   RETURN NUMBER;
3469 
3470 -- Finds the next available SCN from archived log registered in the catalog
3471 -- after fromScn. Retrun FALSE if no SCN found else returns TRUE
3472 FUNCTION getNextAvailableSCN(fromScn           IN  NUMBER,
3473                              nextAvailableSCN  OUT  NUMBER,
3474                              isOrs             IN   NUMBER)
3475   RETURN BOOLEAN;
3476 
3477 -- Finds the point where continuity of archived logs breaks
3478 FUNCTION findLogBreakPoint(logBreakPointScn        OUT NUMBER,
3479                            logBreakPointTime       OUT DATE,
3480                            logBreakPointDbIncKey   OUT NUMBER,
3481                            logBreakPointRlgScn     OUT NUMBER,
3482                            logBreakPointRlgTime    OUT DATE,
3483                            fromSCN                 IN  NUMBER,
3484                            untilSCN                IN  NUMBER,
3485                            isOrs                   IN  NUMBER)
3486   RETURN boolean;
3487 
3488 -- Added in 12.1
3489 -- Finds out the maximum scn of the redo logs
3490 FUNCTION getMaxRedoSCN(maxScn      OUT NUMBER,
3491                        maxTime     OUT DATE,
3492                        maxDbIncKey OUT NUMBER,
3493                        maxRlgScn   OUT NUMBER,
3494                        maxRlgTime  OUT DATE,
3495                        isOrs       IN  NUMBER)
3496    RETURN boolean;
3497 
3498 -- Sets the global variable RestoreRangeDevTyp
3499 PROCEDURE setRestoreRangeDevTyp(typ IN VARCHAR2);
3500 
3501 -- Resets the global variable RestoreRangeDevTyp
3502 PROCEDURE resetRestoreRangeDevTyp;
3503 
3504 PROCEDURE setSkipOfflineRangeAboveSCN(maxCheckpointSCN IN NUMBER);
3505 
3506 -- Return the incarnation key to which the untilscn belongs if the untilscn
3507 -- is in one of its parent. 0 to indicate if the untilscn is in current
3508 -- incarnation.
3509 
3510 -- Added in 12.1
3511 -- Finds out the drop_scn for a datafile
3512 FUNCTION getDropSCN(dfNum        IN NUMBER,
3513                     creScn       IN  NUMBER,
3514                     creTime      IN  DATE,
3515                     plugScn      IN  NUMBER,
3516                     foreignDbId  IN  NUMBER,
3517                     dropScn      OUT NUMBER,
3518                     dropTime     OUT DATE,
3519                     dropDbIncKey OUT NUMBER,
3520                     dropRlgScn   OUT NUMBER,
3521                     dropRlgTime  OUT DATE)
3522 RETURN boolean;
3523 
3524 -- Return the incarnation key to which the untilscn belongs if the untilscn
3525 -- is in one of its parent. 0 to indicate if the untilscn is in current
3526 -- incarnation.
3527 FUNCTION getIncarnationKey(untilSCN IN NUMBER) RETURN NUMBER;
3528 
3529 -- Hint to indicate the dbid that is interested. Later, isTranslatedDbid can
3530 -- be called to verify the presence.
3531 PROCEDURE setDbidTransClause(dbid IN number);
3532 
3533 -- Is this dbid translated by RMAN?
3534 -- Returns TRUE# if translated. Otherwise, FALSE#
3535 FUNCTION isTranslatedDbid(dbid IN number) RETURN NUMBER;
3536 
3537 -- Obtain maximum scn from archived logs registered in the catalog
3538 -- Obsolete in 11.2
3539 FUNCTION getMaxScn RETURN number;
3540 
3541 FUNCTION getMaxScn(logmaxnt OUT date) RETURN NUMBER;
3542 
3543 FUNCTION getActualDbinc RETURN number;
3544 -- Returns the key of the incarnation that a previous set until
3545 -- performed with allIncarnations = TRUE# ended up using when
3546 -- the current incarnation was not selected.  This is a recovery catalog
3547 -- only function.
3548 -- At the time of introduction of this function, it is only used by
3549 -- targetless duplicate.
3550 
3551 FUNCTION translatePdbName(pdbName IN VARCHAR2) RETURN NUMBER;
3552 -- Converts a pdb name into a pdbid.
3553 
3554 PROCEDURE resetPdbIdList;
3555 -- Clear the pdbIdList that is used for translation.
3556 
3557 PROCEDURE setPdbId(pdbId IN NUMBER, first IN BOOLEAN);
3558 -- Set the given pdbid in pdbIdList. When first is TRUE, then clear existing
3559 -- list before setting. This list is used for translation of database.
3560 
3561 FUNCTION isTranslatedPdbId(pdbId IN NUMBER) RETURN NUMBER;
3562 -- Is this pdbid translated by RMAN?. Returns TRUE# if translated.
3563 -- FALSE# otherwise.
3564 
3565 FUNCTION isPdbScnOrphan(untilSCN IN NUMBER, pdbId IN NUMBER) RETURN NUMBER;
3566 -- Returns TRUE# if the untilSCN is in orphan branch of PDB. Otherwise,
3567 -- FALSE#.
3568 
3569 
3570 -----------------------------------
3571 -- Intelligent Repair Procedures --
3572 -----------------------------------
3573 
3574 ----------------------------- isInFailureList ---------------------------------
3575 --
3579 --
3576 -- isInFailureList is called to find out whether the parent_id or failureid
3577 -- is part of getFailureNumList or getFailureExclude list.
3578 -- Return TRUE# if present in failure_list.  Otherwise, return FALSE#.
3580 -- Input parameters:
3581 --    parent_id   : parent id in question
3582 --    failureid   : failure id in question
3583 --    for_exclude : > 0 if to look up getFailureExclude. Otherwise, 0
3584 --                  to look up getFailureNumList.
3585 --
3586 FUNCTION isInFailureList(
3587    parentId     IN number
3588   ,failureId    IN number
3589   ,for_exclude  IN binary_integer
3590   )
3591 RETURN NUMBER;
3592 
3593 ----------------------------- createFailureList -------------------------------
3594 --
3595 -- createFailureList is called to initialize a failure list in dbms_rcvman
3596 -- package.
3597 --
3598 -- Input parameters:
3599 --    first_call  : Pass it as TRUE if this is first entry in the list
3600 --    failureId   : The failure id to be added to the list
3601 --    for_exclude : FALSE to initialize getFailureNumList and TRUE to
3602 --                  initialize getFailureExclude list.
3603 --
3604 PROCEDURE createFailureList(
3605    first_call   IN boolean
3606   ,failureId    IN number
3607   ,for_exclude  IN boolean);
3608 
3609 ------------------------------ translateFailure -------------------------------
3610 --
3611 -- translateFailure is called to open the cursor in order to retrieve the list
3612 -- of failures (using getFailure) from ADR. createFailureList may be
3613 -- called before this function to initialize getFailureNumList and
3614 -- getFailureExclude list which is used to filter the output that corresponds
3615 -- to FAILNUM or EXCLUDE FAILNUM option in the grammar.
3616 --
3617 -- Input Parameters:
3618 --    critical   :  > 0 if priority is critical or ALL. Otherwise, 0.
3619 --    high       :  > 0 if priroity is high or ALL. Otherwise, 0.
3620 --    low        :  > 0 if priority is low or ALL. Otherwise, 0.
3621 --    unknown    :  > 0 if priority is unknown or ALL. Otherwise, 0.
3622 --    closed     :  > 0 if to list closed failures. Otherwise, 0.
3623 --    adviseId   :  If non-null adviseid is passed, then other parameters
3624 --                  are ignored because adviseid the grammar doesn't
3625 --                  allow adviseid with other options.
3626 --
3627 PROCEDURE translateFailure(
3628    critical        IN  binary_integer
3629   ,high            IN  binary_integer
3630   ,low             IN  binary_integer
3631   ,unknown         IN  binary_integer default 0
3632   ,closed          IN  binary_integer
3633   ,adviseId        IN  number);
3634 
3635 --------------------------------- getFailure ----------------------------------
3636 --
3637 -- getFailure is called to retrieve the failure list whose cursor is opened
3638 -- by translateFailure procedure. Until it returns no-data-found exception,
3639 -- this function is called again and again to retrieve all the failures.
3640 --
3641 -- Output Parameters:
3642 --    failureRec   : failure record that describes the failure.
3643 --
3644 PROCEDURE getFailure(
3645    failureRec      OUT NOCOPY failureRec_t);
3646 
3647 ------------------------------ translateRepair --------------------------------
3648 --
3649 -- translateRepair is called to open the cursor in order to retrieve the list
3650 -- of repairs (using getRepair).
3651 --
3652 -- Input Parameters:
3653 --    adviseId   :  available repairs that corresponds to this advise id.
3654 --
3655 PROCEDURE translateRepair(
3656    adviseid        IN  number);
3657 
3658 ----------------------------------- getRepair ---------------------------------
3659 --
3660 -- getRepair is called to retrieve the repair list whose cursor is opened
3661 -- by translateRepair procedure. Until it returns no-data-found exception,
3662 -- this function is called again and again to retrieve all the options.
3663 --
3664 -- Output Parameters:
3665 --    repairRec: repair record that describes the repair.
3666 --
3667 PROCEDURE getRepair(
3668    repairRec OUT NOCOPY repairRec_t);
3669 
3670 -------------------------- translateRepairParms -------------------------------
3671 --
3672 -- translateRepairParms is called to open the cursor in order to retrieve
3673 -- the list of repair parameters(using getRepairParms).
3674 --
3675 -- Input Parameters:
3676 --    adviseId   :  available repairs that corresponds to this advise id.
3677 --
3678 PROCEDURE translateRepairParms(
3679    adviseid        IN  number);
3680 
3681 --------------------------------- getRepairParms -----------------------------
3682 --
3683 -- getRepairParms is called to retrieve the repair parameters whose cursor
3684 -- is opened by translateRepairParms procedure. Until it returns no-data-found
3685 -- exception, this function is called again and again to retrieve all
3686 -- the repair parameters.
3687 --
3688 -- Output Parameters:
3689 --    repairRecParams: repair record that describes the repair.
3690 --
3691 PROCEDURE getRepairParms(
3692    repairParmsRec OUT NOCOPY repairParmsRec_t);
3693 
3694 ---------------------------- translateRepairOption --------------------------
3695 --
3696 -- translateRepairOption is called to open the cursor in order to retrieve
3697 -- the list of repair option (using getRepairOption).
3698 --
3699 -- Input Parameters:
3700 --    adviseId   :  available repair option that corresponds to this advise id.
3701 --
3702 PROCEDURE translateRepairOption(
3703    adviseid        IN  number);
3704 
3708 -- is opened by translateRepairOption procedure. Until it returns
3705 ------------------------------- getRepairOption -------------------------------
3706 --
3707 -- getRepairOption is called to retrieve the repair option list whose cursor
3709 -- no-data-found exception, this function is called again and again to
3710 -- retrieve all the options.
3711 --
3712 -- Output Parameters:
3713 --    repairOptionRec: repair option record that describes the option.
3714 --
3715 PROCEDURE getRepairOption(
3716    repairOptionRec OUT NOCOPY repairOptionRec_t);
3717 
3718 ----------------------------- translateRepairStep ----------------------------
3719 --
3720 -- translateRepairStep is called to open the cursor in order to retrieve the
3721 -- list of repair step (using getRepairStep).
3722 --
3723 -- Input Parameters:
3724 --    optionidx:  available repair step that corresponds to this option idx.
3725 --
3726 PROCEDURE translateRepairStep(
3727    optionidx       IN  number);
3728 
3729 -------------------------------- getRepairStep --------------------------------
3730 --
3731 -- getRepairStep is called to retrieve the repair steps whose cursor
3732 -- is opened by translateRepairStep procedure. Until it returns
3733 -- no-data-found exception, this function is called again and again to
3734 -- retrieve all the steps.
3735 --
3736 -- Output Parameters:
3737 --    repairStepRec: repair step record that describes the step.
3738 --
3739 PROCEDURE getRepairStep(
3740    repairStepRec   OUT NOCOPY repairStepRec_t);
3741 
3742 ---------------------------- translateManualRepair ----------------------------
3743 --
3744 -- translateManualRepair is called to open the cursor in order to retrieve
3745 -- the list of manual repairs (using getManualRepair).
3746 --
3747 -- Input Parameters:
3748 --    adviseId   :  available manualrepairs that corresponds to this advise id.
3749 --
3750 PROCEDURE translateManualRepair(
3751    adviseId        IN  number);
3752 
3753 -------------------------------- getManualRepair ------------------------------
3754 --
3755 -- getManualRepair is called to retrieve the manual repair message whose cursor
3756 -- is opened by translateManualRepair procedure. Until it returns
3757 -- no-data-found exception, this function is called again and again to
3758 -- retrieve all the manual messages.
3759 --
3760 -- Return:
3761 --    Return the manual repair message.
3762 --
3763 FUNCTION getManualRepair(
3764    mandatory OUT varchar2)
3765 RETURN varchar2;
3766 
3767 ----------------------------- getRepairScriptName -----------------------------
3768 --
3769 -- getRepairScriptName is called to retrieve the repair script filename
3770 -- from v$ir_repair and description.
3771 --
3772 -- Input Parameters:
3773 --    repairId   :  retrieve repair script filename for this repair id
3774 -- Return:
3775 --    Return the repair script location and description.
3776 --
3777 FUNCTION getRepairScriptName(
3778    repairId       IN  number,
3779    description    OUT varchar2)
3780 RETURN varchar2;
3781 
3782 pragma TIMESTAMP('2000-03-12:13:51:00');
3783 
3784 END; -- dbms_rcvman or x$dbms_rcvman