Visit Our UNIX and Linux User Community


script for RAC information required


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for RAC information required
# 1  
Old 06-09-2011
script for RAC information required

Hello,

is it possible for someone to generate a shell script that will do the following, please. UNIX Shell script novice who is after a script to look at a few things within an Oracle RAC environment

Hopefully if this works, I can schedule this via cron

Many thanks

I can execute these commands individually and they all work, but how do I combine bash commands with SQL commands?

here is the code, I'd like in 1 huge script I can schedule on a daily basis and then mail me a report

thankyou


==========================================================


Code:
select group_number, file_number, compound_index, incarnation, block_size, bytes/1024/1024/1024 GB, type, striped,
creation_date, modification_date from v$asm_file where TYPE != 'ARCHIVELOG';

select group_number, file_number, bytes/1024/1024/1024 GB, type, striped, modification_date
from v$asm_file where TYPE != 'ARCHIVELOG';

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

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

set numwidth 10
column event format a25 tru
select inst_id, event, time_waited, total_waits, total_timeouts
from (select inst_id, event, time_waited, total_waits, total_timeouts
from gv$system_event where event not in ('rdbms ipc message','smon timer',
'pmon timer', 'SQL*Net message from client','lock manager wait for remote message',
'ges remote message', 'gcs remote message', 'gcs for action', 'client message', 
'pipe get', 'null event', 'PX Idle Wait', 'single-task message', 
'PX Deq: Execution Msg', 'KXFQ: kxfqdeq - normal deqeue', 
'listen endpoint status','slave wait','wakeup time manager')
order by time_waited desc)
where rownum < 11
order by time_waited desc;


cd /u01/app/11.2.0/grid/bin
./crs_stat -t

cd /u01/app/11.2.0/grid/bin
./crsctl check crs

srvctl status asm -n ukedxdtmtdbs01a
srvctl status asm -n ukedxdtmtdbs01b


Last edited by radoulov; 06-09-2011 at 01:52 PM.. Reason: Code tags!
# 2  
Old 06-09-2011
I`m not DBA but will this be helpful

test.sql
Code:
connect myuser/mypass
select group_number, file_number, compound_index, incarnation, block_size, bytes/1024/1024/1024 GB, type, striped,
creation_date, modification_date from v$asm_file where TYPE != 'ARCHIVELOG';

select group_number, file_number, bytes/1024/1024/1024 GB, type, striped, modification_date
from v$asm_file where TYPE != 'ARCHIVELOG';

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

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

set numwidth 10
column event format a25 tru
select inst_id, event, time_waited, total_waits, total_timeouts
from (select inst_id, event, time_waited, total_waits, total_timeouts
from gv$system_event where event not in ('rdbms ipc message','smon timer',
'pmon timer', 'SQL*Net message from client','lock manager wait for remote message',
'ges remote message', 'gcs remote message', 'gcs for action', 'client message', 
'pipe get', 'null event', 'PX Idle Wait', 'single-task message', 
'PX Deq: Execution Msg', 'KXFQ: kxfqdeq - normal deqeue', 
'listen endpoint status','slave wait','wakeup time manager')
order by time_waited desc)
where rownum < 11
order by time_waited desc;

test.sh
Code:
#!/bin/bash
sqlplus internal @test.sql
/u01/app/11.2.0/grid/bin/crs_stat -t
/u01/app/11.2.0/grid/bin/crsctl check crs

srvctl status asm -n ukedxdtmtdbs01a
srvctl status asm -n ukedxdtmtdbs01b

If you like to get it as e-mail run

test.sh | mail -s "Oracle report" john@smith.org

As I said I`m no DBA so no guarantee it would work Smilie
# 3  
Old 06-09-2011
Quote:
Originally Posted by click
[...]
Code:
sqlplus internal @test.sql
[...]

Just a small correction: the internal login was desupported in 9i,
use / as sysdba instead.
# 4  
Old 06-10-2011
works like a dream,

Many thanks

Previous Thread | Next Thread
Test Your Knowledge in Computers #202
Difficulty: Easy
At compile time, the interpreter parses Perl code into a recursive flat-space module.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Not able to get the required o/p from my script

Hi Experts, I have a script as below : # cat a.sh var=`mysql -usupport -p'testing' -e "select count(1) from db_test.sampletable;"` echo $var the output of this script is : count(1) 145039 Now i want to remove header from my o/p and modify somewhat like 145039 I have... (9 Replies)
Discussion started by: mukulverma2408
9 Replies

2. UNIX for Dummies Questions & Answers

Perl Script:how to find how many parameters are required to run the script

How to find how many parameters are required to run a Perl script? (1 Reply)
Discussion started by: Lakshman_Gupta
1 Replies

3. AIX

Information required for AIX certification

Hello friends, I want some information on AIX certification and want to give the AIX certification exam but not getting the proper information required. Basically when I am trying to search the information about this certification getting different options like "AIX p series certification" Aix... (6 Replies)
Discussion started by: naman agarwal
6 Replies

4. Solaris

How to converting rac to one rac ?

hi everyone, We have rac system which has two sun solaris M5000s and two oracle 11gR2 databases respectively. Also , we have unix codes on one rac and these unix codes extract txt files for external tables during first step of ETL. We run our unix codes using Util.RunThis java code and... (10 Replies)
Discussion started by: imtheone
10 Replies

5. Red Hat

ls: /lib/libattr.so.1: no version information available (required by /lib/libacl.so.1)

Hello, I'm experimenting a problem on my rh server. Red Hat Enterprise Linux AS release 3 (Taroon Update 8) 2.4.21-47.ELsmp #1 SMP i686 i686 i386 GNU/Linux It started with a segmentation fault on #id root To resolve it, I've installed coreutils-4.5.3-28.4.i386.rpm But, I... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

6. Shell Programming and Scripting

Only the required tag information the XML file file

Hi i have a single line xml file having many account no tag, from which i need only the account no from the tag. any one can help on this. below is the xml file: ... (2 Replies)
Discussion started by: Saravanapk
2 Replies

7. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

8. UNIX for Advanced & Expert Users

Help required in this script.

Hi Everyone, Please find below the script, I needed to understand step by step:confused:. Please If someone can help me out i will be very greatful:D. Please Guide me in a way which can help me out in figuring what this script doing on my server. ... (3 Replies)
Discussion started by: jojo123
3 Replies

9. Shell Programming and Scripting

script required

The line is like this +abc+def+mgh+ddsdsd+sa i.e. words seperated by +. There is a plus in the beginning. i want to conver this line to abc, def, mgh, ddsdsd, sa please provide the logic in the form of a shell script Thanks in advance (13 Replies)
Discussion started by: skyineyes
13 Replies

Featured Tech Videos