查看oracle狀態的SQL語句 select status from v$instance; 查看oracle控制文件的SQL語句 select name from v$controlfile; 查看oracle數據文件的SQL語句 select name from v$datafile; 查看o
查看oracle狀態的SQL語句
select status from v$instance;
查看oracle控制文件的SQL語句
select name from v$controlfile;
查看oracle數據文件的SQL語句
select name from v$datafile;
查看oracle聯機日誌文件
select * from v$logfile;
查看表空間使用情況
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;
查看表空間對應的數據文件
select file_name,tablespace_name from dba_data_files
where tablespace_name='SYSTEM';
添加表空間文件
alter tablespace USERS add datafile 'D:\orcle\product\10.2.0\oradata\orcl\USERS02.DBF' size 10M autoextend on maxsize 20G;
調整數據文件的大小,(不建議這麼搞)
alter database datafile 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF' resize 7600M;
數據緩衝區的使用命中率
數據緩衝區的使用命中率=1 - ( physical reads / (db block gets + consistent gets) )。
select round( 1 -((SELECT value FROM v$sysstat WHERE name='physical reads')/
((SELECT value FROM v$sysstat WHERE name='consistent gets')+
(SELECT value FROM v$sysstat WHERE name='db block gets'))
),2)*100||'%' from dual;
用以下語句可以查看數據緩衝區的命中率:
SELECT name, value FROM v$sysstat WHERE name IN ('db block gets', 'consistent gets','physical reads');
查詢出來的結果Buffer Cache的命中率應該在90%以上,否則需要增加數據緩衝區的大小。
查詢表空間是否是自動擴展:
select tablespace_name,file_name,autoextensible from dba_data_files where tablespace_name = 'SYSTEM';