Oracle刪除使用者所有表

2021-09-13 22:38:16 字數 478 閱讀 8732

先使用sql查詢:

select 'delete from '|| table_name || ';' from user_tables order by table_name;

將查詢結果複製一下,在sql命令視窗裡再執行一次就刪除了所有的表。

select 'drop table '||table_name||';' from cat where table_type='table' order by table_name;

這個查詢的是cat表,查詢的結果條數會大於上一種,因為裡面包含了bin$開頭的表,oracle中刪除表後會有殘留,如果想要把這些殘留的表也刪除就要中這個查詢sql了,然後像上一種方法一樣

將查詢結果複製一下,在sql命令視窗裡再執行一次就刪除了所有的表。

--------------------- 

原文: 

oracle刪除指定使用者所有表

1 select drop table table name from all tables where owner 要刪除的使用者名稱 注意要大寫 2 刪除所有表 以使用者test為例 for example declare cursor cur1 is select table name fro...

oracle刪除某個使用者所有表

1 select drop table table name from all tables where owner 要刪除的使用者名稱 注意要大寫 2 刪除所有表 以使用者test為例 for example declare cursor cur1 is select table name fro...

oracle刪除使用者的所有表

1 檢視當前登入的使用者的所有表 select table name from user tables 檢視除了以 sym 開頭的所有表 select table name from user tables where table name not like sym 如果有刪除使用者的許可權,則可以...