Nambahin
Yg di-eksekusi adalah test.sh-nya
(misal test.sh disimpan di /home/oracle)
begin
p_cmd_run('/home/oracle/test.sh');
end;
/
Jangan lupa execute permission utk file test.sh juga harus di grant.
Bowo
--- In [email protected], "Yulius Wibowo"
<[EMAIL PROTECTED]> wrote:
>
> Coba tambahkan:
> -- try to accomodate input/output redirection
> dbms_java.grant_permission('SCOTT',
> 'SYS:java.io.FilePermission',
> '/tmp/*',
> 'read,write');
>
> Dan perlu diingat, redirection menggunakan ">" atau "|" tidak bisa
> dijalankan (error/ignored)
>
> Solusi ?
> - Buat sebuat script file, misal test.sh
> isi
>
> #! bin/sh
> #
> #
>
> /usr/bin/vmstat 2 3 | /usr/bin/awk "{print $5}" >
> /export/home/oracle/vm.log'
>
>
> Saya sudah coba dan berhasil !
>
> Bowo
>
> --- In [email protected], "dany" <[EMAIL PROTECTED]> wrote:
> > Terima kasih atas tanggapannya Pak Bowo,
> >
> > saya sudah lakukan command berikut :
> >
> > SQL> Execute dbms_java.grant_permission( 'SCOTT',
>
> 'SYS:java.io.FilePermission
> ',
> > '<<ALL FILES>>',
> > 'execute');
> > SQL> execute dbms_java.grant_permission( 'SCOTT',
>
> 'SYS:java.lang.RuntimePermi
> ssion',
> > 'writeFileDescriptor',
> > '*' );
> > SQL> execute dbms_java.grant_permission( 'SCOTT',
>
> 'SYS:java.lang.RuntimePermi
> ssion',
> > 'readFileDescriptor',
> > '*' );
> > SQL> Commit;
> >
> > Tetapi hasilnya masih sama, mohon bantuannya sharing syntaxnya
> tentang
> > privileges yang masih kurang,
> > maklum kita orang jawa yang tidak bisa berbahasa java ^_^.
> >
> > Terima kasih.
> >
> > nb:
> > gimana kabarnya Pak Bowo,
> > masih suka maen ke sisindosat Pak Bowo,
> > saya terakhir ikut OEM 9i-nya Pak Bowo lho :D
> >
> > ----- Original Message -----
> > From: "Yulius Wibowo" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Monday, February 14, 2005 9:31 AM
> > Subject: [indo-oracle] Re: O/S command dari PL/SQL
> >
> >
> > >
> > >
> > > Mungkin masalah di "permission"-nya.
> > > Coba dicheck lagi mengenai java privileges yg diberikan ke user.
> > >
> > > Bowo
> > >
> > > --- In [email protected], "dany" <[EMAIL PROTECTED]> wrote:
> > >> Dear pakar,
> > >>
> > >> saya mencoba artikel ttg "System Call from a Java Procedure"
pada
> > > metalink,
> > >> tetapi gagal menjalankan command yang secara O/S command
tersebut
> > > baik2
> > >> saja.
> > >>
> > >> berikut infonya :
> > >>
> > >> Database : Oracle 9.2.0.4
> > >> Platform : Sun Solaris9 (SPARC)
> > >>
> > >> --Java Source
> > >> CREATE AND COMPILE JAVA SOURCE NAMED "execmd" AS
> > >> import java.lang.*;
> > >> import java.io.*;
> > >> public class execmd {
> > >> public static void run(String command[]) {
> > >> try {
> > >> Process p = Runtime.getRuntime().exec(command[0]);
> > >>
> > >> try {
> > >> p.waitFor();
> > >> }
> > >> catch (InterruptedException ie){
> > >> System.out.println("Errornya : " + ie.getMessage());
> > >> }
> > >>
> > >> System.out.println("Dari Process " + p.exitValue());
> > >> }
> > >> catch (IOException e) {
> > >> System.out.println("IO Exception : " + e.getMessage());
> > >> e.printStackTrace();
> > >> }
> > >> }
> > >> }
> > >>
> > >> --Procedure
> > >> CREATE OR REPLACE procedure p_cmd_run (command varchar2) as
> > >> language java
> > >> name 'execmd.run(java.lang.String[])';
> > >>
> > >> --O/S command
> > >> bash$ /usr/bin/vmstat 2 3 | /usr/bin/awk '{print $5}' >
> > >> /export/home/oracle/vm.log
> > >> --> sukses dan file log terbentuk
> > >>
> > >> --PL/SQL Command
> > >> bash$ rm -rf /export/home/oracle/*.log
> > >> bash$ sqlplus scott/tiger
> > >> begin
> > >> p_cmd_run('/usr/bin/vmstat 2 3 | /usr/bin/awk ''{print $5}''
>
> > >> /export/home/oracle/vm.log');
> > >> end;
> > >> --> file log tdk terbentuk dan message: "Dari Process 1"
> > >>
> > >> --O/S command
> > >> bash$ /usr/bin/sar 2 3 | /usr/bin/awk '{print $5}' >
> > >> /export/home/oracle/sar.log
> > >> --> sukses dan file log terbentuk
> > >>
> > >> --PL/SQL Command
> > >> bash$ rm -rf /export/home/oracle/*.log
> > >> bash$ sqlplus scott/tiger
> > >> begin
> > >> p_cmd_run('/usr/bin/sar 2 3 | /usr/bin/awk ''{print $5}'' >
> > >> /export/home/oracle/sar.log');
> > >> end;
> > >> --> sukses tetapi file log tidak terbentuk, message : "Dari
> > > Process 0"
> > >>
> > >>
> > >> mohon pencerahan dari para pakar.
> > >> Terima kasih sebelum dan sesudahnya.
> > >>
> > >>
> > >> thx
> > >
> > >
> > >
> > >
> > >
> > > --
> > > -----------I.N.D.O - O.R.A.C.L.E---------------
> > > Keluar: [EMAIL PROTECTED]
> > > Website: http://indo-oracle.blogspot.com
> > > -----------------------------------------------
> > >
> > > Bergabung dengan Indonesia Thin Client User Groups,
> > > Terminal Server, Citrix, New Moon Caneveral, di:
> > > http://indo-thin.vze.com
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.blogspot.com
-----------------------------------------------
Bergabung dengan Indonesia Thin Client User Groups,
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.vze.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indo-oracle/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/