DBA常用SQL語句[sql server] 2
21、檢視object分類數量:
select decode(o.type#,1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6, 'SEQUENCE','OTHER') object_type , count(*) quantity from sys.obj$ o where o.type# > 1 group by decode(o.type#,1,'INDEX',2,'TABLE',3,'CLUSTER' ,4,'VIEW',5,'SYNONYM',6,'SEQUENCE','OTHER') union select 'COLUMN', count(*) from sys.col$ union select 'DB LINK' , count(*) from all_objects;
22、有關connection的相關資訊:
1)檢視有哪些使用者連線
select s.osuser os_user_name,decode(sign(48 - command),1,to_char(command),
'Action Code #' || to_char(command))action,p.program oracle_process,
status session_status,s.terminal terminal,s.program program,
s.username user_name,s.fixed_table_sequence activity_meter,''query,
0 memory,0 max_memory,0 cpu_usage,s.sid,s.serial# serial_num
from v$session s,v$process p where s.paddr=p.addr and s.type = 'USER'
order by s.username, s.osuser;
2)根據v.sid檢視對應連線的資源佔用等情況
select n.name,v.value,n.class,n.statistic#
from v$statname n,v$sesstat v where v.sid=18 and v.statistic# = n.statistic# order by n.class, n.statistic#;
3)根據sid檢視對應連線正在執行的sql
select /*+ PUSH_SUBQ */ command_type,sql_text,sharable_mem, persistent_mem,runtime_mem,sorts,version_count,
loaded_versions,open_versions,users_opening,executions, users_executing,loads,first_load_time,invalidations, parse_calls,disk_reads,buffer_gets,rows_processed,sysdate start_time,sysdate finish_time,'>'|| address sql_address,
'N' status from v$sqlarea where address = (select sql_address from v$session where sid=8);
根據pid檢視sql語句:
select sql_text from v$sql
where address in
(select sql_address from v$session
where sid in
(select sid from v$session where paddr in (select addr from v$process where spid=&pid)));
23、查詢表空間使用情況:
select a.tablespace_name "表空間名稱",
100-round((nvl(b.bytes_free,0)/a.bytes_alloc)*100,2) "佔用率(%)",
round(a.bytes_alloc/1024/1024,2) "容量(M)",
round(nvl(b.bytes_free,0)/1024/1024,2) "空閒(M)",
round((a.bytes_alloc-nvl(b.bytes_free,0))/1024/1024,2) "使用(M)",
Largest "最大擴充套件段(M)",to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') "取樣時間" from (select f.tablespace_name,sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible,'YES',f.maxbytes,'NO',f.bytes)) maxbytes
from dba_data_files f group by tablespace_name) a,
(select f.tablespace_name,sum(f.bytes) bytes_free
from dba_free_space f group by tablespace_name) b,
(select round(max(ff.length)*16/1024,2) Largest,ts.name tablespace_name
from sys.fet$ ff, sys.file$ tf,sys.ts$ ts
where ts.ts#=ff.ts# and ff.file#=tf.relfile# and ts.ts#=tf.ts#
group by ts.name, tf.blocks) c where a.tablespace_name = b.tablespace_name and a.tablespace_name = c.tablespace_name;
SELECT UPPER(F.TABLESPACE_NAME) "表空間名",
D.TOT_GROOTTE_MB "表空間大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,
2),
'990.99') "使用比",
F.TOTAL_BYTES "空閒空間(M)",
F.MAX_BYTES "最大塊(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 4 DESC;
24、查詢表空間的碎片程度:
SQL>select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name having count(tablespace_name)>10;
SQL>alter tablespace name coalesce;
SQL>alter table table_name deallocate unused;
SQL>create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;
SQL>select * from ts_blocks_v;
SQL>select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space group by tablespace_name;
SQL>select 'alter tablespace '||TABLESPACE_NAME||' coalesce;'
from DBA_FREE_SPACE_COALESCED where PERCENT_EXTENTS_COALESCED<100
or PERCENT_BLOCKS_COALESCED<100;
由於自由空間碎片是由幾部分組成,如範圍數量、最大範圍尺寸等,我們可
用fsfi--free space fragmentation index(自由空間碎片索引)值來直觀體現:
fsfi=100*sqrt(max(extent)/sum(extents))*1/sqrt(sqrt(count(extents)))
rem fsfi value compute
rem fsfi.sql
column fsfi format 999,99
select tablespace_name,sqrt(max(blocks)/sum(blocks))*
(100/sqrt(sqrt(count(blocks)))) fsfi
from dba_free_space
group by tablespace_name order by 1;
spool fsfi.rep;
/
spool off;
可以看出,fsfi的最大可能值為100(一個理想的單檔案表空間)。隨著範
圍的增加,fsfi值緩慢下降,而隨著最大範圍尺寸的減少,fsfi值會迅速下降。
比如,在某資料庫執行指令碼fsfi.sql,得到以下fsfi值:
tablespace_name fsfi
------------------------------ -------
rbs 74.06
system 100.00
temp 22.82
tools 75.79
users 100.00
user_tools 100.00
ydcx_data 47.34
ydcx_idx 57.19
ydjf_data 33.80
ydjf_idx 75.55
---- 統計出了資料庫的fsfi值,就可以把它作為一個可比引數。在一個有著足夠
有效自由空間,且fsfi值超過30的表空間中,很少會遇見有效自由空間的問題。
當一個空間將要接近可比引數時,就需要做碎片整理了。
25、查詢有哪些資料庫例項在執行:
select inst_name from v$active_instances;
26、以DBA角色, 檢視當前資料庫裡鎖的情況:
select object_id,session_id,locked_mode from v$locked_object;
select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;
27、檢視錶是否是分割槽表:
select TABLE_NAME,PARTITIONED from user_tables where TABLE_NAME='LOCALUSAGE';
TABLE_NAME PAR
------------------------------ --- ---------
LOCALUSAGE YES
28、檢視分割槽表的分割槽名和相應的表空間名:
select TABLE_NAME, PARTITION_NAME,TABLESPACE_NAME from user_tab_partitions where table_name like ‘%USAGE%’;
29、檢視索引是否是分割槽索引:
SELECT INDEX_NAME, TABLE_NAME, STATUS, PARTITIONED FROM USER_INDEXES WHERE TABLE_NAME LIKE '%USAGE';
30、如果返回的PATITIONED為YES,請再執行如下語句來查詢分割槽索引的型別:SELECT index_name,table_name,locality FROM user_part_indexes;
31、Dual是Oracle中的一個實際存在的表,任何使用者均可讀取,常用在沒有目標表的Select中.
檢視系統時間:
select to_char(sysdate,'yy-mm-dd hh24:mi:ss') shijian from dual;
32、檢視索引段中extent的數量:
select segment_name,count(*) from dba_extents
where segment_type='INDEX' and owner='SCOTT' group by segment_name;
33、檢視系統表中的使用者索引(用來檢查在system表空間內其他使用者索引的存在):
SQL>select count(*) from dba_indexes where tablespace_name=’SYSTEM’ and owner NOT IN(‘SYS’,’SYSTEM’);
34、檢視wacos表空間內的索引的擴充套件情況:
SELECT SUBSTR(segment_name,1,20) "SEGMENT NAME",bytes, COUNT(bytes)
FROM dba_extents WHERE segment_name IN( SELECT index_name FROM dba_indexes
WHERE tablespace_name = 'WACOS') GROUP BY segment_name,bytes ORDER BY segment_name;
35、檢視錶空間資料檔案的讀寫效能:
SQL>Select name,phyrds,phywrts,avgiotim,miniotim,maxiowtm,maxiortm from v$filestat,v$datafile where v$filestat.file#=v$datafile.file#;
SQL>Select fs.name name,f.phyrds,f.phyblkrd,f.phywrts,f.phyblkwrt ,f.readtim,f.writetim
from v$filestat f, v$datafile fs where f.file# = fs.file# order by fs.name;
(注意:如果phyblkrd與phyrds很接近的話,則表明這個表空間中存在全表掃描的表,這些表需要調整索引或最佳化SQL語句)
36、轉換表空間為local方式管理:
SQL> exec sys.dbms_space_admin.tablespace_migrate_to_local('TBS_TEST') ;
37、檢視一下哪個使用者在用臨時段:
SELECT username,sid,serial#,sql_address,machine,program,tablespace,segtype,
contents FROM v$session se,v$sort_usage su WHERE se.saddr=su.session_addr;
38、檢視佔io較大的正在執行的session:
SELECT se.sid,se.serial#,pr.SPID,se.username,se.status,se.terminal,se.program, se.MODULE,se.sql_address,st.event,st.p1text,si.physical_reads,si.block_changes FROM v$session se,v$session_wait st,v$sess_io si,v$process pr WHERE st.sid=se.sid AND st.sid=si.sid AND se.PADDR=pr.ADDR AND se.sid>6 AND st.wait_time=0 AND st.event NOT LIKE '%SQL%' ORDER BY physical_reads DESC;
39、查詢前十條效能差的sql:
SELECT * FROM(SELECT PARSING_USER_ID EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READS,sql_text FROM v$sqlarea ORDER BY disk_reads DESC) WHERE ROWNUM<10;
40、刪除使用者下所有表的語句:
select 'drop table '||table_name||' cascade constraints;' from user_tables;
41、檢視LOCK,並殺掉會話:
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode beading 'Lock Held' format a20
column request heading 'Lock Requested' format a20
column serial# format 99999
column username format a10 heading "Username"
column terminal heading Term format a6
column tab format a35 heading "table Name"
column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||','||substr(T1.NAME,1,20) tab,
decode(L.LMODE, 1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER#= T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5;
--alter system kill session ' , ';
column username format A15
column sid format 9990 heading SID
column type format A4
column lmode format 990 heading 'HELD'
column request format 990 heading 'REQ'
column id1 format 9999990
column id2 format 9999990
break on id1 skip 1 dup
spool tfslckwt.lst
select sn.username,
m.sid,
m.type,
DECODE(m.lmode,0,'None',
1,'Null',
2,'Row Share',
3,'Row Excl.',
4,'Share',
5,'S/Row Excl.',
6,'Exclusive',
lmode,ltrim(to_char(lmode,'990'))) lmode,
DECODE(m.request,0,'None',
1,'Null',
2,'Row Share',
3,'Row Excl.',
4,'Share',
5,'S/Row Excl.',
6,'Exclusive',
request,ltrim(to_char(m.request,'990'))) request,
m.id1,
m.id2
from v$session sn,
v$lock m
where (sn.sid = m.sid and m.request!= 0)
or (sn.sid = m.sid and
m.request = 0 and lmode != 4 and
(id1 ,id2) in (select s.id1,
s.id2
from v$lock s
where request != 0 and s.id1 = m.id1 and s.id2 = m.id2)
)
order by id1,id2,m.request;
spool off
clear breaks
42.檢視WACOS表空間下所有的索引:
SQL>select 'analyze index '||segment_name||' validate structure;' from dba_segments where tablespace_name=’WACOS’and segment_type=’INDEX’;
43. 怎樣識別IO競爭和負載平衡:
col 檔名 format a35
select
df.name 檔名,
fs.phyrds 讀次數,
fs.phywrts 寫次數,
(fs.readtim/decode(fs.phyrds,0,-1,fs.phyrds)) 讀時間,
(fs.writetim/decode(fs.phywrts,0,-1,fs.phywrts)) 寫時間
from
v$datafile df,
v$filestat fs
where df.file#=fs.file#
order by df.name
/
檔名 讀次數 寫次數 讀時間 寫時間
-------------------------------------------- ---------- ---------- ---------- ----------
C:ORACLEORADATAORADBDR01.DBF 885 883 0 0
C:ORACLEORADATAORADBINDX01.DBF 885 883 0 0
C:ORACLEORADATAORADBOEM_REPOSITORY.ORA 885 883 0 0
C:ORACLEORADATAORADBRBS01.DBF 925 22306 0 0
C:ORACLEORADATAORADB YSTEM01.DBF 50804 155025 0 0
C:ORACLEORADATAORADBTEMP01.DBF 887 894 0 0
C:ORACLEORADATAORADBTOOLS01.DBF 886 892 0 0
C:ORACLEORADATAORADBUSERS01.DBF 885 883 0 0
已選擇8行。
其中:ORADB為資料庫名,因為本例中資料庫使預設安裝,沒有進行過最佳化、調整,
所以,一直在system表空間上做操作,導致system表空間所在的資料檔案SYSTEM01.DBF被讀寫的次數最多,
這也說明了,儘量不要在system表空間做與系統無關的操作,應給各個使用者建立單獨的表空間。
44. 檢視哪些session正在使用哪些回滾段:
col 回滾段名 format a10
col SID format 9990
col 使用者名稱 format a10
col 操作程式 format a80
col status format a6 trunc
SELECT r.name 回滾段名,
s.sid,
s.serial#,
s.username 使用者名稱,
t.status,
t.cr_get,
t.phy_io,
t.used_ublk,
t.noundo,
substr(s.program, 1, 78) 操作程式
FROM sys.v_$session s,sys.v_$transaction t,sys.v_$rollname r
WHERE t.addr = s.taddr and t.xidusn = r.usn
ORDER BY t.cr_get,t.phy_io;
45.檢查誰Lock了什麼物件:
set line 200
col "O/S-User" format a10
col "Ora-User" format a10
col "Obj Locked" format a30
select /*+RULE*/s.machine, s.osuser "O/S-User", s.username "Ora-User", s.sid "Session-ID",
s.serial# "Serial", s.process "Process-ID", s.status "Status",l.name "Obj Locked",
l.mode_held "Lock Mode"
from v$session s,dba_dml_locks l,v$process p
where l.session_id = s.sid and p.addr = s.paddr
/
46.造成等待的LOCK的資訊,比如LOCK型別等:
col event format a30
set line 160
col machine format a10
col username format a15
select b.sid,b.serial#,b.username,machine,event,wait_time,chr(bitand(p1,-16777216)/16777215)||chr(bitand(p1, 16711680)/65535) "Enqueue Type" from v$session_wait a,v$session b
where event not like 'SQL*N%' and event not like 'rdbms%' and a.sid=b.sid
and b.sid>8 and event='enqueue'
order by username
/
47. List of the locked Oracle objects
set line 120
column object_name format a32
column OS_USER_NAME format a12
column orauser format a12
column sql_text format a32
column serial# format 999999
column sid format 99999
SELECT OS_USER_NAME, ORACLE_USERNAME AS orauser, s.sid, o.object_name,
o.object_type, s.serial#, a.sql_text
FROM v$locked_object l, dba_objects o, v$session s, v$sqlarea a
WHERE l.object_id = o.object_id
AND s.SQL_ADDRESS = a.address
AND l.SESSION_ID = s.sid;
SELECT 'ALTER SYSTEM KILL SESSION '''||TO_CHAR(s.sid)||','||TO_CHAR(s.serial#)||''';'
AS "Statement to kill"
FROM v$locked_object l, dba_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.SESSION_ID = s.sid;
oracle資料庫效能監控的SQL
1. 監控事例的等待
SQL>select event,sum(decode(wait_Time,0,0,1)) "Prev",sum(decode(wait_Time,0,1,0)) "Curr",count(*) "Tot" from v$session_Wait group by event order by 4;
2. 回滾段的爭用情況
SQL>select name, waits, gets, waits/gets "Ratio" from v$rollstat a, v$rollname b where a.usn = b.usn;
3. 監控表空間的 I/O 比例
SQL>select df.tablespace_name name,df.file_name "file",f.phyrds pyr,
f.phyblkrd pbr,f.phywrts pyw, f.phyblkwrt pbw from v$filestat f, dba_data_files df where f.file# = df.file_id
order by df.tablespace_name;
4. 監控檔案系統的 I/O 比例
SQL>select substr(a.file#,1,2) "#", substr(a.name,1,30) "Name",
a.status,a.bytes,b.phyrds,b.phywrts from v$datafile a, v$filestat b
where a.file# = b.file#;
5.在某個使用者下找所有的索引
SQL>select user_indexes.table_name, user_indexes.index_name,uniqueness, column_name from user_ind_columns, user_indexes where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name = user_indexes.table_name
order by user_indexes.table_type, user_indexes.table_name,
user_indexes.index_name, column_position;
6. 監控 SGA 的命中率
SQL>select a.value + b.value "logical_reads", c.value "phys_reads",
round(100 * ((a.value+b.value)-c.value) / (a.value+b.value)) "BUFFER HIT RATIO" from v$sysstat a, v$sysstat b, v$sysstat c where a.statistic# = 38 and b.statistic# = 39 and c.statistic# = 40;
7. 監控 SGA 中字典緩衝區的命中率
SQL>select parameter, gets,Getmisses , getmisses/(gets+getmisses)*100 "miss ratio",(1-(sum(getmisses)/ (sum(gets)+sum(getmisses))))*100 "Hit ratio" from v$rowcache where gets+getmisses <>0 group by parameter, gets, getmisses;
8. 監控 SGA 中共享快取區的命中率,應該小於1%
SQL>select sum(pins) "Total Pins", sum(reloads) "Total Reloads",
sum(reloads)/sum(pins) *100 libcache from v$librarycache;
SQL>select sum(pinhits-reloads)/sum(pins) "hit radio",sum(reloads)/sum(pins) "reload percent" from v$librarycache;
9. 顯示所有資料庫物件的類別和大小
SQL>select count(name) num_instances ,type ,sum(source_size) source_size,sum(parsed_size) parsed_size ,sum(code_size) code_size ,sum(error_size) error_size,sum(source_size) +sum(parsed_size) +sum(code_size) +sum(error_size) size_required from dba_object_size group by type order by 2;
10. 監控 SGA 中重做日誌快取區的命中率,應該小於1%
SQL>SELECT name, gets, misses, immediate_gets, immediate_misses,
Decode(gets,0,0,misses/gets*100) ratio1, Decode(immediate_gets+immediate_misses,0,0, immediate_misses/(immediate_gets+immediate_misses)*100) ratio2
FROM v$latch WHERE name IN ('redo allocation', 'redo copy');
11. 監控記憶體和硬碟的排序比率,最好使它小於 .10,增加 sort_area_size
SQL>SELECT name, value FROM v$sysstat WHERE name IN ('sorts (memory)', 'sorts (disk)');
12. 監控當前資料庫誰在執行什麼SQL語句
SQL>SELECT osuser, username, sql_text from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
13. 監控字典緩衝區
SQL>SELECT (SUM(PINS - RELOADS)) / SUM(PINS) "LIB CACHE" FROM V$LIBRARYCACHE;
SQL>SELECT (SUM(GETS - GETMISSES - USAGE - FIXED)) / SUM(GETS) "ROW CACHE" FROM V$ROWCACHE;
SQL>SELECT SUM(PINS) "EXECUTIONS", SUM(RELOADS) "CACHE MISSES WHILE EXECUTING" FROM V$LIBRARYCACHE;(後者除以前者,此比率小於1%,接近0%為好)
SQL>SELECT SUM(GETS) "DICTIONARY GETS",SUM(GETMISSES) "DICTIONARY CACHE GET MISSES" FROM V$ROWCACHE;
14. 查詢ORACLE字符集
SQL>select * from sys.props$ where name='NLS_CHARACTERSET';
15. 監控 MTS
SQL>select busy/(busy+idle) "shared servers busy" from v$dispatcher;
(此值大於0.5時,引數需加大)
SQL>select sum(wait)/sum(totalq) "dispatcher waits" from v$queue where type='dispatcher';
SQL>select count(*) from v$dispatcher;
SQL>select servers_highwater from v$mts;
(servers_highwater接近mts_max_servers時,引數需加大)
16. 碎片程度
SQL>select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name having count(tablespace_name)>10;
SQL>alter tablespace name coalesce;
SQL>alter table name deallocate unused;
SQL>create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space
union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;
select * from ts_blocks_v;
SQL>select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space group by tablespace_name;
檢視碎片程度高的表
SQL>SELECT segment_name table_name,COUNT(*) extents
FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM') GROUP BY
segment_name HAVING COUNT(*)=(SELECT MAX(COUNT(*)) FROM dba_segments GROUP BY segment_name);
17. 表、索引的儲存情況檢查
SQL>select segment_name,sum(bytes),count(*) ext_quan from dba_extents where tablespace_name='&tablespace_name' and segment_type='TABLE' group by tablespace_name,segment_name;
SQL>select segment_name,count(*) from dba_extents where segment_type='INDEX' and owner='&owner' group by segment_name;
18、找使用CPU多的使用者session
SQL>select a.sid,spid,status,substr(a.program,1,40) prog,a.terminal,osuser,value/60/100 value from v$session a,v$process b,v$sesstat c
where c.statistic#=12 and c.sid=a.sid and a.paddr=b.addr order by value desc;
(12是cpu used by this session)[@more@]
select decode(o.type#,1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6, 'SEQUENCE','OTHER') object_type , count(*) quantity from sys.obj$ o where o.type# > 1 group by decode(o.type#,1,'INDEX',2,'TABLE',3,'CLUSTER' ,4,'VIEW',5,'SYNONYM',6,'SEQUENCE','OTHER') union select 'COLUMN', count(*) from sys.col$ union select 'DB LINK' , count(*) from all_objects;
22、有關connection的相關資訊:
1)檢視有哪些使用者連線
select s.osuser os_user_name,decode(sign(48 - command),1,to_char(command),
'Action Code #' || to_char(command))action,p.program oracle_process,
status session_status,s.terminal terminal,s.program program,
s.username user_name,s.fixed_table_sequence activity_meter,''query,
0 memory,0 max_memory,0 cpu_usage,s.sid,s.serial# serial_num
from v$session s,v$process p where s.paddr=p.addr and s.type = 'USER'
order by s.username, s.osuser;
2)根據v.sid檢視對應連線的資源佔用等情況
select n.name,v.value,n.class,n.statistic#
from v$statname n,v$sesstat v where v.sid=18 and v.statistic# = n.statistic# order by n.class, n.statistic#;
3)根據sid檢視對應連線正在執行的sql
select /*+ PUSH_SUBQ */ command_type,sql_text,sharable_mem, persistent_mem,runtime_mem,sorts,version_count,
loaded_versions,open_versions,users_opening,executions, users_executing,loads,first_load_time,invalidations, parse_calls,disk_reads,buffer_gets,rows_processed,sysdate start_time,sysdate finish_time,'>'|| address sql_address,
'N' status from v$sqlarea where address = (select sql_address from v$session where sid=8);
根據pid檢視sql語句:
select sql_text from v$sql
where address in
(select sql_address from v$session
where sid in
(select sid from v$session where paddr in (select addr from v$process where spid=&pid)));
23、查詢表空間使用情況:
select a.tablespace_name "表空間名稱",
100-round((nvl(b.bytes_free,0)/a.bytes_alloc)*100,2) "佔用率(%)",
round(a.bytes_alloc/1024/1024,2) "容量(M)",
round(nvl(b.bytes_free,0)/1024/1024,2) "空閒(M)",
round((a.bytes_alloc-nvl(b.bytes_free,0))/1024/1024,2) "使用(M)",
Largest "最大擴充套件段(M)",to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') "取樣時間" from (select f.tablespace_name,sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible,'YES',f.maxbytes,'NO',f.bytes)) maxbytes
from dba_data_files f group by tablespace_name) a,
(select f.tablespace_name,sum(f.bytes) bytes_free
from dba_free_space f group by tablespace_name) b,
(select round(max(ff.length)*16/1024,2) Largest,ts.name tablespace_name
from sys.fet$ ff, sys.file$ tf,sys.ts$ ts
where ts.ts#=ff.ts# and ff.file#=tf.relfile# and ts.ts#=tf.ts#
group by ts.name, tf.blocks) c where a.tablespace_name = b.tablespace_name and a.tablespace_name = c.tablespace_name;
SELECT UPPER(F.TABLESPACE_NAME) "表空間名",
D.TOT_GROOTTE_MB "表空間大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,
2),
'990.99') "使用比",
F.TOTAL_BYTES "空閒空間(M)",
F.MAX_BYTES "最大塊(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 4 DESC;
24、查詢表空間的碎片程度:
SQL>select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name having count(tablespace_name)>10;
SQL>alter tablespace name coalesce;
SQL>alter table table_name deallocate unused;
SQL>create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;
SQL>select * from ts_blocks_v;
SQL>select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space group by tablespace_name;
SQL>select 'alter tablespace '||TABLESPACE_NAME||' coalesce;'
from DBA_FREE_SPACE_COALESCED where PERCENT_EXTENTS_COALESCED<100
or PERCENT_BLOCKS_COALESCED<100;
由於自由空間碎片是由幾部分組成,如範圍數量、最大範圍尺寸等,我們可
用fsfi--free space fragmentation index(自由空間碎片索引)值來直觀體現:
fsfi=100*sqrt(max(extent)/sum(extents))*1/sqrt(sqrt(count(extents)))
rem fsfi value compute
rem fsfi.sql
column fsfi format 999,99
select tablespace_name,sqrt(max(blocks)/sum(blocks))*
(100/sqrt(sqrt(count(blocks)))) fsfi
from dba_free_space
group by tablespace_name order by 1;
spool fsfi.rep;
/
spool off;
可以看出,fsfi的最大可能值為100(一個理想的單檔案表空間)。隨著範
圍的增加,fsfi值緩慢下降,而隨著最大範圍尺寸的減少,fsfi值會迅速下降。
比如,在某資料庫執行指令碼fsfi.sql,得到以下fsfi值:
tablespace_name fsfi
------------------------------ -------
rbs 74.06
system 100.00
temp 22.82
tools 75.79
users 100.00
user_tools 100.00
ydcx_data 47.34
ydcx_idx 57.19
ydjf_data 33.80
ydjf_idx 75.55
---- 統計出了資料庫的fsfi值,就可以把它作為一個可比引數。在一個有著足夠
有效自由空間,且fsfi值超過30的表空間中,很少會遇見有效自由空間的問題。
當一個空間將要接近可比引數時,就需要做碎片整理了。
25、查詢有哪些資料庫例項在執行:
select inst_name from v$active_instances;
26、以DBA角色, 檢視當前資料庫裡鎖的情況:
select object_id,session_id,locked_mode from v$locked_object;
select t2.username,t2.sid,t2.serial#,t2.logon_time from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;
27、檢視錶是否是分割槽表:
select TABLE_NAME,PARTITIONED from user_tables where TABLE_NAME='LOCALUSAGE';
TABLE_NAME PAR
------------------------------ --- ---------
LOCALUSAGE YES
28、檢視分割槽表的分割槽名和相應的表空間名:
select TABLE_NAME, PARTITION_NAME,TABLESPACE_NAME from user_tab_partitions where table_name like ‘%USAGE%’;
29、檢視索引是否是分割槽索引:
SELECT INDEX_NAME, TABLE_NAME, STATUS, PARTITIONED FROM USER_INDEXES WHERE TABLE_NAME LIKE '%USAGE';
30、如果返回的PATITIONED為YES,請再執行如下語句來查詢分割槽索引的型別:SELECT index_name,table_name,locality FROM user_part_indexes;
31、Dual是Oracle中的一個實際存在的表,任何使用者均可讀取,常用在沒有目標表的Select中.
檢視系統時間:
select to_char(sysdate,'yy-mm-dd hh24:mi:ss') shijian from dual;
32、檢視索引段中extent的數量:
select segment_name,count(*) from dba_extents
where segment_type='INDEX' and owner='SCOTT' group by segment_name;
33、檢視系統表中的使用者索引(用來檢查在system表空間內其他使用者索引的存在):
SQL>select count(*) from dba_indexes where tablespace_name=’SYSTEM’ and owner NOT IN(‘SYS’,’SYSTEM’);
34、檢視wacos表空間內的索引的擴充套件情況:
SELECT SUBSTR(segment_name,1,20) "SEGMENT NAME",bytes, COUNT(bytes)
FROM dba_extents WHERE segment_name IN( SELECT index_name FROM dba_indexes
WHERE tablespace_name = 'WACOS') GROUP BY segment_name,bytes ORDER BY segment_name;
35、檢視錶空間資料檔案的讀寫效能:
SQL>Select name,phyrds,phywrts,avgiotim,miniotim,maxiowtm,maxiortm from v$filestat,v$datafile where v$filestat.file#=v$datafile.file#;
SQL>Select fs.name name,f.phyrds,f.phyblkrd,f.phywrts,f.phyblkwrt ,f.readtim,f.writetim
from v$filestat f, v$datafile fs where f.file# = fs.file# order by fs.name;
(注意:如果phyblkrd與phyrds很接近的話,則表明這個表空間中存在全表掃描的表,這些表需要調整索引或最佳化SQL語句)
36、轉換表空間為local方式管理:
SQL> exec sys.dbms_space_admin.tablespace_migrate_to_local('TBS_TEST') ;
37、檢視一下哪個使用者在用臨時段:
SELECT username,sid,serial#,sql_address,machine,program,tablespace,segtype,
contents FROM v$session se,v$sort_usage su WHERE se.saddr=su.session_addr;
38、檢視佔io較大的正在執行的session:
SELECT se.sid,se.serial#,pr.SPID,se.username,se.status,se.terminal,se.program, se.MODULE,se.sql_address,st.event,st.p1text,si.physical_reads,si.block_changes FROM v$session se,v$session_wait st,v$sess_io si,v$process pr WHERE st.sid=se.sid AND st.sid=si.sid AND se.PADDR=pr.ADDR AND se.sid>6 AND st.wait_time=0 AND st.event NOT LIKE '%SQL%' ORDER BY physical_reads DESC;
39、查詢前十條效能差的sql:
SELECT * FROM(SELECT PARSING_USER_ID EXECUTIONS,SORTS,COMMAND_TYPE,DISK_READS,sql_text FROM v$sqlarea ORDER BY disk_reads DESC) WHERE ROWNUM<10;
40、刪除使用者下所有表的語句:
select 'drop table '||table_name||' cascade constraints;' from user_tables;
41、檢視LOCK,並殺掉會話:
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13
column res heading 'Resource Type' format 999
column id1 format 9999990
column id2 format 9999990
column lmode beading 'Lock Held' format a20
column request heading 'Lock Requested' format a20
column serial# format 99999
column username format a10 heading "Username"
column terminal heading Term format a6
column tab format a35 heading "table Name"
column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') username,
nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||','||substr(T1.NAME,1,20) tab,
decode(L.LMODE, 1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,
decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request
from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2)
and U1.USER#= T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5;
--alter system kill session ' , ';
column username format A15
column sid format 9990 heading SID
column type format A4
column lmode format 990 heading 'HELD'
column request format 990 heading 'REQ'
column id1 format 9999990
column id2 format 9999990
break on id1 skip 1 dup
spool tfslckwt.lst
select sn.username,
m.sid,
m.type,
DECODE(m.lmode,0,'None',
1,'Null',
2,'Row Share',
3,'Row Excl.',
4,'Share',
5,'S/Row Excl.',
6,'Exclusive',
lmode,ltrim(to_char(lmode,'990'))) lmode,
DECODE(m.request,0,'None',
1,'Null',
2,'Row Share',
3,'Row Excl.',
4,'Share',
5,'S/Row Excl.',
6,'Exclusive',
request,ltrim(to_char(m.request,'990'))) request,
m.id1,
m.id2
from v$session sn,
v$lock m
where (sn.sid = m.sid and m.request!= 0)
or (sn.sid = m.sid and
m.request = 0 and lmode != 4 and
(id1 ,id2) in (select s.id1,
s.id2
from v$lock s
where request != 0 and s.id1 = m.id1 and s.id2 = m.id2)
)
order by id1,id2,m.request;
spool off
clear breaks
42.檢視WACOS表空間下所有的索引:
SQL>select 'analyze index '||segment_name||' validate structure;' from dba_segments where tablespace_name=’WACOS’and segment_type=’INDEX’;
43. 怎樣識別IO競爭和負載平衡:
col 檔名 format a35
select
df.name 檔名,
fs.phyrds 讀次數,
fs.phywrts 寫次數,
(fs.readtim/decode(fs.phyrds,0,-1,fs.phyrds)) 讀時間,
(fs.writetim/decode(fs.phywrts,0,-1,fs.phywrts)) 寫時間
from
v$datafile df,
v$filestat fs
where df.file#=fs.file#
order by df.name
/
檔名 讀次數 寫次數 讀時間 寫時間
-------------------------------------------- ---------- ---------- ---------- ----------
C:ORACLEORADATAORADBDR01.DBF 885 883 0 0
C:ORACLEORADATAORADBINDX01.DBF 885 883 0 0
C:ORACLEORADATAORADBOEM_REPOSITORY.ORA 885 883 0 0
C:ORACLEORADATAORADBRBS01.DBF 925 22306 0 0
C:ORACLEORADATAORADB YSTEM01.DBF 50804 155025 0 0
C:ORACLEORADATAORADBTEMP01.DBF 887 894 0 0
C:ORACLEORADATAORADBTOOLS01.DBF 886 892 0 0
C:ORACLEORADATAORADBUSERS01.DBF 885 883 0 0
已選擇8行。
其中:ORADB為資料庫名,因為本例中資料庫使預設安裝,沒有進行過最佳化、調整,
所以,一直在system表空間上做操作,導致system表空間所在的資料檔案SYSTEM01.DBF被讀寫的次數最多,
這也說明了,儘量不要在system表空間做與系統無關的操作,應給各個使用者建立單獨的表空間。
44. 檢視哪些session正在使用哪些回滾段:
col 回滾段名 format a10
col SID format 9990
col 使用者名稱 format a10
col 操作程式 format a80
col status format a6 trunc
SELECT r.name 回滾段名,
s.sid,
s.serial#,
s.username 使用者名稱,
t.status,
t.cr_get,
t.phy_io,
t.used_ublk,
t.noundo,
substr(s.program, 1, 78) 操作程式
FROM sys.v_$session s,sys.v_$transaction t,sys.v_$rollname r
WHERE t.addr = s.taddr and t.xidusn = r.usn
ORDER BY t.cr_get,t.phy_io;
45.檢查誰Lock了什麼物件:
set line 200
col "O/S-User" format a10
col "Ora-User" format a10
col "Obj Locked" format a30
select /*+RULE*/s.machine, s.osuser "O/S-User", s.username "Ora-User", s.sid "Session-ID",
s.serial# "Serial", s.process "Process-ID", s.status "Status",l.name "Obj Locked",
l.mode_held "Lock Mode"
from v$session s,dba_dml_locks l,v$process p
where l.session_id = s.sid and p.addr = s.paddr
/
46.造成等待的LOCK的資訊,比如LOCK型別等:
col event format a30
set line 160
col machine format a10
col username format a15
select b.sid,b.serial#,b.username,machine,event,wait_time,chr(bitand(p1,-16777216)/16777215)||chr(bitand(p1, 16711680)/65535) "Enqueue Type" from v$session_wait a,v$session b
where event not like 'SQL*N%' and event not like 'rdbms%' and a.sid=b.sid
and b.sid>8 and event='enqueue'
order by username
/
47. List of the locked Oracle objects
set line 120
column object_name format a32
column OS_USER_NAME format a12
column orauser format a12
column sql_text format a32
column serial# format 999999
column sid format 99999
SELECT OS_USER_NAME, ORACLE_USERNAME AS orauser, s.sid, o.object_name,
o.object_type, s.serial#, a.sql_text
FROM v$locked_object l, dba_objects o, v$session s, v$sqlarea a
WHERE l.object_id = o.object_id
AND s.SQL_ADDRESS = a.address
AND l.SESSION_ID = s.sid;
SELECT 'ALTER SYSTEM KILL SESSION '''||TO_CHAR(s.sid)||','||TO_CHAR(s.serial#)||''';'
AS "Statement to kill"
FROM v$locked_object l, dba_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.SESSION_ID = s.sid;
oracle資料庫效能監控的SQL
1. 監控事例的等待
SQL>select event,sum(decode(wait_Time,0,0,1)) "Prev",sum(decode(wait_Time,0,1,0)) "Curr",count(*) "Tot" from v$session_Wait group by event order by 4;
2. 回滾段的爭用情況
SQL>select name, waits, gets, waits/gets "Ratio" from v$rollstat a, v$rollname b where a.usn = b.usn;
3. 監控表空間的 I/O 比例
SQL>select df.tablespace_name name,df.file_name "file",f.phyrds pyr,
f.phyblkrd pbr,f.phywrts pyw, f.phyblkwrt pbw from v$filestat f, dba_data_files df where f.file# = df.file_id
order by df.tablespace_name;
4. 監控檔案系統的 I/O 比例
SQL>select substr(a.file#,1,2) "#", substr(a.name,1,30) "Name",
a.status,a.bytes,b.phyrds,b.phywrts from v$datafile a, v$filestat b
where a.file# = b.file#;
5.在某個使用者下找所有的索引
SQL>select user_indexes.table_name, user_indexes.index_name,uniqueness, column_name from user_ind_columns, user_indexes where user_ind_columns.index_name = user_indexes.index_name
and user_ind_columns.table_name = user_indexes.table_name
order by user_indexes.table_type, user_indexes.table_name,
user_indexes.index_name, column_position;
6. 監控 SGA 的命中率
SQL>select a.value + b.value "logical_reads", c.value "phys_reads",
round(100 * ((a.value+b.value)-c.value) / (a.value+b.value)) "BUFFER HIT RATIO" from v$sysstat a, v$sysstat b, v$sysstat c where a.statistic# = 38 and b.statistic# = 39 and c.statistic# = 40;
7. 監控 SGA 中字典緩衝區的命中率
SQL>select parameter, gets,Getmisses , getmisses/(gets+getmisses)*100 "miss ratio",(1-(sum(getmisses)/ (sum(gets)+sum(getmisses))))*100 "Hit ratio" from v$rowcache where gets+getmisses <>0 group by parameter, gets, getmisses;
8. 監控 SGA 中共享快取區的命中率,應該小於1%
SQL>select sum(pins) "Total Pins", sum(reloads) "Total Reloads",
sum(reloads)/sum(pins) *100 libcache from v$librarycache;
SQL>select sum(pinhits-reloads)/sum(pins) "hit radio",sum(reloads)/sum(pins) "reload percent" from v$librarycache;
9. 顯示所有資料庫物件的類別和大小
SQL>select count(name) num_instances ,type ,sum(source_size) source_size,sum(parsed_size) parsed_size ,sum(code_size) code_size ,sum(error_size) error_size,sum(source_size) +sum(parsed_size) +sum(code_size) +sum(error_size) size_required from dba_object_size group by type order by 2;
10. 監控 SGA 中重做日誌快取區的命中率,應該小於1%
SQL>SELECT name, gets, misses, immediate_gets, immediate_misses,
Decode(gets,0,0,misses/gets*100) ratio1, Decode(immediate_gets+immediate_misses,0,0, immediate_misses/(immediate_gets+immediate_misses)*100) ratio2
FROM v$latch WHERE name IN ('redo allocation', 'redo copy');
11. 監控記憶體和硬碟的排序比率,最好使它小於 .10,增加 sort_area_size
SQL>SELECT name, value FROM v$sysstat WHERE name IN ('sorts (memory)', 'sorts (disk)');
12. 監控當前資料庫誰在執行什麼SQL語句
SQL>SELECT osuser, username, sql_text from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
13. 監控字典緩衝區
SQL>SELECT (SUM(PINS - RELOADS)) / SUM(PINS) "LIB CACHE" FROM V$LIBRARYCACHE;
SQL>SELECT (SUM(GETS - GETMISSES - USAGE - FIXED)) / SUM(GETS) "ROW CACHE" FROM V$ROWCACHE;
SQL>SELECT SUM(PINS) "EXECUTIONS", SUM(RELOADS) "CACHE MISSES WHILE EXECUTING" FROM V$LIBRARYCACHE;(後者除以前者,此比率小於1%,接近0%為好)
SQL>SELECT SUM(GETS) "DICTIONARY GETS",SUM(GETMISSES) "DICTIONARY CACHE GET MISSES" FROM V$ROWCACHE;
14. 查詢ORACLE字符集
SQL>select * from sys.props$ where name='NLS_CHARACTERSET';
15. 監控 MTS
SQL>select busy/(busy+idle) "shared servers busy" from v$dispatcher;
(此值大於0.5時,引數需加大)
SQL>select sum(wait)/sum(totalq) "dispatcher waits" from v$queue where type='dispatcher';
SQL>select count(*) from v$dispatcher;
SQL>select servers_highwater from v$mts;
(servers_highwater接近mts_max_servers時,引數需加大)
16. 碎片程度
SQL>select tablespace_name,count(tablespace_name) from dba_free_space group by tablespace_name having count(tablespace_name)>10;
SQL>alter tablespace name coalesce;
SQL>alter table name deallocate unused;
SQL>create or replace view ts_blocks_v as
select tablespace_name,block_id,bytes,blocks,'free space' segment_name from dba_free_space
union all
select tablespace_name,block_id,bytes,blocks,segment_name from dba_extents;
select * from ts_blocks_v;
SQL>select tablespace_name,sum(bytes),max(bytes),count(block_id) from dba_free_space group by tablespace_name;
檢視碎片程度高的表
SQL>SELECT segment_name table_name,COUNT(*) extents
FROM dba_segments WHERE owner NOT IN ('SYS', 'SYSTEM') GROUP BY
segment_name HAVING COUNT(*)=(SELECT MAX(COUNT(*)) FROM dba_segments GROUP BY segment_name);
17. 表、索引的儲存情況檢查
SQL>select segment_name,sum(bytes),count(*) ext_quan from dba_extents where tablespace_name='&tablespace_name' and segment_type='TABLE' group by tablespace_name,segment_name;
SQL>select segment_name,count(*) from dba_extents where segment_type='INDEX' and owner='&owner' group by segment_name;
18、找使用CPU多的使用者session
SQL>select a.sid,spid,status,substr(a.program,1,40) prog,a.terminal,osuser,value/60/100 value from v$session a,v$process b,v$sesstat c
where c.statistic#=12 and c.sid=a.sid and a.paddr=b.addr order by value desc;
(12是cpu used by this session)[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/503782/viewspace-983141/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DBA常用SQL語句SQL
- DBA常用SQL語句系列SQL
- sqlserver dba常用的sql語句SQLServer
- sql server中常用語句SQLServer
- postgresql dba常用sql查詢語句SQL
- SQL Server資料庫管理常用SQL和T-SQL語句SQLServer資料庫
- 常用SQL語句SQL
- sql常用語句SQL
- oracle常用SQL語句OracleSQL
- 常用的SQL語句SQL
- SQL常用語句整理SQL
- 常用的SQL 語句SQL
- MySql 常用Sql語句MySql
- 常用 SQL 語句大全SQL
- dba常用sql-2(轉)SQL
- Sql Server系列:Update語句SQLServer
- Sql Server系列:Delete語句SQLServerdelete
- SQL server 查詢語句SQLServer
- SQL Server SQL語句執行順序SQLServer
- 常用sql進階語句SQL
- SQL 常用語句一覽SQL
- 常用SQL語句彙總SQL
- DBA常用SQLSQL
- SQL Server 資料庫部分常用語句小結(二)SQLServer資料庫
- SQL Server 資料庫部分常用語句小結(一)SQLServer資料庫
- SQL Server優化之SQL語句優化SQLServer優化
- MySql與Sql Server Update語句MySqlServer
- SQL Server阻塞查詢語句SQLServer
- Sql Server系列:Insert語句SQLServer
- Sql Server Rollup 語句的用法SQLServer
- SQL SERVER 流程控制語句SQLServer
- 資料庫常用的sql語句大全--sql資料庫SQL
- mysql 常用sql語句 簡介MySql
- MySQL中常用的SQL語句MySql
- 資料庫常用sql 語句資料庫SQL
- MYSQL 常用sql語句小結MySql
- 常用SQL語句優化技巧SQL優化
- Oracle維護常用SQL語句OracleSQL