Search This Blog

Thursday, January 24, 2013

Run Commands As Oracle User From Root

The following scripts shows how a number of commands can be run as the "oracle" user the "root" user.
#!/bin/ksh
su - oracle <<EOF
ORACLE_SID=LIN1; export ORACLE_SID
rman catalog=rman/rman@w2k1 target=/ cmdfile=my_cmdfile log=my_logfile append 
EOF

This is often necessary where CRON jobs are run from the root user rather than the oracle user.

Remove DOS CR/LFs (^M)

This summary is not available. Please click here to view the post.

alias

This summary is not available. Please click here to view the post.

Perform Action for Every Line in a File

The following scripts shows a method for performing an action for each line in a file.
#!/bin/bash
while read LINE; do
  # Do something with the line.
  echo $LINE;
done < /tmp/myfile.txt

Perform Action for Every File in a Directory

This summary is not available. Please click here to view the post.