Usage of disc group to kick off Oracle RMAN backup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Usage of disc group to kick off Oracle RMAN backup
# 1  
Old 04-14-2015
Usage of disc group to kick off Oracle RMAN backup

Hi guys, i need a small help. I was writing an automation script for import utility of oracle datapump. I am getting stuck in one part of the shell script where i am doing a grep on one of the filesystem and if it is above threshold then it would kick off an oracle RMAN backup. Fyi. i am grepping the percent.
Below is the snippet from the code which i am trying to achive.

Code:
#!/bin/sh
set -x
mountpoint=`df -kh|grep \oraarch|awk '{ print$4 " " $5 }'`
if [ $mountpoint ge 20 ]; then
echo "GoldenGate filesystem is full.launcing RMAN"
rman target /
show all;
backup archivelog all delete input;
fi

file system structure:
------------------------
Code:
/dev/mapper/vg01-lvoraarch       98G  184M   93G   1% /oraarch

Every time i am running it i get an error too many arguments:

Code:
./rman_backup.sh: line 4: [: too many arguments

If someone can point me out the fix for the error , it will be helpful. thanks.

Last edited by Don Cragun; 04-14-2015 at 05:23 PM.. Reason: Add CODE tags.
# 2  
Old 04-14-2015
Try:
Code:
if [ $mountpoint -ge 20 ]; then

instead of:
Code:
if [ $mountpoint ge 20 ]; then

This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 04-15-2015
Thanks Don. that gave same error as well.I have put set -x to debug. it gives following o/p.

Code:
++ df -kh
++ grep oraarch
++ awk '{ print$4 " " $5 }'
+ mountpoint='
1% /oraarch'
+ '[' 1% /oraarch -ge 50 ']'
./rman_backup.sh: line 4: [: too many arguments

I tried modifying the script by changing it to:

Code:
mountpoint=(df -kh|grep \oraarch|awk '{ print$4 " " $5 }')
threshold=20
if [ $mountpoint -gt $threshold ]; then


the it errors out to
Code:
./rman_backup.sh: line 3: syntax error near unexpected token `|'
./rman_backup.sh: line 3: `mountpoint=(df -kh|grep \oraarch|awk '{ print$4 " " $5 }')'

not sure what am i doing wrong.

Last edited by sub; 05-07-2015 at 11:32 AM..
# 4  
Old 04-15-2015
Hello,

As Don said, that fixed an error. Now you have a new one.

If you just want to extract the percentage, try something like this:

Code:
 mountpoint=$(df -h /home | awk -F' |%' '{print $17}' | tail -1)

Check if the output of
Code:
df -h /home | awk -F' |%' '{print $17}' | tail -1

is what you want first.
Code:
if [ $mountpoint -ge 20 ]; then echo "GoldenGate filesystem is full.launching RMAN" rman target / show all backup archivelog all delete input fi

Do you want to launch it when is more than 20%. That doesn't seem like a full FS.
This User Gave Thanks to Kibou For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Solaris

Solaris 11 - how to backup and restore system disc

I have installed Solaris 11 Express on my machine and now I am wondering what is the best way to backup (to another hard disc) and restore the system hard disc content. The backup should to be done every night using a script launched by cron and all previously done backups should be available to... (8 Replies)
Discussion started by: RychnD
8 Replies

3. UNIX for Advanced & Expert Users

any quicker way to list disc usage by users?

Hi: it takes a long time for "du -sh list_of_users" to give you the output. Is there a quicker way to get this info? Thanks! N.B. Phil (4 Replies)
Discussion started by: phil518
4 Replies

4. UNIX and Linux Applications

Running RMAN backups from grid control but using oracle account with rsa keys vs a password ?

I'm a sysadmin trying to help out one of our DBA's setup the RMAN backups (Oracle 11g on rhel5 ) so they can schedule and control them from the OEM grid control. But we want the oracle user to use ssh keys instead of a password. I have the working rsa keys in place for the user but the GUI seems to... (0 Replies)
Discussion started by: samael00
0 Replies

5. AIX

How to backup and restore more than 1 volume group

Hello, Could someone tell me if I have this correct. If I have 2 volume groups rootvg and datavg and wish to back these up to 21 tape how do I accomplish this. I am currently using mksysb /dev/rmt0.1 -V savevg -f /dev/rmt0 datavg I think this may be overwriting the rootvg however as... (3 Replies)
Discussion started by: pobman
3 Replies

6. Solaris

Ultra 10 - Copying Files From Disc After Booting Up With Recovery Disc?

Hello, I'm still learning unix and I have what is probably a simple question but I can't seem to find the question to. I have an Ultra 10 Sparc Server running solaris 8 and the drive may have crashed (I hope not). Currently, it appears some files in the /etc folder are missing. I have a backup... (1 Reply)
Discussion started by: ideffects
1 Replies

7. Shell Programming and Scripting

Shell Script for RMAN Backup

Hi Experts, Can anyone help me to write shell script for taking backup with RMAN in oracle 9i or suggests me any site which has this kind of scripts Thanks shaan (1 Reply)
Discussion started by: shaan_dmp
1 Replies

8. Linux

How to Burn .gp Oracle 9.2.0.4.0 to Compact Disc Media on Windows Box

Hi All, I Downloaded Oracle 9.2.0.4.0 for Linux AS 4 and the file format is Directions to extract the files 1. Run "gunzip <filename>" on all the files. Eg. ship_9204_linux_disk1.cpio.gz 2. Extract the cpio archives with the command "cpio -idmv < <filename>" Eg. cpio -idmv... (0 Replies)
Discussion started by: prakashpichika
0 Replies
Login or Register to Ask a Question