This forum is currently locked. You can't register or post questions at this time. (read more)

KORN SHELL SCRIPTING

All posts relating to Oracle database administration.

Moderator: Tim...

Guest

KORN SHELL SCRIPTING

Postby Guest » Mon Nov 01, 2004 6:09 pm

Hi Tim,
I am reading a KORN shell scripting bok, but it does not have any topics on how to connect to ORACLE, access Oracle & then disconnect from it.
Do u have any articles about connecting to oracle from korn shell.
thanks
satish

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

RE:KORN SHELL SCRIPTING

Postby Tim... » Mon Nov 01, 2004 6:09 pm

Hi.

This is about as simple as it gets:

#!/bin/ksh

ORACLE_SID=MYSID; export ORACLE_SID

sqlplus -s /nolog <<EOF
conn / as sysdba
SPOOL file.txt
SELECT sysdate FROM dual;
SPOOL OFF
EXIT
EOF

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

Guest

RE:KORN SHELL SCRIPTING

Postby Guest » Mon Nov 01, 2004 6:09 pm

Hi Tim,
What Does that EOF mean ? and that exit statement exits from SQLPlus .Is it?
And can I use "!" instead of EOF command.
thanks
satish

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

RE:KORN SHELL SCRIPTING

Postby Tim... » Mon Nov 01, 2004 6:09 pm

Hi.

It's simply piping a string in to look like a file. The EOF at the start and end of the commands indicate the start and end of the "file". You can replace this marker with just about anything so long as the start and end match.

Yes, the exit is to exit SQLPlus.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog


Return to “Oracle Database Administration”

Who is online

Users browsing this forum: No registered users and 0 guests

cron