If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > scripting

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-31-11, 08:12
rakkab007 rakkab007 is offline
Registered User
 
Join Date: Aug 2011
Posts: 11
scripting

Hi,

my requirement is to automate one DB refresh using scritping.here am attaching the steps to be automated for refresh and the script am adjusted for some of its process...Basically am not shell scripter..so only basic ideas...
steps to automate.txt is the orginal one and script.txt is the one am trying to creat part by part.please review the script wat i tried and help me to make it functional one...
Attached Files
File Type: txt steps to automate.txt (11.2 KB, 27 views)
File Type: txt script.txt (10.6 KB, 18 views)
Reply With Quote
  #2 (permalink)  
Old 08-31-11, 11:39
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
What user id are you using (going to use) ?
The line numbers include blank lines.
On line 5:
"cd path in DEV/" is not a valid statement, have you just masked this?
On line 6:
"rm -rf *" will unconditionally and recursively delete everything! You had better be in the right directory.
On lines 10 and 11:
There is a significant difference between the use of the apostrophe ', and the use of the backtick ` character.

You can run lines 7 thru 11 individually at a $ prompt to see if each works.
Use "cat temp.data" to display the contents of the file.
Reply With Quote
  #3 (permalink)  
Old 08-31-11, 23:04
rakkab007 rakkab007 is offline
Registered User
 
Join Date: Aug 2011
Posts: 11
running as oracle user and line 5 instead of /DEV,will put the correct path.PLan is to enter that DEV directory and delete all the files in that directory,what all are the files in that directory are not needed,so can delete all without checking..and in step 7,
scp -r oracle@PRD:/backup/oracle/PRFN/rman/Sun/* /backup--(DEV location),
here if we run this script in monday,it has to go and scp files from Sun directory from PRD to DEV and if TUE need to chekc in MOn directory ..like that..that am not aware how to code..

And i ran seperately the scripts as you told,but this step:-
restore archivelog low sequence $low high sequence $high; not taking low and high value which already stored in low and high variables(these are numbers)..whaat may be the issue..please
Reply With Quote
  #4 (permalink)  
Old 09-01-11, 00:38
rakkab007 rakkab007 is offline
Registered User
 
Join Date: Aug 2011
Posts: 11
executed steps 7-11 seperately and its working fine.....in the sql part
LOG="/path/a.log"
export ORACLE_SID=abcd
sqlplus -s '/ as sysdba' <<! 1>>${LOG} 2>&1
@/data/export/sql.sql
quit
!
here sql.sql am edited as
echo "select 'rm -rf '||name from v\$datafile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file1
echo "select 'rm -rf '||name from v\$controlfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file2
echo "select 'rm -rf '||name from v\$tempfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file3
echo "select 'rm -rf '||MEMBER from v\$logfile;" | sqlplus "/ as sysdba" | grep "^rm -rf" > file4
here need to execute these four files to remove files,how will it possible to execute these 4 files in script and also need to get an idea about how script will move to the directory automatically and scp files from that directory..that in step 7
scp -r oracle@PRD:/backup/oracle/PRFN/rman/Sun/* /backup--(DEV location)

please help to ...
Reply With Quote
  #5 (permalink)  
Old 09-02-11, 04:41
sandip.senmajumde sandip.senmajumde is offline
Registered User
 
Join Date: Sep 2011
Posts: 1
As i am new to this site i dont know where to post.....that is why i am posting here

Two RAR file are coming namely A, B in ZIP format in a particular location each file contains 3 column (x, x1, x2) Unzip both the file and place the file in a location. Create zero byte file and copy (x1) second column from both the file to that zero byte file in a single column. After copy delete the duplicate record from that file. Then add another column say (DateTime) to that new file and insert column data values i.e (sysdate) to that file.

How to automate this using Linux Schell script

Example:-
A
x X1 X2
1 1 3
6 2 4
5 4 6
This is file A


B
x X1 X2
6 6 5
5 2 2
5 5 5
This is file B


C
X1
1
2
4
6
2
5
This the new file and data should be like this.

After deleting the duplicate new file should be like this
C
X1
1
2
4
6
5





Now add a column in this new file and insert values i.e(sysdate)

C
X1 Date_time
1 02-Sep-2011
2 02-Sep-2011
4 02-Sep-2011
6 02-Sep-2011
5 02-Sep-2011
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On