Oracle9i with DBMS

xiaoxiao2021-03-05  23

- Create Original Table Acreate Table A; - Table A must include a primary key Alter Table A Add Constraint P Primary Key (ABC);

- Analysis Whether you can rebuild online, if you report an error, you can't exec Sys.dbms_redefinition.can_redef_table ('Dlyx', 'A'); - Create an intermediate table A1, used to store the original data, constraints of unhappy CREATE Table A1 (ABC Number Not Null); ALTER TABLE A1 Add Constraint P1 Primary Key (ABC);

- Start reconstruction exec system sys.dbms_redefinition.start_redef_table ('Dlyx', 'A', 'A1'); - End Rebuild EXEC SYS.DBMS_REDEFINITION.FINISH_REDEF_TABLE ('Dlyx', 'A', 'A1'); Termination Reconstruction (if you do not want to rebuild) EXEC SYS.DBMS_REDEFINITION.ABORT_REDEF_TABLE ('DLYX', 'A', 'A1'); - Delete the intermediate table A1DROP TABLE A1;

- Renown Form Constraint ALTER TABLE A DROP Constraint P1 Cascade; ALTER TABLE A Add Constraint P Primary Key (ABC);

转载请注明原文地址:https://www.9cbs.com/read-38056.html

New Post(0)