Oracle中刪除表

2022-03-12 06:01:39 字數 764 閱讀 4917

1.首先你有drop的許可權

2.drop table 使用者.表明 ; 舉例 :drop table scott.tablea;

3.如2樓所說,看是否有外來鍵約束,否則你是刪不掉的

如果怕有約束可用

drop table 表名 cascade

如果你的表有其他約束

alter table 表名 drop constraint 約束名

drop table  表名;

例如:刪除商品表

drop table commodity;

注意: 1.用drop刪除表資料,不但會刪除表中的資料,連表結構也被刪除了!

truncate table 表名;

例如:刪除商品表

truncate table commodity;

注意: 1.用truncate刪除表資料,只是刪除表中的資料,表結構不會被刪除!

2.刪除整個表的資料時,過程是系統一次性刪除資料,效率比較高

3.truncate刪除釋放空間

delete  表名;

例如:刪除商品表

delete commodity;

注意: 1.用delete刪除表資料,只是刪除表中的資料,表結構不會被刪除!

2.雖然也是刪除整個表的資料,但是過程是系統一行一行地刪,效率比truncate低

3.delete刪除是不釋放空間的

oracle中的刪除使用者及表

在oracle中的imp exp 中在exp匯出了dmp檔案後需要再次還原的話,最好還是先刪除原有的表,應為在imp匯入dmp檔案的時候只能相當於乙個insert語句,匯出後存在的資料還是會在資料表中,他不會被匯入後dmp檔案覆蓋掉所有的資料。在此之前做的刪除資料可以刪除使用者,當然是要做級聯的刪除...

Oracle刪除表中重複資料

1.建立臨時表 備份全部資料到 create table tmap.t comm customer col log 731all as select from tmap.t comm customer col log 2.建立臨時表 備份資料 去除重複項 create table tmap.t co...

oracle 刪除表中重覆記錄

表demo是重複拷貝自dba objects,有88萬左右,不重複的是27323,沒有索引 方法一 delete from demo a where a.rowid select max rowid from demo b where b.object id a.object id 耗時 幾個小時以...