如果comment不是ddl操作多好
背景:有些表的欄位類似如字典表,1 代表 A,2 代表B。。。
問題是後面又來了 3,4,。。如是經常要求修改該欄位的註釋。
但該操作屬於ddl操作,會是對於的sql失效,如果該操作不是ddl操作多好:
先通過一個10704得到如下trace( TX,6001f,1fcd8是對應的記錄鎖,在update OBJ$ 和 update COM$ ? 通過10046有更新這兩個字典表)
alter session set events '10704 trace name context forever ,level 12';
SQL> comment on column TEST.B_TYPE
2 is '1:AA 2:BB';
alter session set events '10704 trace name context off';
*** 2011-05-20 16:25:00.777
ksqgtl *** TM-00000061-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.777
ksqgtl *** TX-0006001f-0001fcd8 mode=6 flags=0x401 timeout=0 ***
ksqgtl *** TM-00000061-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.779
ksqgtl *** TM-00000012-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.779
ksqrcl: TX,6001f,1fcd8
ksqrcl: returns 0
*** 2011-05-20 16:25:00.779
ksqrcl: TM,12,0
ksqrcl: returns 0
*** 2011-05-20 16:25:00.779
ksqrcl: TM,61,0
ksqrcl: returns 0
SQL> select object_name,object_type from dba_objects
2 where object_id in (18,97)
3 ;
OBJECT_NAME OBJECT_TYPE
-------------------------------------------------------------------------------- -------------------
OBJ$ TABLE
COM$ TABLE
comment on column屬於ddl操作,會是對於的sql失效:
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
select count(*) from TEST 2011-05-20/16:55:50 2011-5-20 16:55:50
SQL>
SQL> comment on column TEST.B_TYPE
2 is '1:AA 2:BB';
Comment added
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SQL> SELECT COUNT(*) FROM TEST;
COUNT(*)
----------
137411
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SELECT COUNT(*) FROM TEST 2011-05-20/16:56:57 2011-5-20 16:56:56
SQL> SELECT COUNT(*) FROM TEST;
COUNT(*)
----------
137411
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SELECT COUNT(*) FROM TEST 2011-05-20/16:56:57 2011-5-20 16:57:23
問題是後面又來了 3,4,。。如是經常要求修改該欄位的註釋。
但該操作屬於ddl操作,會是對於的sql失效,如果該操作不是ddl操作多好:
先通過一個10704得到如下trace( TX,6001f,1fcd8是對應的記錄鎖,在update OBJ$ 和 update COM$ ? 通過10046有更新這兩個字典表)
alter session set events '10704 trace name context forever ,level 12';
SQL> comment on column TEST.B_TYPE
2 is '1:AA 2:BB';
alter session set events '10704 trace name context off';
*** 2011-05-20 16:25:00.777
ksqgtl *** TM-00000061-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.777
ksqgtl *** TX-0006001f-0001fcd8 mode=6 flags=0x401 timeout=0 ***
ksqgtl *** TM-00000061-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.779
ksqgtl *** TM-00000012-00000000 mode=3 flags=0x401 timeout=21474836 ***
*** 2011-05-20 16:25:00.779
ksqrcl: TX,6001f,1fcd8
ksqrcl: returns 0
*** 2011-05-20 16:25:00.779
ksqrcl: TM,12,0
ksqrcl: returns 0
*** 2011-05-20 16:25:00.779
ksqrcl: TM,61,0
ksqrcl: returns 0
SQL> select object_name,object_type from dba_objects
2 where object_id in (18,97)
3 ;
OBJECT_NAME OBJECT_TYPE
-------------------------------------------------------------------------------- -------------------
OBJ$ TABLE
COM$ TABLE
comment on column屬於ddl操作,會是對於的sql失效:
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
select count(*) from TEST 2011-05-20/16:55:50 2011-5-20 16:55:50
SQL>
SQL> comment on column TEST.B_TYPE
2 is '1:AA 2:BB';
Comment added
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SQL> SELECT COUNT(*) FROM TEST;
COUNT(*)
----------
137411
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SELECT COUNT(*) FROM TEST 2011-05-20/16:56:57 2011-5-20 16:56:56
SQL> SELECT COUNT(*) FROM TEST;
COUNT(*)
----------
137411
SQL>
SQL> select aa.SQL_TEXT,aa.LAST_LOAD_TIME,aa.LAST_ACTIVE_TIME from v$sql aa
2 where upper(aa.SQL_TEXT) like '%SELECT COUNT(*) FROM TEST%'
3 ;
SQL_TEXT LAST_LOAD_TIME LAST_ACTIVE_TIME
------------------------------------------------------------ --------------------------------------------------------- ------------------------------
SELECT COUNT(*) FROM TEST 2011-05-20/16:56:57 2011-5-20 16:57:23
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/758322/viewspace-695848/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 11.2.0.3.0 comment 操作不再是ddl操作???
- 限制DDL操作(四)
- 限制DDL操作(三)
- 限制DDL操作(二)
- 限制DDL操作(一)
- MySQL DDL操作表MySql
- 配置GoldenGate啟動DDL支援同步DDL操作Go
- DDL操作的自動提交
- oracle追蹤誤操作DDLOracle
- DML操作 DDL觸發器觸發器
- Mysql 從庫如果有未提交的事務主庫ddl操作導致主從延遲MySql
- 如果當初學習程式設計時能有人給我這些忠告該多好程式設計
- DDL、DML、DCL、DQL相關操作
- Mysql 基礎操作 DDL DML DCLMySql
- Oracle 觸發器 限制DDL操作Oracle觸發器
- 資料庫DDL操作審計資料庫
- 禁止使用者的DDL操作
- 資料庫操作語言DDL資料庫
- MySQL5.7 InnoDB線上DDL操作MySql
- 04 MySQL 表的基本操作-DDLMySql
- 如果不是天才,那就老老實實的學習
- 控制DDL許可權及紀錄DDL操作的Trigger
- Begin end程式碼段裡面有DDL和DML,如果DDL成功了而DML失敗了,則DDL的程式碼也會回滾
- OGG單向DDL複製操作
- 記錄資料庫所有ddl操作資料庫
- Oracle高可用環境之DDL操作Oracle
- MySQL的DDL和DML操作語法MySql
- PowerDesigner 同步Name到Comment 及 同步 Comment 到Name
- logmnr挖掘中間有DDL的操作示例-對於執行DDL前的操作無法挖掘
- Oracle DBLINK 抽數以及DDL、DML操作Oracle
- 使用Logminer工具分析DML和DDL操作
- 資料庫觸發器,禁止DDL操作資料庫觸發器
- DML, DDL操作的自動提交問題
- oracle comment on的用法Oracle
- 記錄一次 Online DDL 操作
- 配置支援DML和DDL操作同步的GoldenGateGo
- Oracle comment新增註釋Oracle
- Commit Comment (148)MIT