In today’s article, we will learn how to drop an existing table in a database with the DROP TABLE command.
1 2 3 |
SQL> DROP TABLE ISLEM_NEW; Table dropped. |
Tables that are connected to each other with the primary key / foreign key relationship are deleted as follows to avoid errors when deleting.
1 2 3 |
SQL> DROP TABLE ACCOUNT_TMP CASCADE CONSTRAINTS; Table dropped. |
When the table is deleted, it may not disappear directly. This depends on the value of the “RECYCLEBIN” parameter.
If ON, the table is sent to the trash first. And if desired, it can be brought back with flashback in a short time.
The value of the “RECYCLEBIN” parameter can be seen as follows.
1 2 3 4 5 |
SQL> show parameter RECYCLEBIN; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ recyclebin string on |
We can see the tables in the trash bin as follows.
1.
1 2 3 4 |
SQL> show RECYCLEBIN; ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME ---------------- ------------------------------ ------------ ------------------- ISLEM_NEW BIN$G2OX9sYbHkDgU+gfFKxP+g==$0 TABLE 2015-07-21:16:25:53 |
2. The trash bin of the user we are logged in to;
1 |
SELECT * FROM RECYCLEBIN; |
For all users;
1 |
SELECT * FROM DBA_recyclebin; |
The size of the deleted table is not released immediately. It must be deleted from the trash to be released.
1 2 3 4 5 6 7 |
SQL> PURGE RECYCLEBIN; Recyclebin purged. SQL> PURGE DBA_RECYCLEBIN; DBA Recyclebin purged. |