Undo the DROP command using FLASHBACK command
Example:
CREATE TABLE xx_drop_test (ID NUMBER,attribute1 VARCHAR2(10))
SELECT *
FROM xx_drop_test
SELECT *
FROM all_objects
WHERE object_name = 'XX_DROP_TEST' AND object_type = 'TABLE'
-- 1 row returned
DROP TABLE xx_drop_test
COMMIT;
SELECT *
FROM xx_drop_test
--Table or view does not exists
SELECT *
FROM all_objects
WHERE object_name = 'XX_DROP_TEST' AND object_type = 'TABLE'
-- No rows returned
-- To view all dropped tables
SELECT *
FROM user_recyclebin
WHERE original_name = 'XX_DROP_TEST' AND TYPE = 'TABLE'
--FLASHBACK TABLE <TABLE_NAME> TO BEFORE DROP
FLASHBACK TABLE xx_drop_test TO BEFORE DROP
--FLASHBACK TABLE <TABLE_NAME> TO BEFORE DROP RENAME TO <NEW_TABLE_NAME>
FLASHBACK TABLE xx_drop_test TO BEFORE DROP RENAME TO xx_drop_test
-- Ignore the message: ORA-27231: Message 27231 not found; product=RDBMS; facility=ORA
-- To delete table permanantly, we cann't flashback it. We can't find in user_recyclebin
--DROP TABLE <TABLE_NAME> PURGE
DROP TABLE xx_drop_test PURGE
Thanks,
Rajesh
No comments:
Post a Comment