.不同使用者之間的表資料複製 對於在一個資料庫上的兩個使用者A和B,假如需要把A下表old的資料複製到B下的new,請使用許可權足夠的使用者登入sqlplus: insert into B.new(select * from A.old); 如果需要加條件限制,比如複製當天的A.old資料 insert into B.new(select * from A.old where date=GMT); 藍色斜線處為選擇條件 2.同使用者表之間的資料複製
Oracle-Decode()函數和CASE語句的區別: 具體樣本如下: 1.CASE語句: SELECT CASE SIGN(5 - 5) WHEN 1 THEN 'Is Positive' WHEN -1 THEN 'Is Negative' ELSE 'Is Zero' END FROM DUAL; 後台實現: if (SIGN(5 – 5) = 1) { 'Is Positive'; } else if (SIGN(5 – 5) = 2 ) {
1.監控案例的等待: select event,sum(decode(wait_time,0,0,1)) prev, sum(decode(wait_time,0,1,0)) curr,count(*)from v$session_wait group by event order by 4;2.復原段的爭用情況:select name,waits,gets,waits/gets ratio from v$rollstat a,v$rollname b where
查詢及刪除 重複記錄的SQL語句1、尋找表 中多餘的重複記錄,重複記錄是根據單個欄位(peopleId)來判斷select * from peoplewhere peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)2、刪除表中多餘的重複記錄,重複記錄是根據單個欄位(peopleId)來判斷,只留有rowid最小的記錄delete from people
今天用到oracle查詢語句,想到oracle左右連結的事,記下來 我的查詢語句是這樣的 select v.* ,r.* from (select service_id, sum(amount) from V_ORDER_RELATION_DETAIL group by service_id ) v ,cfg_resource r where r.RES_ID=v.service_id(+);通過試圖我能查出來所有服務的使用方式,然後通過資源表我要查出各個資源的總量
1.----查某session當前正在執行的sqlSQL>select s.sid,sql_text from v$session s,v$sql qwhere s.SQL_ADDRESS=q.address and s.sql_hash_value=q.hash_valueand s.sid in (45,48,107) and s.serial# in (53098,54004,44803);SQL>select p.spid,sql_text from v$sqlarea
首先用作業系統命令找出CPU利用率較高的進程ID1.查看資料庫當前執行的所有SQL和對應的進程IDcolumn machine format a16;column program format a16;select p.spid,s.status,s.machine,p.program,q.sql_textfrom v$session s,v$sqlarea q,v$process pwhere s.sql_address=q.address and