How to read oracle control file's data using a shell script? Shell script is in Unix.

Recommended Answers

What is the format of the file and what do you want to read from it?

Jump to Post

All 2 Replies

What is the format of the file and what do you want to read from it?

don't know if you're still concerned - and I just came across your post.
typically I create a text file with the sqlplus commands that I need to execute and I use bash scripts to execute. Make sure your oracle user environment is set up from where you're executing the script or embed them in your bash script. Here is an example of displaying the info in your countrol file:

  1. create text file show_controlfile.sql ::
    select * from V$DATABASE;
    exit;
    /

  2. create bash script (of course, make it executable): <<for specific sql

!/bash/bin

sqlplus / as sysdba @<full path>/show_controlfile

  1. create bash script << for multiple sqls
!/bin/bash

sqlplus / as sysdba << EOF
@show_controlfile
EOF
exit

  1. execute
    <full path>/show_controlfile.sh
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.