Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: sqlplus question

RE: sqlplus question

From: Rajesh Dayal <Rajesh_at_ohitelecom.com>
Date: Tue, 29 Jan 2002 03:45:21 -0800
Message-ID: <F001.003FE697.20020129033018@fatcity.com>

Thanks Stephan,

        Your suggestion had motivated me and I wrote the code, after RTFM.

Sameer,

I didn't scheduled the job on OS because this should an Oracle Job, log switching has nothing to do with OS (you don't trouble a company GM when the work should be done by a Normal Manager right??). And you need to handle the error conditions of OS when your DB is down, which is eliminated in this case.

Any-way thanks to all,
Rajesh

And-yes, the code is like this:

create or replace PROCEDURE SWITCH1 IS

  c       number;
  d       number;

begin
  c := dbms_sql.open_cursor;
  dbms_sql.parse(c, 'alter system switch logfile', 1);   d := dbms_sql.execute(c);
  dbms_sql.close_cursor(c);
commit ;
END; -----Original Message-----
Faroult
Sent: Tuesday, January 29, 2002 1:36 PM
To: Multiple recipients of list ORACLE-L

Rajesh Dayal wrote:
>
> I was also trying to put some script on Oracle scheduler and successful
too.
> But on Oracle 8
> I failed. It was successful on Oracle 8i (8 doesn't support execute
> immediate). Would appreciate,
> if someone can give equivalent code for Oracle 8.
> Here is the code for Oracle 8i,
>
> create or replace PROCEDURE SWITCH IS
> 2 BEGIN
> 3 execute immediate 'alter system switch logfile ';
> 4 commit ;
> 5 END;
> 6 /
>
> Thanks in Advance,
> Rajesh
> NOTE: It would be executed with any user having sysdba privilege.
>

Look in the doc for the dbms_sql package. Hardly more complicated than 'execute immediate' for DDL (you declare a handler for the cursor, then it's done in two calls, parse and execute).

--
Regards,

Stephane Faroult
Oriole Ltd
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rajesh Dayal
  INET: Rajesh_at_ohitelecom.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jan 29 2002 - 05:45:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US