We know the row-chaining happen,when a row that is too large cannot fit on a single block.
Eg: If we have a 2k blocksize but our row size is 4k, we will use 3 blocks to store that row in pieces.
Row-chaining can occur because of below reasons:
1)A table have a long/long raw Data types in some cases
2) A table's rowsize exceeds the blocksize and
3)Any table with more then 255 columns
We can resolve ROW-CHAINING by following below 2 steps:
Step:1.FIND OUT IF ROW-CHAINING IS OCCURING.
$sqlplus scott/tiger
SQL>exec dbms_stats.gather_schema_stat(‘scott’)
OR
SQL>exec dbms_stat.gather_table_stat('scott','emp')
SQL>select chaint_cnt from user_tables where TABLE_NAME='EMP';
NOTE: Any non-zero value means there is row-chaining.
Step 2:RESOLVE THE CHAINING
RUN THE FOLLOWING COMMAND TO CREATE chained_rows table.
$sqlplus "/as sysdba"
SQL>@$ORACLE_HOME/rdbms/admin/utlchain.sql
SQL>ANALYZE TABLE EMP LIST CHAINED ROWS INTO CHAINED_ROWS;
SQL>create table temp_emp as
Select * from emp
Where rowid in (select HEAD_ROWID from chained_rows
where TABLE_NAME= ‘EMP’;
SQL>DELETE FROM EMP WHERE ROWID IN(
select HEAD_ROWID from chained_rows
where TABLE_NAME= ‘EMP’);
SQL>INSERT INTO EMP SELECT * FROM TEMP_EMP;
SQL>DROP TABLE TEM-_EMP;
SQL>DROP TABLE CHAINED_ROWS;
Note:Remember,ROW CHAINING occurs because of UPDATE operations and not because of INSERT operations.
Hope it helps...
Happy Oracle DBA learning
Best regards,
Rafi.
.
Believe that anything you can imagine you can achieve it real. Having the devotion,passion and dedication to learn & Work in Oracle field mail me @ rafidba.alvi@gmail.com."Knowledge grows when it is shared". Best Career related guidance in Oracle DBA,Oracle Apps DBA,Oracle SOA Admin/Developers,ODI Developers,OBI Developers and Oracle Designers. "A Catalyst for Oracle DBA & Apps DBA Interviews,Jobs & Career."
Tuesday, October 18, 2011
Subscribe to:
Post Comments (Atom)
Thanks for publishing.
ReplyDeleteThe name of the column is chain_cnt.
good post
ReplyDelete