--预备检查
BEGIN
DBMS_REDEFINITION.CAN_REDEF_TABLE(‘GMSTEST‘,‘BGP_HSE_ENTITYHISTORY_NEW‘,DBMS_REDEFINITION.CONS_USE_PK);
END;
BEGIN
DBMS_REDEFINITION.START_REDEF_TABLE(‘GMSTEST‘, ‘BGP_HSE_ENTITYHISTORY_NEW‘, ‘BGP_HSE_ENTITYHISTORY_NEW_TEST‘);
END;
BEGIN
dbms_redefinition.sync_interim_table(‘GMSTEST‘, ‘BGP_HSE_ENTITYHISTORY_NEW‘, ‘BGP_HSE_ENTITYHISTORY_NEW_TEST‘);
END;
-- 完成关闭
BEGIN
DBMS_REDEFINITION.FINISH_REDEF_TABLE(‘GMSTEST‘, ‘BGP_HSE_ENTITYHISTORY_NEW‘, ‘BGP_HSE_ENTITYHISTORY_NEW_TEST‘);
END;
--报错还原
BEGIN
DBMS_REDEFINITION.ABORT_REDEF_TABLE(uname => ‘GMSTEST‘,
orig_table => ‘BGP_HSE_ENTITYHISTORY_NEW‘,
int_table => ‘BGP_HSE_ENTITYHISTORY_NEW_TEST‘);
END;