<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆 - 6  文章 - 129  trackbacks - 0
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(14)

    隨筆檔案(6)

    文章分類(467)

    文章檔案(423)

    相冊

    收藏夾(18)

    JAVA

    搜索

    •  

    積分與排名

    • 積分 - 825479
    • 排名 - 49

    最新評論

    閱讀排行榜

    評論排行榜

    原文  http://blogs.oracle.com/sql/entry/ora_54033_and_the_hidden

    A colleague recently asked me a question:

    "I'm modifying the data type of a column. When doing so I get the following error:

    ORA-54033: column to be modified is used in a virtual column expression

    But there's no virtual columns defined on the table! What on earth's going on?!"

    This was exceptionally confusing. Looking at the table definition we couldn't see any virtual columns defined: 

    create table tab (
      x integer, 
      y date, 
      z varchar2(30)
    );

    Sure enough, when we tried to change the data type of y we got the exception:

    alter table tab modify (y timestamp);
    
    ORA-54033: column to be modified is used in a virtual column expression

    How could this be? 

    Perhaps there was a column defined that we couldn't see. Querying user_tab_cols revealed something interesting:

    select column_name, data_default, hidden_column 
    from   user_tab_cols
    where  table_name = 'TAB';
    
    COLUMN_NAME 			DATA_DEFAULT 			HID
    ------------------------------ 	-----------------------------   ---
    SYS_STUYPW88OE302TFVBNC6$MMQXE	SYS_OP_COMBINED_HASH("X","Y")	YES
    Z		                                                NO
    Y								NO
    X								NO

    The SYS_... column isn't in the table DDL! Where does it come from? And what's SYS_OP_COMBINED_HASH all about? Has someone been mucking around with the database?

    The SYS_ prefix is a sign that the column is system generated. So something's happened that's caused Oracle to create this on our behalf.

    SYS_OP_COMBINED_HASH is an undocumented feature. The name implies Oracle is merging the arguments together to form a hash.

    Is there a feature where we want to capture information about a group of columns?

    Indeed there is -extended statistics!This feature enables to Oracle calculate statistics on a group of columns. It uses this information to improve row estimates. This is useful when there's a correlation between the values of two (or more) columns in a table.

    Someone had created extended stats on this table for (x, y).

    Now we've identified the problem, how do we get around it?

    Simple: drop and recreate the extended stats:

    exec dbms_stats.drop_extended_stats(user, 'tab', '(x, y)');
    
    alter table tab modify (y timestamp);
    
    select dbms_stats.create_extended_stats(user, 'tab', '(x, y)')
    from   dual;
    
    DBMS_STATS.CREATE_EXTENDED_STATS(USER,'TAB','(X,Y)')                           
    --------------------------------------------------------------------------------
    SYS_STUYPW88OE302TFVBNC6$MMQXE  

    Success!

    Extended stats are a great way to improve the optimizer's row estimates. If you need to create these, I recommend you also do the following:

    • Apply the extended stats to all environments
    • Put a comment on the columns explaining what you've done, e.g. 
      • comment on column tab.x is 'part of extended stats. To modify data type drop and recreate stats';
    These actions will help prevent future developers getting stuck tracking down the cause of "missing" virtual columns!


    posted on 2015-09-16 14:30 Ke 閱讀(2812) 評論(0)  編輯  收藏 所屬分類: oracle
    主站蜘蛛池模板: 精品在线免费观看| 亚洲午夜精品一区二区公牛电影院| 国产一区二区三区在线观看免费| 91免费精品国自产拍在线不卡| 99在线精品免费视频九九视| 免费观看激色视频网站bd| 精品成在人线AV无码免费看| 69av免费视频| 美女网站免费福利视频| 永久免费AV无码国产网站| 在线观看无码AV网站永久免费| 妞干网手机免费视频| 精品无码国产污污污免费| 好爽好紧好大的免费视频国产 | 猫咪免费观看人成网站在线| 特级毛片aaaa免费观看 | 亚洲系列国产精品制服丝袜第| 久久久久亚洲精品日久生情| 亚洲另类古典武侠| 亚洲AV无码专区在线电影成人| 美女黄色免费网站| 久久久久久久久久免免费精品| 免费看无码特级毛片| 91成人在线免费视频| 国产卡一卡二卡三免费入口| 麻豆国产入口在线观看免费| 五月天婷亚洲天综合网精品偷| 亚洲中文字幕无码一久久区| 激情内射亚洲一区二区三区| 亚洲国产精品一区二区三区在线观看 | 57PAO成人国产永久免费视频| 午夜免费福利在线观看| 亚洲精品无码日韩国产不卡?V| 亚洲av综合色区| 亚洲免费电影网站| 立即播放免费毛片一级| 中文字幕乱码免费看电影| 95免费观看体验区视频| 日本无卡码免费一区二区三区| 亚洲人成亚洲人成在线观看| 亚洲精品国产福利片|