The dml_lock_timeout Parameter in the DBMS_REDEFINITION Package
As you know, during the execution of the FINISH_REDEF_TABLE procedure, the table must be locked exclusively for a short period so that the procedure can complete successfully. Otherwise, the procedure will wait until other transactions running on the table are finished, and it will remain in a waiting state:
SQL> EXEC DBMS_REDEFINITION.can_redef_table('VAHID', 'MYTBL');
PL/SQL procedure successfully completed
SQL> EXEC DBMS_REDEFINITION.start_redef_table('VAHID', 'MYTBL', 'MYTBL_TEMP');
PL/SQL procedure successfully completed
SQL> EXEC DBMS_REDEFINITION.sync_interim_table('VAHID', 'MYTBL', 'MYTBL_TEMP');
PL/SQL procedure successfully completedSession 1:
SQL> delete MYTBL where rownum<=1;
1 row deletedSession 2:
SQL> EXEC DBMS_REDEFINITION.finish_redef_table(‘USEF’, ‘MYTBL’, ‘MYTBL_TEMP’);
Executing…As shown above, the finish_redef_table command enters a waiting state until Session 1 completes its work.
SQL> EXEC DBMS_REDEFINITION.finish_redef_table(‘USEF’, ‘MYTBL’, ‘MYTBL_TEMP’,dml_lock_timeout => 10);
ORA-42012: error occurred while completing the redefinition
ORA-42042: time out in acquiring DML lock during online redefinition
Elapsed: 00:00:11.11Written by Vahid Yousefzadeh
I have been a DBA since 2011 and I work with Oracle technology. Linkdin: linkedin.com/in/vahidusefzadeh telegram channel ID:@oracledb vahidusefzadeh@gmail.com
Comments
Post a Comment