Dropping a Table

For the purpose of learning about Flashback Drop, you will create a new table named reg_hist and then drop it. The database places the table in the recycle bin so that it can be retrieved with the Flashback Drop feature.

To create and then drop a table:

  1. Connect SQL*Plus to the hr schema.
  2. Create table reg_hist based on the existing REGIONS table in the hr schema by using the following command:
    CREATE TABLE reg_hist as SELECT * FROM REGIONS;
    
  3. Drop the reg_hist table using the following command:
    DROP TABLE REG_HIST;
    

    Because Flashback is enabled for the database, the dropped table is stored in the recycle bin.

  4. Display the tables in the hr schema.
    SELECT * FROM TAB;
    
    TNAME                          TABTYPE  CLUSTERID
    ------------------------------ ------- ----------
    BIN$ANbliLHaSiu02xI+zbvDvQ==$0  TABLE
    COUNTRIES                       TABLE
    DEPARTMENTS                     TABLE
    EMPLOYEES                       TABLE
    EMP_DETAILS_VIEW                VIEW
    JOBS                            TABLE
    JOB_HISTORY                     TABLE
    LOCATIONS                       TABLE
    REGIONS                         TABLE
    
    9 rows selected.
    

    The first name displayed in the command output, beginning with 'BIN', is the table that you just dropped. Because Flashback Database is enabled, the deleted table is still in the recycle bin and is therefore displayed in the command output.