What is the result of executing a TRUNCATE TABLE command on a table that has Flashback Archiving enabled?

What is the result of executing a TRUNCATE TABLE command on a table that has
Flashback Archiving enabled?

What is the result of executing a TRUNCATE TABLE command on a table that has
Flashback Archiving enabled?

A.
The rows in the table are truncated without being archived.

B.
The rows in the table are archived, and then truncated.

C.
The rows in both the table and the archive are truncated.

D.
It fails with the ORA-665610 Invalid DDL statement on history-tracked message

Explanation:



Leave a Reply 5

Your email address will not be published. Required fields are marked *


aurel

Santosh Kumar

Santosh Kumar

B should be correct answer.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> create tablespace test1 datafile size 1G;

Tablespace created.

SQL> create flashback archive fla1 tablespace test1 retention 1 year;

Flashback archive created.

SQL> create table tb_flash (id number, name varchar2(50));

Table created.

SQL> alter table tb_flash flashback archive fla1;

Table altered.

SQL> insert into tb_flash values(1,’Santosh’);

1 row created.

SQL> commit;
Commit complete.

SQL> select count(*) from tb_flash;

COUNT(*)
———-
1

SQL> truncate table tb_flash;

Table truncated.

SQL> select count(*) from tb_flash;

COUNT(*)
———-
0

SQL> select count(*) from tb_flash as of timestamp to_timestamp(‘2016-05-18:14:
40:00′,’YYYY-MM-DD:HH24:MI:SS’);

COUNT(*)
———-
1