SQL> alter table departments enable row movement;
Table altered.
SQL> alter table jobs enable row movement;
Table altered.
The next day, the HR user accidentally deletes all the rows in the EMPLOYEES table due to a
cut-and-paste error from an existing script:
SQL> delete from hr.employees
2 /
107 rows deleted.
SQL> commit
2 ;
Commit complete.
SQL> where employee_id = 195
SP2-0734: unknown command beginning "where empl..." - rest of line ignored.
Because the undo tablespace is large enough and the HR user notices the problem within the
retention period, the HR user can bring back the entire table quickly without calling the DBA:
SQL> flashback table employees
2 to timestamp systimestamp - interval '15' minute;
Flashback complete.
SQL> select count(*) from employees;
COUNT(*)
----------
107
If two or more tables have a parent/child relationship with foreign key constraints, and rows
were inadvertently deleted from both tables, they can be flashed back in the same flashback
command:
Chapter 7: Managing Transactions with Undo Tablespaces 229
SQL> flashback table employees, departments
2 to timestamp systimestamp - interval '15' minute;
Flashback complete.
The HR user can also use EM Database Control to flash back one or more tables. In Figure 7-
7, she has selected the Perform Recovery link under the Availability tab.
Selecting an object type of Tables, the HR user has the option to flash back existing tables or
dropped tables.
Pages:
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391