天天看點

oracle删除表的重複記錄,Oracle删除表中重複記錄

Oracle删除表中重複記錄

--刪除重復列

a.如果有ID字段,就是具有唯一性的字段

delect   table   where   id   not   in   (

select   max(id)   from   table   group   by   col1,col2,col3...

)

group   by   子句後跟的字段就是你用到判斷重複的字段

b.,如果是判斷所有字段

select   *   into   #aa   from   table   group   by   id1,id2,....

delete   table   table

insert   into   table

select   *   from   #aa

c.如果表中有ID的情況

select   identity(int,1,1)   as   id,*   into   #temp   from   tabel

delect   #   where   id   not   in   (

select   max(id)   from   #   group   by   col1,col2,col3...)

delect   table

inset   into   table(...)

select   .....   from   #temp

col1+','+col2+','...col5   組合主鍵

select   *   from   table   where   col1+','+col2+','...col5   in   (

select   max(col1+','+col2+','...col5)   from   table

where   having   count(*)>1

group   by   col1,col2,col3,col4

)

group   by   子句後跟的字段就是你用到判斷重複的字段

d.

相關文檔:

with

lockinfo as (

select distinct decode(sql_hash_value, 0, prev_hash_value, sql_hash_value) sql_hash_value, decode  (sql_hash_value, 0, prev_sql_addr, sql_address) sql_address, s.sid, l.id1 object_id, l.block

from v$lock l, v$session s

&n ......

修 改 SID

案例: 舊資料庫(OLDDB)

檔案存放(data files,redo files,control files,temp files, undo files)目錄是

(/u01/OLDDB)

dump檔案目錄是(/u01/dump)

新資料庫(NEWDB)

......

ORACLE EXP/IMP 參數詳解2010-03-22 17:53Oracle資料庫使用IMP/EXP工具進行資料導入與導出介紹:

1.使用指令行:

資料導出:

1.将資料庫TEST完全導出,使用者名system密碼manager導出到D:\Test_bak.dmp中

exp system/[email protected] file=d:\Test_bak.dmp full=y

ora10表示資料庫名

2.将資料庫中system使用者與sys使用者的表� ......

http://kang275284.javaeye.com/blog/154331

一、 先介紹一下oracle

的SGA:資料庫的系統全局區,SGA主要由三部分構

成:共享池、資料緩沖區、日志緩沖區。

1、 共享池又由兩部分構成:共享SQL

和資料字典緩沖區。共享SQL

區專門存放使用者SQL

令,oracle

使用最近最少使用等優先級算法來更新覆寫� ......

t表中将近有1100萬資料,很多時候,我們要進行字元串比對,在SQL語句中,我們通常使用like來達到我們搜尋的目标。但經過實際測試發

現,like的效率與instr函數差别相當大。下面是一些測試結果:

SQL> set timing on

SQL> select count(*) from t where instr(title,’手冊’)>0;

COUNT(*)

&mdash ......