TimesTen_重建业务日志表

---备份业务日志变更表

ttisql -connStr "dsn=ttstd" -e "

creaet table TIMESTEN.XIAOXU_01bak
select * from TIMESTEN.XIAOXU_01 where AVAILTIME>=to_date('20150810','yyyymmdd');
exit;"

---重建业务日志表
ttisql -connStr "dsn=ttstd" -e "
alter session set ddl_replication_level=2;
alter session set ddl_replication_action='EXCLUDE';
truncate table  TIMESTEN.XIAOXU_01;
drop table  TIMESTEN.XIAOXU_01;
create table TIMESTEN.XIAOXU_01 (
        KEY_ID      TT_BIGINT NOT NULL,
        OID         TT_BIGINT NOT NULL,
        PRODUCT_OID TT_BIGINT NOT NULL,
        ATTR_ID     TT_INTEGER NOT NULL,
        "VALUE"     VARCHAR2(128 BYTE) INLINE NOT NULL,
        AVAILTIME   DATE NOT NULL,
        EXPIRETIME  DATE,
        SHARE_FLAG  CHAR(1 BYTE) DEFAULT 'N',

        DERIVE_FLAG CHAR(1 BYTE) DEFAULT 'N');

---为了加快数据导入速度,未建索引之前将数据导回

Command> insert into TIMESTEN.XIAOXU_01 select * from TIMESTEN.XIAOXU_01bak;
1 row inserted.
Command> commit;

----创建索引

Command>   create unique index TIMESTEN.PK_XIAO1 on TIMESTEN.XIAOXU_01
       >         (KEY_ID, OID, PRODUCT_OID);
17063: CREATE INDEX can only refer to empty tables when DDLReplicationLevel > 1
The command failed.        

 备注:创建失败,当主备开启ddl结构同步时,创建索引时,表必须为空。

---删除表数据

Command> delete TIMESTEN.XIAOXU_01;
1 row deleted.
Command> commit;
Command>  create unique index TIMESTEN.PK_XIAO1 on TIMESTEN.XIAOXU_01
       >         (KEY_ID, OID, PRODUCT_OID);   ---ok


alter active standby pair include table  TIMESTEN.XIAOXU_01;
alter session set ddl_replication_level=1;
exit;"


---将数据插回去操作
insert into TIMESTEN.XIAOXU_01
select * from TIMESTEN.XIAOXU_01bak;
commit;


---重启主备Timesten account实例释放HIGH_WATER
 ---主
 Command>call ttrepstop;
 $ttadmin -ramunload account
 ---备
 command>call ttrepstop;
 $ttadmin -ramunload account
 --主
  Command>call ttrepstart;
  Command>call ttrepstateset('active');
  Command>call ttrepstateget;
 --备
  Command>call ttrepstart;

  Command>call ttrepstateget;


Command> dssize m
  PERM_ALLOCATED_SIZE:      51200
  PERM_IN_USE_SIZE:         33764.8427734375
  PERM_IN_USE_HIGH_WATER:   34017.0322265625
  TEMP_ALLOCATED_SIZE:      6440
  TEMP_IN_USE_SIZE:         85.705078125
  TEMP_IN_USE_HIGH_WATER:   2267.828125


---比对(主备库执行查询)
ttisql -connStr "dsn=ttstd" -e "
select count(1) from  TIMESTEN.XIAOXU_01;
exit;"


---表分析
ttisql -connStr "dsn=ttstd" -e "
call ttOptEstimateStats('TIMESTEN.XIAOXU_01',1,'51  PERCENT'); commit;
exit;"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值