前几天Roger 的blog 更新了一篇文章,是DBMS_ROWID包的定义部分,Oracle 的包的都是用wrap 进行加密的。itpub上有人研究了unwrap,也公布了一些代码,可以实现unwrap。
关于wrap和unwrap,参考我的blog:
Oracle wrap 和 unwrap( 加密与解密) 说明
http://blog.csdn.net/tianlesoftware/article/details/6698535
rowid在DB 维护中用的也是比较多。 了解ROWID 的相关函数,有助于工作。
Oracle Rowid 介绍
http://blog.csdn.net/tianlesoftware/article/details/5020718
Roger贴的那部分没有只有代码,没有注释,所以这里用Toad 把注释部分也拉出来了。贴一下。也可以直接用SQL 查看:
SQL>select text from dba_source where name='DBMS_ROWID';
/* Formatted on2011/8/18 11:26:49 (QP5 v5.163.1008.3004) */
CREATE OR REPLACE PACKAGE SYS.DBMS_ROWID
IS
------------
-- OVERVIEW
--
-- This package provides procedures to createROWIDs and to interpret
-- their contents
-- SECURITY
--
-- The execution privilege is granted to PUBLIC.Procedures in this
-- package run under the caller security.
----------------------------
----------------------------
-- ROWID TYPES:
--
-- RESTRICTED - Restricted ROWID
--
-- EXTENDED- Extended ROWID
--
rowid_type_restricted CONSTANT INTEGER := 0;
rowid_type_extended CONSTANT INTEGER := 1;
-- ROWID VERIFICATION RESULTS:
--
-- VALID- Valid ROWID
--
-- INVALID - Invalid ROWID
--
rowid_is_valid CONSTANT INTEGER := 0;
rowid_is_invalid CONSTANT INTEGER := 1;
-- OBJECT TYPES:
--
-- UNDEFINED - Object Number not defined (forrestricted ROWIDs)
--
rowid_object_undefined CONSTANT INTEGER := 0;
-- ROWID CONVERSION TYPES:
--
-- INTERNAL - convert to/from column of ROWIDtype
--
-- EXTERNAL - convert to/from string format
--
rowid_convert_internal CONSTANT INTEGER := 0;
rowid_convert_external CONSTANT INTEGER := 1;
-- EXCEPTIONS:
--
--ROWID_INVALID - invalid rowid format
--
--ROWID_BAD_BLOCK - block is beyond end of file
--
ROWID_INVALID EXCEPTION;
PRAGMA EXCEPTION_INIT (ROWID_INVALID, -1410);
ROWID_BAD_BLOCK EXCEPTION;
PRAGMA EXCEPTION_INIT (ROWID_BAD_BLOCK, -28516);
-- PROCEDURES AND FUNCTIONS:
--
--
--ROWID_CREATE constructs a ROWID from its constituents:
--
--rowid_type - type (restricted/extended)
--object_number - data object number (rowid_object_undefined for restricted)
--relative_fno - relative file number
--block_number - block number in this file
--file_number - file number in this block
--
FUNCTION rowid_create (rowid_type IN NUMBER,
object_number IN NUMBER,
relative_fno IN NUMBER,
block_number IN NUMBER,
ROW_NUMBER IN NUMBER)
RETURN ROWID;
PRAGMA RESTRICT_REFERENCES (rowid_create, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_INFO breaks ROWID into its components and returns them:
--
--rowid_in - ROWID to be interpreted
--rowid_type - type (restricted/extended)
--object_number - data object number (rowid_object_undefined for restricted)
--relative_fno - relative file number
--block_number - block number in this file
-- file_number - file number in this block
--ts_type_in - type of tablespace which this row belongs to
-- 'BIGFILE' indicates BigfileTablespace
-- 'SMALLFILE' indicates Smallfile(traditional pre-10i) TS.
-- NOTE: These two are the onlyallowed values for this param
--
PROCEDURE rowid_info (rowid_in IN ROWID,
rowid_type OUT NUMBER,
object_number OUT NUMBER,
relative_fno OUT NUMBER,
block_number OUT NUMBER,
ROW_NUMBER OUT NUMBER,
ts_type_in IN VARCHAR2 DEFAULT 'SMALLFILE');
PRAGMA RESTRICT_REFERENCES (rowid_info, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_TYPE returns the type of a ROWID (restricted/extended_nopart,..)
--
--row_id - ROWID to be interpreted
--
FUNCTION rowid_type (row_idIN ROWID)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_type, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_OBJECT extracts the data object number from a ROWID.
--ROWID_OBJECT_UNDEFINED is returned for restricted rowids.
--
--row_id - ROWID to be interpreted
--
FUNCTION rowid_object (row_idIN ROWID)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_object, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_RELATIVE_FNO extracts the relative file number from a ROWID.
--
--row_id - ROWID to be interpreted
--ts_type_in - type of tablespace which this row belongs to
--
FUNCTION rowid_relative_fno (row_id IN ROWID,
ts_type_in IN VARCHAR2 DEFAULT 'SMALLFILE')
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_relative_fno, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_BLOCK_NUMBER extracts the block number from a ROWID.
--
--row_id - ROWID to be interpreted
--ts_type_in - type of tablespace which this row belongs to
--
--
FUNCTION rowid_block_number (row_id IN ROWID,
ts_type_in IN VARCHAR2 DEFAULT 'SMALLFILE')
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_block_number, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_ROW_NUMBER extracts the row number from a ROWID.
--
--row_id - ROWID to be interpreted
--
FUNCTION rowid_row_number (row_id IN ROWID)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_row_number, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_TO_ABSOLUTE_FNO extracts the relative file number from a ROWID,
--which addresses a row in a given table
--
--row_id - ROWID to be interpreted
--
--schema_name - name of the schema which contains the table
--
--object_name - table name
--
FUNCTION rowid_to_absolute_fno (row_id IN ROWID,
schema_name IN VARCHAR2,
object_name IN VARCHAR2)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_to_absolute_fno, WNDS, WNPS, RNPS);
--
--ROWID_TO_EXTENDED translates the restricted ROWID which addresses
-- arow in a given table to the extended format. Later, it may be removed
--from this package into a different place
--
--old_rowid - ROWID to be converted
--
--schema_name - name of the schema which contains the table (OPTIONAL)
--
--object_name - table name (OPTIONAL)
--
--conversion_type - rowid_convert_internal/external_convert_external
-- (whether old_rowid wasstored in a column of ROWID
-- type, or the characterstring)
--
FUNCTION rowid_to_extended (old_rowid IN ROWID,
schema_name IN VARCHAR2,
object_name IN VARCHAR2,
conversion_type IN INTEGER)
RETURN ROWID;
PRAGMA RESTRICT_REFERENCES (rowid_to_extended, WNDS, WNPS, RNPS);
--
--ROWID_TO_RESTRICTED translates the extnded ROWID into a restricted format
--
--old_rowid - ROWID to be converted
--
--conversion_type - internal/external (IN)
--
--conversion_type - rowid_convert_internal/external_convert_external
-- (whetherreturned rowid will be stored in a column of
-- ROWID type, or thecharacter string)
--
FUNCTION rowid_to_restricted (old_rowid IN ROWID,
conversion_type IN INTEGER)
RETURN ROWID;
PRAGMA RESTRICT_REFERENCES (rowid_to_restricted, WNDS, RNDS, WNPS, RNPS);
--
--ROWID_VERIFY verifies the ROWID. It returns rowid_valid or rowid_invalid
--value depending on whether a given ROWID is valid or not.
--
--rowid_in - ROWID to be verified
--
--schema_name - name of the schema which contains the table
--
--object_name - table name
--
--conversion_type - rowid_convert_internal/external_convert_external
-- (whether old_rowid wasstored in a column of ROWID
-- type, or the characterstring)
--
FUNCTION rowid_verify (rowid_in IN ROWID,
schema_name IN VARCHAR2,
object_name IN VARCHAR2,
conversion_type IN INTEGER)
RETURN NUMBER;
PRAGMA RESTRICT_REFERENCES (rowid_verify, WNDS, WNPS, RNPS);
END;
/
-------------------------------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Email: dvd.dba@gmail.com
DBA1 群:62697716(满); DBA2 群:62697977(满)DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群: 83829929(满)DBA5群: 142216823(满)
DBA6 群:158654907(满) 聊天 群:40132017(满) 聊天2群:69087192(满)
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
分享到:
相关推荐
ORACLE数据库使用dbms_stats包手动收集关于表的、索引的统计信息。
oracle dbms_lob
ORA-04063: package body SYS.DBMS_REGISTRY_SYS has errors
作用:DBMS_STATS.GATHER_TABLE_STATS统计表,列,索引的统计信息. DBMS_STATS.GATHER_TABLE_STATS的语法如下: DBMS_STATS.GATHER_TABLE_STATS ( ownname VARCHAR2, tabname VARCHAR2, partname VARCHAR2, estimate_...
Oracle DOM编程 文档,有要的没 Start from toc.htm DBMS_XMLDOM DBMS_XMLPARSER DBMS_XMLQUERY
Oracle实用工具RMAN的应用为DBA管理多个Oracle数据库提供了集中备份管理与恢复控制的机制,大大地减轻了DBA的工作压力,而DBMS_JOB包的使用增强了存储过程的应用功能,这样,他们就可以从备份数据及重复处理数据的...
dbms_obfuscation_toolkit加密解密数据
DBMS JOB包创建ORACLE定时任务
DBMS_XPLAN是Oracle提供的一个用于查看SQL计划,包括执行计划和解释计划的包;在以前查看SQL执行计划的时候,我都是使用set autotrace命令,不过现在看来,DBMS_XPLAN包给出了更加简化的获取和显示计划的方式。 这5...
对于偶尔需要进行 重做日志 解释的人(或者记力不是特别强的牛人)来讲,可能不太记得完整的DBMS_...鉴于以上的种种不便,在下对LOGMNER程序包,进行了封装,方便大量使用ORACLE 强大的日志分析工具dbms_logmner.
通过此版本可以把oracle时区版本调整到为最新版本,一般配合时区补丁使用 可以参考https://blog.csdn.net/weixin_43885834/article/details/105745901 https://download.csdn.net/download/weixin_43885834/12360971...
Oracle 18c bug 执行 DBMS_PDB.CHECK_PLUG_COMPATIBILITY报错_ITPUB博客.mhtml
oracle中DBMS_SQL的使用,详细讲解oracle DBMS_SQL的使用办法
说明:本文为Oracle11g收集各种统计信息(DBMS_STAT)的简要指导手册 温馨提示:如果您发现本文哪里写的有问题或者有更好的写法请留言或私信我进行修改优化 ● analyze始于Oracle7,但自从Oracle8.1.5引入dbms_stats...
支持ArcGIS10.2版本的PostgreSQL_DBMS_for_windows_922,ESRI官方原版资源。
详细介绍DBMS_JOB包的各函数操作,以及各函数对job的使用作用等。
ORACLE 数据库备份分为物理备份和逻辑备份。物理备份是数据库文件拷贝的备份,冷备份、热备份属于物理备份。 导出/导入(EXPORT/IMPORT)工具用于进行逻辑备份。冷备份是在数据库被正常关闭之后进行的数据文件的物理...
主要介绍了ORACLE随机数DBMS_RANDOM包,通过dbms_random包调用随机数的方法大致有4种,具体哪4种请看本篇文章吧
NULL 博文链接:https://wuaner.iteye.com/blog/717793
dbms_comp_advisor.getratio 预估压缩比例的存储过程脚本 11gR2以前使用,11gR2后可以使用系统自带的存储。