bay——巡检RAC命令_版本.txt

 

df -lh
hostname
cat /etc/hosts
ifconfig
ps -ef | grep tns
ps -ef | grep asm
ps -ef | grep ora_

ls -l /dev/sd*
ls -l /dev/asm*
lsblk

env | grep ORA
find / -name alert*.log
ls -lh /oracle/grid/diag/tnslsnr/rac2/listener/trace/listener.log
ls -lh /oracle/asm/log/diag/tnslsnr/rac2/listener_scan1/trace/listener_scan1.log
ls -lh /oracle/asm/crf/db/rac2/crfclust.bdb

查看ALERT 日志
[root@rac2 ~]# find / -name alert*.log

查看CRS日志

#find / -name crsd.log

export ORACLE_SID=+ASM1
sqlplus / as sysasm

select * from gv$instance;
select instance_name,status from v$instance;
select name,state from v$asm_diskgroup;
select name,state,type,total_mb ,free_mb from v$asm_diskgroup;

col PATH for a40
set pagesize 400
select name,path from v$asm_disk_stat;

col PATH for a15;
col name for a10;
col STATE for a10;
set linesize 455
set pagesize 455
select group_number,path,state,total_mb,free_mb from v$asm_disk;


alter diskgroup DATA add disk '/dev/asm-diskl' rebalance power 5;

 


lsnrctl status LISTENER
crs_stat -t
crsctl status res -t
crsctl check crs
crsctl check evmd
crsctl check crsd
crsctl check crsd
crsctl check cssd
crsctl query css votedisk
srvctl config database
srvctl status database -d baydb
srvctl config database -d baydb -a
ocrcheck
ocrconfig -showbackup
srvctl status nodeapps
lsnrctl status LISTENER
asmcmd lsdg
asmcmd lsdsk
srvctl status asm -a
srvctl config asm -a

/usr/sbin/oracleasm querydisk /dev/sd*
查看磁盘
[root@rac2 bai]# oracleasm listdisks
扫描磁盘
[root@rac2 bai]# oracleasm scandisks
查看对应关系
[root@rac1 dev]# oracleasm querydisk -v -p VOL1


su - oracle
env | grep ORA
crontab -l
sqlplus / as sysdba


show parameter sga;
show parameter size;
show parameter db;
show parameter session;
select count(1) from V$SESSION;
show parameter process;
select count(1) from V$PROCESS;
show parameter remote;
show parameter thread;
select userenv('language') from dual;
select status,name from v$controlfile;
select group#,status,type,member from v$logfile;
select tablespace_name,status from dba_tablespaces;
select name,status from v$datafile;
select segment_name,status from dba_rollback_segs;
select database_role,switchover_status from v$database;


col comp_id for a15;
col version for a15 ;
col comp_name for a30 ;
select comp_id,comp_name,status,version from dba_registry ;


archive log list;

SELECT A.NAME,A.OPEN_MODE,A.DATABASE_ROLE,A.LOG_MODE FROM v$database A;
SELECT owner, object_type, status, COUNT(*) count# FROM all_objects GROUP BY owner,object_type, status;

show parameter cluster

select * from gv$instance;
select instance_name,status from v$instance;
SELECT A.INSTANCE_NAME,A.STATUS,A.VERSION FROM V$INSTANCE A;
select instance_name,host_name,status from gv$instance;
SELECT a.NAME,a.DATABASE_ROLE,a.OPEN_MODE,a.LOG_MODE FROM V$DATABASE a;


查看实例下表空间使用情况:

set pagesize 999
set linesize 999
col file_name for a50;
col TABLESPACE_NAME for a20;
SELECT a.tablespace_name "tablespace_name",
100-ROUND((NVL(b.bytes_free,0)/a.bytes_alloc)*100,2) "percent(%)",
ROUND(a.bytes_alloc/1024/1024,2) "free(M)",
ROUND((a.bytes_alloc-NVL(b.bytes_free,0))/1024/1024,2) "use(M)",
TO_CHAR(SYSDATE,'yyyy-mm-dd hh24:mi:ss') "time"
FROM (SELECT f.tablespace_name,
SUM(f.bytes) bytes_alloc,
SUM(DECODE(f.autoextensible,'YES',f.maxbytes,'NO',f.bytes)) maxbytes
FROM dba_data_files f GROUP BY tablespace_name) a,
(SELECT f.tablespace_name, SUM(f.bytes) bytes_free
FROM dba_free_space f GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY 1 ASC ;

查看数据文件使用情况:

set linesize 400
set pagesize 350
col TABLESPACE_NAME for a20;
col FILE_NAME for a50;
col size for a15;
SELECT D.TABLESPACE_NAME,
D.FILE_NAME,
D.AUTOEXTENSIBLE,
D.BYTES / 1024 / 1024,
(D.INCREMENT_BY*8)/1024 INCREMENT_M,
D.ONLINE_STATUS
FROM DBA_DATA_FILES D
ORDER BY D.TABLESPACE_NAME DESC, D.FILE_NAME ASC ;

 

 


数据库缓存命中率(单位:百分比)

select * from (select round((1 - (sum(decode(name, 'physical reads', value, 0)) / (sum(decode(name, 'db clock gets', value, 0)) + (sum(decode(name, 'consistent gets', value, 0)))))) * 100,2) as buffer from v$sysstat), (select round(sum(pinhits) / sum(pins) * 100, 2) as library from v$librarycache);

Latch争用总等待次数(单位:次数) 新增-数据参数

select total_waits from v$system_event where event = 'latch free'

Latch争用总等待时间(单位:百分之一秒) 新增-数据参数

select time_waited from v$system_event where event = 'latch free'

数据库中对象正在被锁的总数(单位:值) 新增-数据参数

select count(1) from v$locked_object

内存使用量 新增-数据参数

SELECT (SELECT ROUND(SUM(VALUE)/1024/1024,2) FROM V$SGA)+(SELECT ROUND(VALUE/1024/1024,2) FROM V$PGASTAT WHERE NAME='total PGA allocated') FROM DUAL;

 

posted @ 2019-07-02 13:42  上帝_BayaiM  阅读(217)  评论(0编辑  收藏  举报