create table t27 as
select rownum rn from dual connect by rownum<100;
select * from t27;
delete from t27 where rn<10;
insert into t27
select rownum rn from dual connect by rownum<10;
select * from t27;
select t1.rn from t27 t1, q1 where T1.RN=q1.rn;
INSERT is the default. In order to run in parallel DML mode, the following requirements must be met:ALTER SESSION { ENABLE | FORCE } PARALLEL DML;
PARALLEL hint for each insert operation.INSERT, specify the NOAPPEND hint in each INSERT statement. Doing so overrides parallel DML mode.
2. By using
checkpoint
If we do not want REDO to grow drastically and improve performance of drop operation, we can use check point with frequency of commit intervals. alter table t_big drop column MIN_EXTENTS checkpoint 5000; But drawback with checkpoint is if operation fails due to some reason or terminated by user(I did that simply by CTRL+C when drop column operation was running on sqlplus) then it leaves entire table into table in unusable state where we cannot perform any operation on the table.
If we try to perform any operation on table it will through below
error.
[Error] Execution (1: 15): ORA-12986: columns in partially dropped
state. Submit ALTER TABLE DROP COLUMNS CONTINUE
To overcome this we need to execute command as suggested in error.
But If we are using this option then I observed that we can't monitor time remaining by using v$session_longops or alternatively by using TOAD session browser/long ops.
If checkpoint is used then long operations information is not available in v$session_longops. Same in the case of below statement.
ALTER TABLE t_big DROP COLUMNS CONTINUE.
I assume that oracle usage checkpoint for this operation as well.
3. Set column unused and drop latter. (alternatively in 12C we can mark column invisible also if the purpose is to hide columns from application only)
alter table T_BIG drop unused columns checkpoint 5000; Interestingly even if column marked as unused but still column still exists and it places lock on table when you actually drop this column like the normal drop operation. In this case also it depends if we can monitor time or not based on the checkpoint usage. Also if checkpoint used and operation failed due to any reason, it leaves table in unusable state.
Footnote: Be careful when using checkpoint or be ready for the consequences .
|
VARCHAR2, NVARCHAR2, and RAW data types has been increased from 4,000 to 32,767 bytes.DEFAULT definition of a column can be extended to have the DEFAULT being applied for explicit NULL insertion.DEFAULT clause has a new ON NULL clause, which instructs the database to assign a specified default column value when an INSERT statement attempts to assign a value that evaluates to NULL.IDENTITY columns. Migration from database systems that use identity columns is simplified and can take advantage of this new functionality.DEFAULT or DEFAULT ON NULL semantics for use by SEQUENCE.NEXTVAL and SYS_GUID, supports built-in functions and implicit return of default values.