Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1450769
  • 博文数量: 239
  • 博客积分: 5909
  • 博客等级: 大校
  • 技术积分: 2715
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-24 20:19
文章分类

全部博文(239)

文章存档

2014年(4)

2013年(22)

2012年(140)

2011年(14)

2010年(59)

我的朋友

分类: Oracle

2013-12-04 18:01:32


  1. The difference between utlchain.sql and utlchn1.sql is the column head_rowid data type:

  2. ::::::::::::::
  3. utlchain.sql
  4. ::::::::::::::

  5. create table CHAINED_ROWS (
  6.   owner_name varchar2(30),
  7.   table_name varchar2(30),
  8.   cluster_name varchar2(30),
  9.   partition_name varchar2(30),
  10.   subpartition_name varchar2(30),
  11.   *head_rowid rowid,*
  12.   analyze_timestamp date
  13. );

  14. ::::::::::::::
  15. utlchn1.sql
  16. ::::::::::::::

  17. create table CHAINED_ROWS (
  18.   owner_name varchar2(30),
  19.   table_name varchar2(30),
  20.   cluster_name varchar2(30),
  21.   partition_name varchar2(30),
  22.   subpartition_name varchar2(30),
  23.   *head_rowid urowid,*
  24.   analyze_timestamp date
  25. );
ROWID and UROWID Datatypes

Oracle uses a ROWID datatype to store the address (rowid) of every row in the database.

Physical rowids store the addresses of rows in ordinary tables (excluding index-organized tables), clustered tables, table partitions and subpartitions, indexes, and index partitions and subpartitions.

Logical rowids store the addresses of rows in index-organized tables.
A single datatype called the universal rowid, or UROWID, supports both logical and physical rowids, as well as rowids of foreign tables such as non-Oracle tables accessed through a gateway.

ROWID:
Physical rowids store the addresses of rows in ordinary tables (excluding index-organized tables), clustered tables, table partitions and subpartitions, indexes, and index partitions and subpartitions.

UROWID
U as Universal, supports both logical and physical rowids, as well as rowids of foreign tables such as non-Oracle tables accessed through a gateway. UROWIDs can save both "physical" as well as "logical" ROW IDs.

So if you have IOT in your database use utlchn1.sql to create the CHAINED_ROWS or else you will get ORA-01496: specified chain row table form incorrect

How to resolve

  1. Create an intermediate table with the same columns as the existing table to hold the migrated and chained rows:

    CREATE TABLE int_order_hist
       AS SELECT *
          FROM order_hist
          WHERE ROWID IN
             (SELECT HEAD_ROWID
                FROM CHAINED_ROWS
                WHERE TABLE_NAME = 'ORDER_HIST');
    
  2. Delete the migrated and chained rows from the existing table:

    DELETE FROM order_hist
       WHERE ROWID IN
          (SELECT HEAD_ROWID
             FROM CHAINED_ROWS
             WHERE TABLE_NAME = 'ORDER_HIST');
    
  3. Insert the rows of the intermediate table into the existing table:

    INSERT INTO order_hist
       SELECT *
       FROM int_order_hist;
    
  4. Drop the intermediate table:

    DROP TABLE int_order_history;
    
  5. Delete the information collected in step 1 from the output table:

    DELETE FROM CHAINED_ROWS
       WHERE TABLE_NAME = 'ORDER_HIST';
    

阅读(1691) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~