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

Home -> Community -> Usenet -> c.d.o.server -> Re: The equivalent of "host" in PL/SQL ?

Re: The equivalent of "host" in PL/SQL ?

From: bhogak <bhogak_at_yahoo.com>
Date: Sun, 17 Jun 2001 20:24:48 -0500
Message-ID: <9gjl7d$rc1$1@bob.news.rcn.net>

I too fail to understand why PL/SQL doesn't have a Host command. Yes, we can use Java or external C libraries or use DBMS_pipe and pro*C to issue a System command. But all of these are work arounds. PL/SQL definitely has come a long way. We can now even do Socket Programming within a PL/SQL. Why didn't Oracle add a Host command? I am not sure, but may be its because of Security reasons.

bhogak

I hate Spam <tbf_at_cn.stam.dk> wrote in message news:igspit0hloi8vehmku2ijpl6s9cnsm70sp_at_4ax.com...
> Oracle 8.1.6.3.4 SE on NT4.0 SP5
> I am stuck, trying to find some way of doing operating system commands
> from a stored procedure. There ought to be a package for that in
> Oracle, but I have not been able to find it.
>
> I have made the following stored procedure to automate the hot backup
> process, but cannot make the final step i.e. copying the data files
> with a call to host (like in the out commented line). Could someone
> lead me in the right direction please.
> Yours Hans Erik Busk
> tbf_at_cn.stam.dk
> ********* code follows ***********
> create or replace procedure hotbackup is
> OS_stmt varchar2 (200);
> cursor tbspace_c is select distinct tablespace_name from
> sys.dba_data_files;
> cursor tbfiles_c(tbs varchar2) is select file_name from
> sys.dba_data_files
> where tablespace_name=tbs;
> begin
> for tbsp in tbspace_c loop
> execute immediate
> 'alter tablespace '| tbsp.tablespace_name| ||' begin backup' ;
> for tbfnam in tbfiles_c(tbsp.tablespace_name) loop
> OS_stmt:=' xcopy /Y '||tbfnam.file_name||' to
> e'||substr(tbfnam.file_name,2,200);
> -- host OS_stmt;
> end loop;
> execute immediate
> 'alter tablespace '| tbsp.tablespace_name| ||' end backup' ;
> end loop;
> execute immediate
> 'alter database backup controlfile to ' 'e:\test\controlfile.bak'';
> end hotbackup;
> /
>
Received on Sun Jun 17 2001 - 20:24:48 CDT

Original text of this message

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