国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

dba 常用查詢

2019-11-09 13:33:57
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

1.查看表空間

select A.tablespace_name as "TABLESPACE NAME",A.total_size AS "TOTAL SIZE", round(B.total_free_size,1) AS "TOTAL FREE SIZE",round((A.total_size-B.total_free_size),2) AS "USED SIZE",to_char(100*B.total_free_size/A.total_size,'99.99')||'%' AS "PERCENT FREE" FROM (SELECT tablespace_name,sum(bytes)/1024/1024 AS total_size from dba_data_files GROUP BY tablespace_name) A,(select tablespace_name,sum(bytes/1024/1024) AS total_free_size from dba_free_space GROUP BY tablespace_name) B where A.tablespace_name=B.tablespace_name;2.檢查chained

1)create table TEST.CHAINED_ROWS(owner_name          varchar2(30),table_name     varchar2(30),cluster_name   varchar2(30),partition_name varchar2(30),subpartition_name varchar2(30),head_rowid rowid,analyze_timestamp date);2)select 'analyze table '||owner||'.'||table_name||' list chained rows into test.chained_rows;' from dba_tables where owner='TEST';3)analyze table TEST.WORLD list chained rows into test.chained_rows;SELECT B.owner_name AS "OWNER",A.table_name AS "TABLE NAME",B.row_count AS "ROW COUNT",A.num_rows AS "TOTAL ROWS"FROM ALL_tables A,    (SELECT B.owner_name,B.table_name,COUNT(B.head_rowid) ROW_COUNTFROM chained_rows B GROUP BY B.owner_name,B.table_name) B WHERE A.table_name=B.table_name;3.檢查表空間碎片

SELECT tablespace_name AS "TABLESPACE NAME",sqrt(MAX(blocks)/SUM(blocks))*(100/sqrt((COUNT(blocks)))) AS "FSFI%" FROM dba_free_space GROUP BY tablespace_name ORDER BY 1;FSFI:可用破碎表空間索引(Free Space Fragmentation Indx,FSFI)數(shù)值最大值為100,表示完全沒(méi)有破碎的空間,數(shù)值越低代表空間碎片越嚴(yán)重,通常低于30%就需要進(jìn)行重整操作4.檢查索引

SELECT index_name,index_type,table_name,status from dba_indexes where status='UNSABLE';5.檢查新增失效對(duì)象

select owner OBJECT_OWNER,object_name,object_type,status from dba_objects where owner NOT IN('SYS','SYSTEM') AND status='INVALID' ORDER BY owner,object_type,object_name;6.每月表空間增長(zhǎng)

SELECT A.ts# AS "TABLESPACE NO",B.name AS "TABLESPACE NAME",to_char(A.creation_time,'RRRR Month') "Month",SUM(A.bytes)/1024/1024/1024 "Growth in GB" FROM sys.v_$datafile A,sys.v_$tablespace B where A.creation_time>SYSDATE-365 AND A.ts#=B.ts# GROUP BY A.ts#,B.name,to_char(A.creation_time,'RRRR Month');7.每月數(shù)據(jù)庫(kù)增長(zhǎng)

SELECT to_char(creation_time,'RRRR Month') "Month",SUM(bytes)/1024/1024/1024 "Growth in GB" FROM sys.v_$datafile WHERE creation_time>SYSDATE-365 GROUP BY to_char(creation_time,'RRRR Month');


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 灵宝市| 项城市| 汝阳县| 来宾市| 淮北市| 永宁县| 榆林市| 尉氏县| 云阳县| 霍州市| 贡嘎县| 连平县| 湄潭县| 吴桥县| 舒城县| 建昌县| 两当县| 蕲春县| 高碑店市| 和田市| 鄂托克旗| 尼勒克县| 鹤壁市| 富民县| 香港| 西丰县| 改则县| 裕民县| 八宿县| 乳山市| 临安市| 乌兰察布市| 福鼎市| 宽城| 淄博市| 区。| 区。| 南昌县| 长丰县| 长兴县| 新余市|