以下是自己使查询过的oracle库的一些情况,做下记录:
查询oracle库的查询sql的数量(即每执行一天sql就insert进入): select t.*, t.executions from v$sqlarea t
oracle响应的性能(这个我不是太懂,可能是错的):select metric_name,value from v$sysmetric where metric_name in ('Database CPU Ratio','Database Wait Time Ratio') and intsize_csec =(select max(intsize_csec) from v$sysmetric)
oracle字符集编码: select userenv('language') from dual
查看oracle可用的字符集参数设置: SELECT * FROM v$nls_valid_values ORDER BY parameter,VALUE;
数据库服务器字符集: select * from nls_database_parameters
客户端字符集环境:select * from nls_instance_parameters
oracle tablespace的剩余空间:
select a.TABLESPACE_NAME,
a.BYTES bytes_used,
b.BYTES bytes_free,
b.largest,
round(((a.BYTES - b.BYTES) / a.BYTES) * 100, 2) percent_used
from (select TABLESPACE_NAME, sum(BYTES) BYTES
from dba_data_files
group by TABLESPACE_NAME) a,
(select TABLESPACE_NAME, sum(BYTES) BYTES, max(BYTES) largest
from dba_free_space
group by TABLESPACE_NAME) b
where a.TABLESPACE_NAME = b.TABLESPACE_NAME
order by ((a.BYTES - b.BYTES) / a.BYTES) desc
查看所有表空间大小: select tablespace_name, sum(bytes) / 1024 / 1024
from dba_data_files
group by tablespace_name;
已经空闲的表空间大小:select tablespace_name, sum(bytes) / 1024 / 1024
from dba_free_space
group by tablespace_name;
oracle允许最大连接数:select value from v$parameter where name = 'processes'
oracle当前连接数:select count(*) from v$process
oracle数据库版本:select * from v$version
oracle所有用户:select * from user_tables
oracle用户的权限:select * from user_role_privs