Oracle DBMS_PITR
Version 21c

General Information
Library Note Morgan's Library Page Header
ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling complimentary technical Workshops on Database Security for the first 30 Oracle Database customers located anywhere in North America, EMEA, LATAM, or APAC that send an email to asra_us@oracle.com. Request a Workshop for your organization today.
Purpose This package contains procedures which get called during the import phase and export phase of Point-In-Time Recovery (PITR).

During the export phase, EXP calls this package to obtain the text of 2 anonymous PL/SQL blocks. The first block goes at the front of the .dmp file, and the second block goes at the end. In between the 2 blocks are the DDL commands created by EXP to reconstruct the dictionary for the tablespaces being PITR'd.

The emitted PL/SQL code contains calls to other procedures in this package. IMP must read each anonymous PL/SQL block from the .dmp file, collect it into a single contiguous memory buffer, and then parse and execute the PL/SQL block. The parsed SQL statement (the PL/SQL anonymous block) must precisely the lines of text that were returned to EXP from this package, with no characters added or deleted.

The order in which the "emit" procedures should be called is in the source file header.
AUTHID CURRENT_USER
Constants
Name Data Type Value
Version
TS_PITR_VERSION VARCHAR2(15) '8.1.5.0.0'
Block IDs
TS_PITR_BEGIN BINARY_INTEGER 1
TS_PITR_END BINARY_INTEGER 2
Dependencies
CLU$ OBJ$ UNDO$
DBMS_ASSERT PENDING_TRANS$ USER$
DBMS_PLUGTS SEG$ V$DATAFILE
DBMS_SQL TAB$ V$TABLESPACE
DBMS_SYS_ERROR TABPART$ X$KCCDI
DUAL TS$ X$KCCFE
FILE$    
Documented No
Exceptions
Error Code Reason
ORA-29300 pitr_others_num
ORA-29301 wrong_order_num
ORA-29302 database_not_open_clone_num
ORA-29303 user_not_SYS_num
ORA-29304 wrong_tsname_num
ORA-29305 not_read_only_num
ORA-29306 file_offline_num
ORA-29307 file_error_num
ORA-29308 pitr_check_num
ORA-29309 wrong_package_version_num
ORA-29310 not_open_primary_num
ORA-29311 database_not_match_num
ORA-29312 not_compatible_num
ORA-29313 ts_twice_num
ORA-29314 not_offline_for_recovery_num
ORA-29315 tablespace_recreated_num
ORA-29316 file_twice_num
ORA-29317 no_datafile_num
ORA-29318 file_online_num
ORA-29319 import_file_error_num
ORA-29320 fileheader_error_num
ORA-29321 too_many_file_num
First Available Not Known
Security Model Owned by SYS with EXECUTE granted to the EXECUTE_CATALOG_ROLE role
Source {ORACLE_HOME}/rdbms/admin/dbmspitr.sql
Subprograms
 
ADJUST_COMPATIBILITY
Checks the primary database compatibility segment dbms_pitr.adjust_compatibility(
comID IN VARCHAR2,
comRL IN VARCHAR2);
TBD
 
BEGINEXPORT
PLSQL Anonymous Block Emit Procedure dbms_pits.begin_export;
exec dbms_pits.begin_export;
 
BEGINIMPORT
Checks package version, database ID, resetlog SCN and stamp. Also alters the primary database SCN if necessary, and enables pseudo create syntax. dbms_pitr.begin_import(
packageVersion IN VARCHAR2,
databaseID     IN NUMBER,
resetSCN       IN NUMBER,
resetStamp     IN NUMBER,
highestSCN     IN NUMBER);
TBD
 
BEGINTABLESPACE
Called from an anonymous PL/SQL block embedded at the beginning of the .dmp file. The anonymous block is parsed and executed by IMP. dbms_pitr.beginTablespace(
tsid      IN BINARY_INTEGER,
createSCN IN NUMBER,
tsBitmap  IN NUMBER,
tsFlags   IN NUMBER,
tsSegfno  IN NUMBER,
tsSegbno  IN NUMBER,
tsSegsize IN NUMBER);
TBD
 
COMMITPITR
Called after all tablespaces have been registered by beginTablespace and endTablespace. This ICD drops the production tablespaces in tspitr set. dbms_pitr.commitPITR;
exec dbms_pitr.commitPITR;
 
DOFILEVERIFY
Must follow a beginTablespace call. The file must be for the tablespace. There must be one call for each datafile that is part of the tablespace (in the clone database). dbms_pitr.doFileVerify(
fno        IN BINARY_INTEGER,
tsid       IN BINARY_INTEGER,
ckptSCN    IN NUMBER,
resetSCN   IN NUMBER,
resetStamp IN NUMBER,
filesize   IN NUMBER,
hdba       IN NUMBER);
TBD
 
ENDIMPORT
Called after all tablespaces have been registered by beginTablespace and endTablespace. Drops the production tablespaces in tspitr set. dbms_pitr.endImport;
exec dbms_pitr.endImport;
 
ENDTABLESPACE
Builds a list of the files added between the current and the recovery point-in-time. Must follow the last doFileVerify call and must follow a beginTablespace call. dbms_pitr.endTablespace(
cleanSCN   IN NUMBER,
resetSCN   IN NUMBER,
resetStamp IN NUMBER);
exec dbms_pitr.endTablespace;
 
GETLINE
Returns the next line of a block that has been previously selected for retrieval via selectBlock dbms_pitr.getLine RETURN VARCHAR2;
SELECT dbms_pitr.getLine
FROM dual;
 
SELECTBLOCK
Selects a PL/SQL anonymous block for retrieval

The exception shown at right demonstrates what happens when a procedure is called, manually, in the wrong sequence
dbms_pitr.selectBlock(blockId IN BINARY_INTEGER);
exec dbms_pitr.selectBlock(424242);
*
ERROR at line 1:
ORA-29301: wrong DBMS_PITR package function/procedure order
ORA-06512: at "SYS.DBMS_PITR", line 855
ORA-06512: at "SYS.DBMS_PITR", line 846
ORA-06512: at line 1
 
SELECTTABLESPACE
Informs the package that the caller intends to do point-in-time recovery on the specified tablespace. Must be called once for each tablespace in the recovery set. It alter selected tablespace read only, also checks datafiles in the selected tablespace. dbms_pitr.selectTablespace(tsname IN VARCHAR2);
exec dbms_pitr.selectTablespace('USERS');

Related Topics
Backup, Restore, & Recovery
Built-in Functions
Built-in Packages
RMAN
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx