1. RAC resource and structure inspection
cluster related information
cluster name
[grid@rac01 ~]$ olsnodes -n
或
[grid@rac01 ~]$ cemutlo -n
cluster resource status
[grid@rac01 ~]$ crsctl stat res -t
Cluster resources and background DAEMON
[grid@rac01 ~]$ crsctl stat res -t -init
Check nodeapps
--注:GSD在9i之后不启动
[grid@rac01 ~]$ srvctl status nodeapps
Check SCAN-IP and SCAN monitor
Check scan configuration
[grid@rac01 ~]$ srvctl config scan
Check the status of SCAN-IP
[grid@rac01 ~]$ srvctl status scan
Check SCAN monitor
[grid@rac01 ~]$ srvctl status scan_listener
Check the VIP status of each node
[grid@rac01 ~]$ srvctl status nodeapps
或
srvctl status vip -n 节点名称
Check local monitoring configuration and status
[grid@rac01 ~]$ srvctl config listener -a
[grid@rac01 ~]$ srvctl status listener
Check ASM instance and disk group
[grid@rac01 ~]$ srvctl status asm -a
[grid@rac01 ~]$ crsctl query css votedisk
cluster related services
Check the disk group
Pay attention to the resource name, first use crsctl stat res -t to query the resource
srvctl status diskgroup -g FRADATA
[grid@rac01 ~]$ crsctl query css votedisk
ocr backup information
[grid@rac01 ~]$ ocrconfig -showbackup
cluster related services
[grid@rac01 ~]$ crsctl check crs
olr backup information
an examination
[grid@rac01 ~]$ ocrcheck
2. Database inspection
Query table space and data file
set linesize 150
col FILE_ID format 999
col FILE_NAME format a50
col TABLESPACE_NAME format a15
select file_id,file_name,tablespace_name from dba_data_files order by 1;
Query table space usage
set linesize 150
column file_name format a65
column tablespace_name format a20
select f.tablespace_name tablespace_name,round((d.sumbytes/1024/1024/1024),2) total_g,
round(f.sumbytes/1024/1024/1024,2) free_g,
round((d.sumbytes-f.sumbytes)/1024/1024/1024,2) used_g,
round((d.sumbytes-f.sumbytes)*100/d.sumbytes,2) used_percent
from (select tablespace_name,sum(bytes) sumbytes from dba_free_space group by tablespace_name) f,
(select tablespace_name,sum(bytes) sumbytes from dba_data_files group by tablespace_name) d
where f.tablespace_name= d.tablespace_name
order by d.tablespace_name;
Temporary table space and temporary files
set linesize 180;
col TABLESPACE_NAME format a15;
col FILE_ID format 999;
col FILE_NAME format a45;
SELECT TABLESPACE_NAME, FILE_ID, FILE_NAME, BYTES/1024/1024 AS "SPACE(M)" FROM DBA_TEMP_FILES order by 2;
set linesize 200
column file_name format a55
column tablespace_name format a20
select a.tablespace_name,a.file_name,round(a.bytes/(1024*1024*1024),2) total_g,
round(sum(nvl(b.bytes,0))/(1024*1024*1024),2) free_g,
round((a.bytes/(1024*1024*1024) - sum(nvl(b.bytes,0))/(1024*1024*1024)),2) used_g,
round(((a.bytes/(1024*1024*1024) - sum(nvl(b.bytes,0))/(1024*1024*1024)))/a.bytes/(1024*1024*1024),2) free_g
from dba_temp_files a,dba_free_space b
where a.file_id = b.file_id(+)
group by a.tablespace_name,a.file_name,a.bytes
order by a.tablespace_name;
Add temporary files
alter tablespace TEMP add tempfile size 29 M AUTOEXTEND ON NEXT 640K MAXSIZE 32767M;
Log group
Basic information of the log group
set linesize 180
col GROUP# format 999
col THREAD# format 999
col SEQUENCE# format 99999
col BLOCKSIZE format 999
col MEMBERS format 999
select * from V$log order by GROUP#;
To add a log group, execute the following command to add a log group to the database HDAPP:
alter database add logfile thread 1 group 9 size 512M;
--或者:
alter database add logfile thread 1 group 9 ('+DATA/hdapp/redo09a.log','+BACKUP/hdapp/onlinelog/redo09b.log') size 500M;
Log
file Basic information of the log file
set linesize 150
col MEMBER format a70
select * from v$logfile where type<>'STANDBY' order by 1;
Add log file for database HDAPP
Execute the following command to add log file for database HDAPP:
alter database add logfile member ('+BACKUP/hdapp/onlinelog/redo09b.log') to group 9;
Delete log file
alter database drop logfile member '+FRADATA/orcl/onlinelog/group_5.297.1016707657';
Basic information of STANDBY log file
set linesize 150
col MEMBER format a70
select * from v$logfile where type='STANDBY' order by 1;
Check the amount of archive logs generated per hour on the day (single instance)
alter session set nls_date_format='yyyy.mm.dd hh24:mi:ss';
col mbsize format 999,999,999
select logtime,
count(*),
round(sum(blocks * block_size)/1024/1024) mbsize
from (select trunc(first_time, 'hh') as logtime, a.BLOCKS, a.BLOCK_SIZE
from v$archived_log a
where a.DEST_ID = 1
and a.FIRST_TIME > trunc(sysdate))
group by logtime
order by logtime desc;
Check the daily archive log generation volume in the last week (single instance)
select logtime,
count(*),
round(sum(blocks * block_size)/1024/1024) mbsize
from (select trunc(first_time, 'dd') as logtime, a.BLOCKS, a.BLOCK_SIZE
from v$archived_log a
where a.DEST_ID = 1
and a.FIRST_TIME > trunc(sysdate - 7))
group by logtime
order by logtime desc;
alter session set nls_date_format='yyyy.mm.dd hh24:mi:ss';
col mbsize format 999,999,999
select THREAD#,
logtime,
count(*),
round(sum(blocks * block_size)/1024/1024) mbsize
from (select a.THREAD#,
trunc(first_time, 'hh') as logtime,
a.BLOCKS,
a.BLOCK_SIZE
from v$archived_log a
where a.DEST_ID = 1
and a.FIRST_TIME > trunc(sysdate-0))
group by THREAD#, logtime
order by THREAD#, logtime desc;
Check the archive log generation volume of each instance every day in the last week
alter session set nls_date_format='yyyy.mm.dd hh24:mi:ss';
col mbsize format 999,999,999
select THREAD#,
logtime,
count(*),
round(sum(blocks * block_size)/1024/1024) mbsize
from (select THREAD#,
trunc(first_time, 'dd') as logtime,
a.BLOCKS,
a.BLOCK_SIZE
from v$archived_log a
where a.DEST_ID = 1
and a.FIRST_TIME > trunc(sysdate - 7))
group by THREAD#, logtime
order by THREAD#, logtime desc;