oracle 巡检常用命令

检查磁盘空间
df -h
CPU使用情况
top
内存使用情况
free -m
检查内存sar -r 2 3 
分析cpu命令mpstat -P ALL 1

系统I/O情况
iostat -k 1 3
系统负载情况
uptime
主机版本
cat /etc/system-release
cat /etc/redhat-release
oracle版本和补丁版本
sqlplus -version
opatch lspatches
磁盘使用情况
lsblk
fdisk -l
df -Th
检查Hosts文件和网络配置
cat /etc/hosts
id addr
nmcli connection show
检查系统参数文件
cat /etc/sysct1.conf
检查 rc.local 文件
cat /etc/rc.local 

检测实例
ps -ef|grep ora_.mon |grep -v grep
ps -ef|egrep "_pmon_|_smon_|_arc._|_dbw._|_lgwr_|_ckpt_" |egrep -v egrep

检测监听
netstat -pn -l -t|grep 1521|grep -v grep
ps -ef|grep tnslsnr|grep -v grep
检测Alert日志

sed -n "/`date -d "-3 day" +"%a %b %e"`/,$"p ${ORACLE_BASE}/admin/${ORACLE_SID}/bdump/alert_${ORACLE_SID}.log |grep ORA- -B 2 -A 5

等待事件

select event, sum(seconds_in_wait) "wait time(s)",count(sid) "count" from v$session_wait group by event; 


查看数据库实例和监听
ps -ef|grep smon
su - oracle
Lsnrctl status

检查控制文件冗余
show parameter control_files;
select name from v$controlfile;

归档和闪回是否开启
select open_mod,log_mode,flashback_on,force_logging from v$database;

检查表空间使用情况
select f.tablespace_name,a.total,f.free,round((f.free / a.total) * 100) "% Free"
from (select tablespace_name, sum(bytes / (1024 * 1024)) total
from dba_data_files
group by tablespace_name) a, (select tablespace_name, round(sum(bytes / (1024 * 1024))) free
from dba_free_space group by tablespace_name) f
WHERE a.tablespace_name = f.tablespace_name(+)order by "% Free";
检查一些扩展异常的对象
select Segment_Name,Segment_Type,TableSpace_Name, (Extents / Max_extents) * 100 Percent
From sys.DBA_Segments Where Max_Extents != 0 and (Extents / Max_extents) * 100 >= 95 order By Percent;
检查对象的下一扩展与表空间的最大扩展值
select a.table_name, a.next_extent, a.tablespace_name
from all_tables a, 
(select tablespace_name, max(bytes) as big_chunk 
from dba_free_space 
group by tablespace_name) f
where f.tablespace_name = a.tablespace_name 
and a.next_extent > f.big_chunk
union
select a.index_name, a.next_extent, a.tablespace_name
from all_indexes a, 
(select tablespace_name, max(bytes) as big_chunk 
from dba_free_space 
group by tablespace_name) f
where f.tablespace_name = a.tablespace_name 
and a.next_extent > f.big_chunk;
检查日志缓冲区
select name,value from v$sysstat where name in ('redo entries','redo buffer allocation retries');
检查系统安全日志信息
# grep -i accepted /var/log/secure
检查在线日志状态

SQL> select group#,status,type,member from v$logfile;
检查无效对象

sql>select owner,object_name,object_type from dba_objects where status!='VALID' and owner!='SYS' and owner!='SYSTEM';
检查所有回滚段状态

SQL> select segment_name,status from dba_rollback_segs; 
闪回使用情况

select flashback_on from v$database;

查询视图v$recovery_file_dest视图来了解其位置和最大的大小

select * from v$recovery_file_dest;

使用v$flash_recovery_area_usage确定闪回恢复区中的文件使用明细

select * from v$flash_recovery_area_usage;

检查Oracle所有数据文件状态
select name,status from v$datafile;
select file_name,status from dba_data_files;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值