排除表中的行連結和行遷移
You can use the information in the CHAINED_ROWS table to reduce or eliminate migrated
and chained rows in an existing table. Use the following procedure.
1. Use the ANALYZE statement to collect information about migrated and chained rows.
ANALYZE TABLE order_hist LIST CHAINED ROWS;
2. Query the output table:
SELECT * FROM CHAINED_ROWS WHERE TABLE_NAME = 'ORDER_HIST';
OWNER_NAME TABLE_NAME CLUST... HEAD_ROWID TIMESTAMP
---------- ---------- -----... ------------------ ---------
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAA 04-MAR-96
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAB 04-MAR-96
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAC 04-MAR-96
The output lists all rows that are either migrated or chained.
3. If the output table shows that you have many migrated or chained rows, then you can eliminate migrated rows by continuing through the following steps:
4. 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');
5. 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');
6. Insert the rows of the intermediate table into the existing table:
INSERT INTO order_hist SELECT * FROM int_order_hist;
7. Drop the intermediate table:
DROP TABLE int_order_history;
8. Delete the information collected in step 1 from the output table:
DELETE FROM CHAINED_ROWS WHERE TABLE_NAME = 'ORDER_HIST';
9. Use the ANALYZE statement again, and query the output table
Any rows that appear in the output table are chained. You can eliminate chained rows only by increasing your data block size. It might not be possible to avoid chaining in all situations. Chaining is often unavoidable with tables that have a LONG column or large CHAR or VARCHAR2 columns
Creating a CHAINED_ROWS Table
To create the table to accept data returned by an ANALYZE...LIST CHAINED ROWS statement, execute the UTLCHAIN.SQL or UTLCHN1.SQL script. These scripts are provided by the database. They create a table named CHAINED_ROWS in the schema of the user submitting the script.
Note:Your choice of script to execute for creating the CHAINED_ ROWS table depends on the compatibility level of your database and the type of table you are analyzing.
After a CHAINED_ROWS table is created, you specify it in the INTO clause of the ANALYZE statement. For example, the following statement inserts rows containing information about the chained rows in the emp_dept cluster into the CHAINED_ROWS table:
ANALYZE CLUSTER emp_dept LIST CHAINED ROWS INTO CHAINED_ROWS;
1. Use the ANALYZE statement to collect information about migrated and chained rows.
ANALYZE TABLE order_hist LIST CHAINED ROWS;
2. Query the output table:
SELECT * FROM CHAINED_ROWS WHERE TABLE_NAME = 'ORDER_HIST';
OWNER_NAME TABLE_NAME CLUST... HEAD_ROWID TIMESTAMP
---------- ---------- -----... ------------------ ---------
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAA 04-MAR-96
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAB 04-MAR-96
SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAC 04-MAR-96
The output lists all rows that are either migrated or chained.
3. If the output table shows that you have many migrated or chained rows, then you can eliminate migrated rows by continuing through the following steps:
4. 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');
5. 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');
6. Insert the rows of the intermediate table into the existing table:
INSERT INTO order_hist SELECT * FROM int_order_hist;
7. Drop the intermediate table:
DROP TABLE int_order_history;
8. Delete the information collected in step 1 from the output table:
DELETE FROM CHAINED_ROWS WHERE TABLE_NAME = 'ORDER_HIST';
9. Use the ANALYZE statement again, and query the output table
Any rows that appear in the output table are chained. You can eliminate chained rows only by increasing your data block size. It might not be possible to avoid chaining in all situations. Chaining is often unavoidable with tables that have a LONG column or large CHAR or VARCHAR2 columns
Creating a CHAINED_ROWS Table
To create the table to accept data returned by an ANALYZE...LIST CHAINED ROWS statement, execute the UTLCHAIN.SQL or UTLCHN1.SQL script. These scripts are provided by the database. They create a table named CHAINED_ROWS in the schema of the user submitting the script.
Note:Your choice of script to execute for creating the CHAINED_ ROWS table depends on the compatibility level of your database and the type of table you are analyzing.
After a CHAINED_ROWS table is created, you specify it in the INTO clause of the ANALYZE statement. For example, the following statement inserts rows containing information about the chained rows in the emp_dept cluster into the CHAINED_ROWS table:
ANALYZE CLUSTER emp_dept LIST CHAINED ROWS INTO CHAINED_ROWS;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-2121478/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 行遷移和行連結
- 清除行遷移和行連結
- 行遷移和行連結的檢測
- 如何消除行連結和行遷移
- 關於行連結和行遷移和消除
- 模擬Oracle行遷移和行連結Oracle
- 行遷移_行連結的介紹
- 【效能優化】消除行連結和行遷移的思路和方法優化
- Row Migration and Row Chaining(行遷移和行連結)AI
- 【效能最佳化】消除行連結和行遷移的思路和方法
- pctused, pctfree, pctincrease , 行遷移 & 行連結
- 【概念】行連結和行遷移的概念、模擬及甄別
- Oracle 行遷移 & 行連結的檢測與消除Oracle
- 【轉】【效能最佳化】消除行連結和行遷移的思路和方法
- Oracle中行遷移和行連結的清除及檢測Oracle
- 【備份恢復】行遷移與行連結
- 【轉載】行遷移和行連結(row chaining or row migration)AI
- 行連結(Row chaining)和行遷移(Row Migration)的讀書筆記AI筆記
- Oracle資料庫中資料行遷移與行連結Oracle資料庫
- 查詢表中的連結行
- 行連結與行遷移, LOB欄位的儲存及效能影響
- 選出有行連線(row chain)或者是行遷移(row migeration)的表AI
- [20160726]行連結行遷移與ITL槽.txt
- 處理表的行遷移的問題
- 查詢表存在大量行遷移
- 關於Oracle資料庫中行遷移/行連結的問題Oracle資料庫
- [20160729]行連結行遷移與ITL槽4.txt
- [20160727]行連結行遷移與ITL槽2.txt
- [20160728]]行連結行遷移與ITL槽3.txt
- Oracle資料庫關於錶行連線和行遷移處理方案Oracle資料庫
- [20180402]行連結行遷移與ITL槽6.txt
- 簡單瞭解 oracle update 原理(測試)、 行遷移/行連結基本認識Oracle
- 高水位線、行遷移行連結
- 查詢行遷移及消除行遷移(chained rows)AI
- [20121116]通過bbed觀察行連結與行遷移.txt
- oracle11g_如何模擬產生行連結或行遷移chained_rowsOracleAI
- 清除行遷移的例子
- 行遷移測試