mysql有行迁移吗_行连接、行迁移

1.检测行迁移和行连接

数据库级链接行的影响:

select value from v$sysstat where name='table fetch continued row';

上面反回的是由语句访问的链接行的数量。

2.获得表的链接行的数目;

分析表:

analyze table owner.table_name compute;

接下来查询DBA_TABLES得到链接行的数目:

select chain_cnt from  dba_tables where table_name ='' and owner=owner_name;

3.识别表中的链接行:

3.1 创建CHAINED_ROWS表,oracle提供了一个称为utlchain.sql 的脚本。该脚本放在ORACLE_HOME/rdbms/admin下:

3.2 分析要检查行连接和行迁移的表:

analyze table table_name list chained rows into chained_rows;

3.3 查询CHAINED_ROWS表:

select owner_name,table_name,head_rowid from chained_rows;

4.消除行连接

行连接很难消除,为了完全消除行连接,可能需要用较大的数据块尺寸重新创建数据库。

涉及以下步骤:

4.1。执行一致的全库导出。

4.2.删除旧数据库。

4.3.用较大的数据块尺寸创建新数据库。

4.4 从导出的转储文件中将数据导入新创建的数据库中。

5.消除行迁移

5.1 方法1(当大型表中有相对较少的行迁移时可用)

A,首先通过分析表并将链接行和迁移行列入chained_row表来标识这些行。

analyze table scott.emp list chained rows into chained_rows;

B,使用create table ... as select 语句创建一个临时表并备份迁移行。

create table chain_temp as

select * from  scott.emp

where rowid in(select head_rowid

from chained_rows);

注意:查询临时表以确保迁移行已经备份

select count(*) from chain_temp;

C,从原来的表中删除这些迁移行(先前被标识的)

delete from scott.emp

where rowid in(select head_rowid

from chained_rows);

D:从临时表中将这些行重新插入到原来的表中

insert into scott.emp select * from chain_tmp;

检查以确保这些行已经重新插入到表中,然后可以删除chain_tmp表。

drop table chain_tmp;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29677883/viewspace-1170241/,如需转载,请注明出处,否则将追究法律责任。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值