oracle 精简查询命令集
crs_stat -t //检查集群进程状态
$ lsnrctl status //检查监听状态
sqlplus / as sysdba //登录sqlplus
select instance_name,host_name,startup_time,status,database_status from v$instance; //查询实例状态
select a.tablespace_name, a.bytes/1024/1024 "sum mb"
,(a.bytes-b.bytes)/1024/1024 "used mb", b.bytes/1024/1024 "free mb",
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 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 FILE_NAME,TABLESPACE_NAME,AUTOEXTENSIBLE FROM dba_data_files; //查询表空间数据文件自动增长状态
select inst_id,count(*) from gv$session group by inst_id; //或者 select count(*) from v$session; //查询连接数
select status, name from v$controlfile; //查询控制文件状态
archive log list // 查询归档日志状态
show parameter recover // 查询recover目录位置
select SECTOR_SIZE, BLOCK_SIZE, TOTAL_MB, FREE_MB, USABLE_FILE_MB, name from v$asm_diskgroup; //查询asm磁盘组 使用情况
select sum(pinhits)/sum(pins)*100 from v$librarycache; // 查询共享池命中率
select sid,event,p1,p2,p3,WAIT_TIME,SECONDS_IN_WAIT from v$session_wait
where event not like 'SQL%' and event not like 'rdbms%'; // 查询等待时长
select segment_name,status from dba_rollback_segs; // 查询回滚段
//主机层面的命令
# ps -ef |grep pmon // 查看后台进程
$ env |grep ORACLE // 查看oracle 设备
df -h // 查看服务器空间
df -i // 查看服务器索引使用情况
df -a
top // 查看机器内存cpu使用情况
iostat -k 1 3 // 查看设备io
@awrrpt.sql // 取awr报告

浙公网安备 33010602011771号