oracle底層字典表obj$及source$與儲存過程procedure系列二
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as SYS
SQL> conn scott/system@orcl
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as scott
SQL> create or replace procedure proc_obj
2 as
3 begin
4 null;
5 end;
6 /
Procedure created
SQL> conn sys/system@orcl as sysdba
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as SYS
SQL> select * from obj$ ob where ob.name='PROC_OBJ';
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
132740 84 PROC_OBJ 1 7 2012/11/16 2012/11/16 2012/11/16 1 0 6 65535 84
SQL> desc source$;
Name Type Nullable Default Comments
------ -------------- -------- ------- --------
OBJ# NUMBER
LINE NUMBER
SOURCE VARCHAR2(4000) Y
SQL> select * from source$ where obj#=132740;
OBJ# LINE SOURCE
---------- ---------- --------------------------------------------------------------------------------
132740 1 procedure proc_obj
132740 2 as
132740 3 begin
132740 4 null;
132740 5 end;
132740 6
6 rows selected
SQL> update source$ set source=replace(source,'proc_obj','proc_obj_new') where obj#=132740 and line=1;
1 row updated
SQL> commit;
Commit complete
SQL> select * from source$ where obj#=132740;
OBJ# LINE SOURCE
---------- ---------- --------------------------------------------------------------------------------
132740 1 procedure proc_obj_new
132740 2 as
132740 3 begin
132740 4 null;
132740 5 end;
132740 6
6 rows selected
SQL> update obj$ ob set ob.name='proc_obj_new' where obj#=132740;
1 row updated
SQL> commit;
Commit complete
SQL> select * from obj$ ob where ob.name='PROC_OBJ';
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
SQL> select * from obj$ ob where ob.name='PROC_OBJ_NEW';
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
SQL> select * from obj$ ob where ob.name like '%PROC_OBJ%'
2 ;
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
SQL> select * from obj$ ob where ob.name like '%proc_obj%'
2 ;
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
132740 84 proc_obj_new 1 7 2012/11/16 2012/11/16 2012/11/16 1 0 6 65535 84
SQL> select * from obj$ ob where ob.name='proc_obj';
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
SQL> select * from obj$ ob where ob.name='proc_obj_new';
OBJ# DATAOBJ# OWNER# NAME NAMESPACE SUBNAME TYPE# CTIME MTIME STIME STATUS REMOTEOWNER LINKNAME FLAGS OID$ SPARE1 SPARE2 SPARE3 SPARE4 SPARE5 SPARE6
---------- ---------- ---------- ------------------------------ ---------- ------------------------------ ---------- ----------- ----------- ----------- ---------- ------------------------------ -------------------------------------------------------------------------------- ---------- -------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -----------
132740 84 proc_obj_new 1 7 2012/11/16 2012/11/16 2012/11/16 1 0 6 65535 84
SQL> desc dba_objects;
Name Type Nullable Default Comments
-------------- ------------- -------- ------- ----------------------------------------------------------------------------
OWNER VARCHAR2(30) Y Username of the owner of the object
OBJECT_NAME VARCHAR2(128) Y Name of the object
SUBOBJECT_NAME VARCHAR2(30) Y Name of the sub-object (for example, partititon)
OBJECT_ID NUMBER Y Object number of the object
DATA_OBJECT_ID NUMBER Y Object number of the segment which contains the object
OBJECT_TYPE VARCHAR2(19) Y Type of the object
CREATED DATE Y Timestamp for the creation of the object
LAST_DDL_TIME DATE Y Timestamp for the last DDL change (including GRANT and REVOKE) to the object
TIMESTAMP VARCHAR2(19) Y Timestamp for the specification of the object
STATUS VARCHAR2(7) Y Status of the object
TEMPORARY VARCHAR2(1) Y Can the current session only see data that it place in this object itself?
GENERATED VARCHAR2(1) Y Was the name of this object system generated?
SECONDARY VARCHAR2(1) Y Is this a secondary object created as part of icreate for domain indexes?
NAMESPACE NUMBER Y Namespace for the object
EDITION_NAME VARCHAR2(30) Y Name of the edition in which the object is actual
SQL> select * from dba_objects where object_id=132740;
OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS TEMPORARY GENERATED SECONDARY NAMESPACE EDITION_NAME
------------------------------ -------------------------------------------------------------------------------- ------------------------------ ---------- -------------- ------------------- ----------- ------------- ------------------- ------- --------- --------- --------- ---------- ------------------------------
SCOTT proc_obj_new 132740 PROCEDURE 2012/11/16 2012/11/16 19 2012-11-16:19:05:16 VALID N N N 1
SQL> conn scott/system@orcl
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as scott
SQL>
小結:
透過底層字典表obj$與source$可以更新儲存過程的名稱及儲存過程的指令碼
進一層可以引申,批次進行快速更新出錯的儲存過程指令碼
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-749380/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle底層字典表obj$及source$與儲存過程procedure系列一OracleOBJ儲存過程
- oracle底層字典表obj$及source$與儲存過程procedure系列三OracleOBJ儲存過程
- oracle底層字典表obj$及source$與儲存過程procedure系列四OracleOBJ儲存過程
- oracle底層字典表obj$及source$與儲存過程procedure系列五OracleOBJ儲存過程
- [Procedure]Oracle之分頁儲存過程Oracle儲存過程
- Oracle 基礎 ----procedure(儲存過程)Oracle儲存過程
- oracle父儲存過程呼叫子儲存過程procedure與輸出引數Oracle儲存過程
- mysql 儲存過程 procedure 批次建表MySql儲存過程
- oracle procedure 儲存過程輸入及輸出in out示例Oracle儲存過程
- procedure儲存過程呼叫dba字首的字典dba_objects儲存過程Object
- SQL 建立儲存過程PROCEDURESQL儲存過程
- PL/SQL 05 儲存過程 procedureSQL儲存過程
- Oracle 11g系列:函式與儲存過程Oracle函式儲存過程
- mysql檢視儲存過程show procedure status;MySql儲存過程
- MySQL入門--儲存過程(PROCEDURE)和儲存函式(FUNCTION)MySql儲存過程儲存函式Function
- oracle儲存過程(procedure)中執行動態SQL小記Oracle儲存過程SQL
- oracle儲存過程procedure_輸入引數varchar2與char報錯Oracle儲存過程
- 儲存過程與許可權(二)儲存過程
- Oracle儲存過程Oracle儲存過程
- mysql儲存過程procedure、函式function的用法MySql儲存過程函式Function
- oracle plsql package_body_procedure_構建語法_sp_儲存過程OracleSQLPackage儲存過程
- oracle procedure儲存過程(pl/sql)_使用declare cursor_begin end巢狀Oracle儲存過程SQL巢狀
- Sql Server系列:儲存過程SQLServer儲存過程
- 儲存過程與儲存函式儲存過程儲存函式
- Oracle儲存過程乾貨(一):儲存過程基礎Oracle儲存過程
- Sql server 2005遷移至Oracle系列之二:生成儲存過程SQLServerOracle儲存過程
- Oracle儲存過程-1Oracle儲存過程
- oracle的儲存過程Oracle儲存過程
- Oracle儲存過程例子Oracle儲存過程
- Oracle建立儲存過程Oracle儲存過程
- oracle plsql儲存過程OracleSQL儲存過程
- ORACLE 儲存過程示例Oracle儲存過程
- 從sybase的儲存過程轉向oracle的儲存過程儲存過程Oracle
- block底層儲存方式BloC
- 【實驗】【PROCEDURE】一個最簡單的oracle儲存過程"proc_helloworld"Oracle儲存過程
- 通過v$access檢視正在執行的儲存過程procedure儲存過程
- 原創:oracle 儲存過程Oracle儲存過程
- oracle 儲存過程批次提交Oracle儲存過程