dba常用sql-1(轉)
表空間空餘,迅速收縮臨時段,檢視索引定義,檢視裸裝置IO,檢視錶的物理大小等DBA常用sql。
[@more@]()
//表空間空餘察看
select segment_name,bytes from dba_segments where bytes>100000000 and tablespace_name='TS_LIST07';
select bytes from dba_free_space where tablespace_name='TS_LIST07' order by bytes;
SELECT TABLESPACE_NAME,MAX(BYTES) FROM DBA_FREE_SPACE GROUP BY TABLESPACE_NAME ORDER BY MAX(BYTES);
select tablespace_name,sum(bytes),sum(free),sum(free)*100/sum(bytes) from (select
b.file_id file_ID,
b.tablespace_name tablespace_name,
b.bytes Bytes,
(b.bytes-sum(nvl(a.bytes,0))) used,
sum(nvl(a.bytes,0)) free,
sum(nvl(a.bytes,0))/(b.bytes)*100 Percent
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes
order by b.file_id) group by tablespace_name order by sum(free)*100/sum(bytes);
//迅速收縮臨時段
alter tablespace temp default storage(pctincrease 1);
alter tablespace temp default storage(pctincrease 0);
//檢視索引定義
select INDEX_NAME,TABLE_NAME,COLUMN_NAME from dba_ind_columns where TABLE_OWNER='IUTBS' order by TABLE_NAME;
//刪除重單
delete from device_state_710 a
where rowidwhere ACCESS_NUMBER=a.ACCESS_NUMBER and SERVICE_TYPE=a.SERVICE_TYPE and STATENO=a.STATENO
and BEFORE_STATENO=a.BEFORE_STATENO and FROM_NO=a.FROM_NO and BEFORM_NO=a.BEFORM_NO
and SEND_DATE=a.SEND_DATE and RUN_DATE=a.RUN_DATE);
//檢視裸裝置IO
select
substr(DF.NAME,1,5) Drive,
DF.NAME file_name,
(fs.phyblkrd+fs.phyblkwrt)
from v$filestat fs,v$datafile df
where df.file#=fs.file#;
//檢視錶的物理大小
select * from DBA_SEGMENTS WHERE OWNER='iutbs';
select SEGMENT_NAME,BYTES from dba_segments where segment_type='TABLE' and owner='IUTBS' ;
select * from dba_segments where segment_type='INDEX' and owner='IUTBS' ;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9417382/viewspace-932228/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dba常用sql-2(轉)SQL
- dba常用sql-3(轉)SQL
- Oracle DBA常用命令 [ 轉載]Oracle
- 經典SQL-1SQL
- oracle DBA 常用監控指令碼1(轉)Oracle指令碼
- DBA常用SQLSQL
- dba常用指令碼指令碼
- GreenPlum DBA常用SQLSQL
- DBA常用的一些SQL和檢視(轉)SQL
- ORACLE DBA常用SQL指令碼工具->管理篇(1) (轉)OracleSQL指令碼
- Oracle dba 常用檢視Oracle
- Oracle DBA常用查詢Oracle
- dba 常用維護sqlSQL
- DBA常用SQL語句SQL
- Oracle DBA常用sql分享OracleSQL
- Oracle資料庫DBA日常Sql列表及常用檢視(轉)Oracle資料庫SQL
- DBA常用的linux命令Linux
- DBA 常用的10個SQLSQL
- DBA常用SQL語句系列SQL
- 8個DBA最常用的監控Oracle資料庫的常用shell指令碼--轉Oracle資料庫指令碼
- mongodb dba常用的nosql語句MongoDBSQL
- sqlserver dba常用的sql語句SQLServer
- MySQL DBA 常用手冊小結MySql
- 【UNIX】DBA常用的linux命令Linux
- Oracle DBA常用監控指令碼Oracle指令碼
- Oracle EBS DBA 常用命令Oracle
- MySQL DBA 管理常用命令MySql
- MySQL DBA常用手冊小結MySql
- 從DBA到Oracle Applications DBA的轉變過程 (轉)OracleAPP
- MongoDB DBA常用的NoSQL語句(全)MongoDBSQL
- postgresql dba常用sql查詢語句SQL
- mysql dba常用的查詢語句MySql
- ORACLE DBA常用語句和指令碼Oracle指令碼
- DBA常用SQL語句[sql server] 2SQLServer
- DBA筆試題(轉)筆試
- DBA常用系統監控命令(之一)
- DBA常用的資料字典檢視(一)
- DBA的性格(轉自老白的dba優化手記)優化