Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2005 05:00 PM
тАО07-17-2005 05:00 PM
export ORACLE_HOME=/opt/oracle/product/9.2
export ORACLE_SID=idmp005
export PATH=$PATH:/opt/oracle/product/9.2/bin:.
lsnrctl stop
/bin/cat <
exit
EOF
As you can see from the script above this will stop the listener and the oracle database.
Can anyone explain to me how "EOF" and "@" work in this script, also where can I put the "lsnrctl start" command if I want this script to start the listener and database.
Thanks,
Paul
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2005 05:21 PM
тАО07-17-2005 05:21 PM
Re: EOF
The EOF is the end of the sqlplus commands
and, @ is a part of the oracle connect string. Starting listener and database works exact as starting.
Hi
export ORACLE_HOME=/opt/oracle/product/9.2
export ORACLE_SID=idmp005
export PATH=$PATH:/opt/oracle/product/9.2/bin:.
lsnrctl stop
/bin/cat <
exit
EOF
lsnrctl start
/bin/cat <
exit
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-17-2005 05:38 PM
тАО07-17-2005 05:38 PM
SolutionU can try it in a command line itself. Try '/bin/cat <
U can use a script like below to startup ur database.
export ORACLE_HOME=/opt/oracle/product/9.2
export ORACLE_SID=idmp005
export PATH=$PATH:/opt/oracle/product/9.2/bin:.
/bin/cat <
exit
EOF
lsnrctl start
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-18-2005 07:14 PM
тАО07-18-2005 07:14 PM
Re: EOF
for example,
/bin/cat <
exit
SQLFROMSHELL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2005 12:22 AM
тАО07-19-2005 12:22 AM
Re: EOF
The 'EOF' thing is called a "here document".
Most modern shells have the ability to use them to encompass multiple lines of 'text', and can be used for pretty much any purpose. Combined with a pipe, they are useful tools.
Even Perl can use here documents (see man perlop, search for '<
The thing to note is that the end-token is case specific (has to be identical to the opening-token), and can have no leading spaces or other characters.
Basically, the here document extends the STDIN for the command it is <<'d (input-redirected) into. So in reality, you could probably just <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2005 08:25 AM
тАО07-19-2005 08:25 AM
Re: EOF
You can pipe directly into sqlplus. And I think you can also use "sqlplus <<" too, but I prefer the syntax below:
Here is what I have in our Oracle startup scripts.
Example 1: runs as root when the system boots:
($SU and $USER1 would be assigned according to your system; $SU is your path to su or sudo, $USER1 is the dba account)
cat << _EOF_ | ($SU - $USER1 -c "sqlplus /nolog")
connect oradb/oradb as sysdba;
startup;
exit;
_EOF_
Example 2: runs directly as the dba user:
cat << _EOF_ | sqlplus /nolog
connect oradb/oradb as sysdba;
startup;
exit;
_EOF_
If you really want to be fancy, you can put tabs in the code and then use <<- (note the addition of the dash (-). This little trick works for sh (posix), ksh and bash:
cat <<- EOF | sqlplus /nolog
[tab] connect oradb/oradb as sysdba;
[tab] startup;
[tab] exit;
[tab] EOF
(I spelled out [tab] here because the forum does not handle tabs in postings very well).
-- Tom