Total Pageviews

Tuesday, 24 February 2015

Health Check of asm

Creating a HTML file to view details of ASM
=================================
Create .sh file and run it through cron or run manually.

healthcheck.sh
==========
spool asm_health_check.html
SET MARKUP HTML ON
set echo on
set pagesize 1000
set linesize 250
set feedback off
col bytes format 999,999,999,999
col space format 999,999,999,999
col gn format 999
col name format a20
col au format 99999999
col state format a12
col type format a12
col total_mb format 999,999,999
col free_mb format 999,999,999
col od format 999
col compatibility format a12
col dn format 999
col mount_status format a12
col header_status format a12
col mode_status format a12
col mode format a12
col failgroup format a20
col label format a12
col path format a45
col path1 format a40
col path2 format a40
col path3 format a40
col bytes_read format 999,999,999,999,999
col bytes_written format 999,999,999,999,999
col cold_bytes_read format 999,999,999,999,999
col cold_bytes_written format 999,999,999,999,999
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS' ;
select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS' ) current_time from dual;
select group_number gn, name, allocation_unit_size au, state, type, total_mb, free_mb, offline_disks od, compatibility
from v$asm_diskgroup;
select group_number gn,disk_number dn, mount_status, header_status,mode_status,state, total_mb, free_mb,name, failgroup, label, path,create_date, mount_date
from v$asm_disk order by group_number, disk_number;
break on g_n skip 1
break on failgroup skip 1
compute sum of t_mb f_mb on failgroup
compute count of failgroup on failgroup
select g.group_number g_n,g.disk_number d_n,g.name , g.path , g.total_mb t_mb,g.free_mb f_mb,g.failgroup from v$asm_disk g order by g_n, failgroup, d_n;

select 'THIS ASM REPORT WAS GENERATED AT: ==)> ' , sysdate " " from dual;

select 'HOSTNAME ASSOCIATED WITH THIS ASM INSTANCE: ==)> ' , MACHINE " " from v$session where program like '%SMON%';
select * from v$asm_diskgroup;
SELECT * FROM V$ASM_DISK ORDER BY GROUP_NUMBER,DISK_NUMBER;
SELECT * FROM V$ASM_CLIENT;
select * from V$ASM_ATTRIBUTE;
select * from v$asm_operation;
select * from v$version;
show parameter
show sga

spool off
exit;

========================================================================check the status of individual nodes and all the necessary applications,VIP, GSD, Listener and the ONS daemons are alive.
========================================================================
[root@obia bin]# ./srvctl status nodeapps -n obia
VIP obia-vip.oracle.com is enabled
VIP obia-vip.oracle.com is running on node: obia
Network is enabled
Network is running on node: obia
ONS is enabled
ONS daemon is running on node: obia

[root@obia bin]# ./srvctl status nodeapps -n obie
VIP obie-vip.oracle.com is enabled
VIP obie-vip.oracle.com is running on node: obie
Network is enabled
Network is running on node: obie
ONS is enabled
ONS daemon is running on node: obie

SQL> select instance_name, host_name, archiver, thread#, status from gv$instance;
INSTANCE_NAME    HOST_NAME                                                        ARCHIVE    THREAD# STATUS
---------------- ---------------------------------------------------------------- ------- ---------- ------------
PROD2            obie.oracle.com                                                  STOPPED          2 OPEN
PROD1            obia.oracle.com                                                  STOPPED          1 OPEN

Getting the status of all the groups, type, membership (if any)...
==================================================================

SQL> select group#, type, member, is_recovery_dest_file from v$logfile order by group#;

    GROUP# TYPE    MEMBER                                                                                                                          
         1 ONLINE  +DATA/PROD/ONLINELOG/group_1.259.861032749                                                                                                                        YES
         1 ONLINE  +DATA/PROD/ONLINELOG/group_1.262.861032747                                                                                                                        NO
         2 ONLINE  +DATA/PROD/ONLINELOG/group_2.257.861032753                                                                                                                        YES
         2 ONLINE  +DATA/PROD/ONLINELOG/group_2.260.861032751                                                                                                                        NO
         3 ONLINE  +DATA/PROD/ONLINELOG/group_3.269.861032927                                                                                                                        NO
         3 ONLINE  +DATA/PROD/ONLINELOG/group_3.270.861032929                                                                                                                        YES
         4 ONLINE  +DATA/PROD/ONLINELOG/group_4.271.861032931                                                                                                                        NO
         4 ONLINE  +DATA/PROD/ONLINELOG/group_4.272.861032931                                                                                                                        YES

8 rows selected.

Querying the v$asm_diskgroup view...
====================================
SQL> select group_number, name,allocation_unit_size alloc_unit_size,state,type,total_mb,usable_file_mb from v$asm_diskgroup;

GROUP_NUMBER NAME                           ALLOC_UNIT_SIZE STATE       TYPE     TOTAL_MB USABLE_FILE_MB
------------ ------------------------------ --------------- ----------- ------ ---------- --------------
           2 ASMDATA                                1048576 MOUNTED     EXTERN       5023           4726
           1 ARCHIVE                                1048576 MOUNTED     EXTERN       3998           3895
           3 DATA                                   1048576 CONNECTED   EXTERN     185759         183440
All datafiles information
==================

SQL> select name from v$datafile union select name from v$controlfile union select name from v$tempfile union select member from v$logfile;


To check if CRS is up
================

$./crsctl check crs

To check the status of all services on the cluster
==================================-
$./crs_stat -t -v




No comments :

Post a Comment