Scripting help

From: Robert (netsec4u_at_hotmail.com)
Date: 10/01/04


Date: Fri, 1 Oct 2004 14:53:17 -0400

The attached script is intended to verify that a database exists, checks
access, and adds database roles with a twist. This script checks several
databases.

The problem that I am running into is sp_grantdbaccess only runs on the
current database. On line 65 I attempted to remedy this problem; in essence
executing 'USE <dbname>' and discovered that this command does nothing
unless followed by a 'GO' command and as a result all my variables are
destroyed.

Is there a way around this? If so how?

begin 666 GrantdbAccess.txt
M4T54(%%53U1%1%])1$5.5$E&2452($]&1B -"D=/#0I3150@04Y325].54Q,
M4R!/1D8@#0I'3PT*#0I#4D5!5$4@4%)/0T5$55)%("-S<%]#:&M2;VQE#0H)
M0&1B<F]L96YA;64@;G9A<F-H87(H,S(I+ T*"4!L;V=I;G5I9"!N=F%R8VAA
M<B@S,BD@;W5T<'5T#0I!4PT*"6EF(&YO="!E>&ES=',@*'-E;&5C="!$8E)O
M;&4@/2!G+FYA;64L($UE;6)E<DYA;64@/2!U+FYA;64L($UE;6)E<E-)1" ]
M('4N<VED#0H)9G)O;2!S>7-U<V5R<R!U+"!S>7-U<V5R<R!G+"!S>7-M96UB
M97)S(&T-"@EW:&5R92!G+FYA;64@/2! 9&)R;VQE;F%M90T*"6%N9"!G+G5I
M9" ](&TN9W)O=7!U:60-"@EA;F0@9RYI<W-Q;')O;&4@/2 Q#0H)86YD('4N
M=6ED(#T@;2YM96UB97)U:60-"@EA;F0@=2YN86UE/4!L;V=I;G5I9 T*"2D-
M"@D)97AE8R!S<%]A9&1R;VQE;65M8F5R($!D8G)O;&5N86UE+"! ;&]G:6YU
M:60-"@EE;'-E#0H)"7!R:6YT("<@(%5S97(@)R K($!L;V=I;G5I9" K("<@
M86QR96%D>2!G<F%N=&5D("<@*R! 9&)R;VQE;F%M90T*1T\-"@T*4T54(%%5
M3U1%1%])1$5.5$E&2452($]&1B -"D=/#0I3150@04Y325].54Q,4R!/3B -
M"D=/#0H-"E-%5"!154]4141?241%3E1)1DE%4B!/1D8@#0I'3PT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8B! 9&)N86UE/4XG3&%N9%)E
M8V]R9',G+"! ;&]G:6YU:60@/2! ;&]G:6YU:60-"F5X96-U=&4@(W-P7T-H
M:V1B($!D8FYA;64]3B=,87=%;F9O<F-E;65N="<L($!L;V=I;G5I9" ]($!L
M;V=I;G5I9 T*97AE8W5T92 C<W!?0VAK9&(@0&1B;F%M93U.)TUA9VES=')A
M=&4G+"! ;&]G:6YU:60@/2! ;&]G:6YU:60-"@T*1%)/4"!04D]#14154D4@
M(W-P7T-H:U)O;&4-"D123U @4%)/0T5$55)%("-S<%]#:&M!8V-E<W,-"D12
83U @4%)/0T5$55)%("-S<%]#:&MD8@T*
`
end



Relevant Pages

  • RE: problem with DBD::Oracle
    ... Next, if it runs from the command line, then you most likely have a permissions issue with either the Perl script itself, or the Oracle.so library. ... Oracle database that is on a different machine. ... sender of the delivery error by replying to this message, or notify us by ...
    (perl.dbi.users)
  • Re: mysql connection failing as CGI
    ... some new hosting which comes with a MySQL database but I'm struggling ... to get it working with any perl scripts; the hosting support are being ... The problem basically is that when the script is run as a CGI script it ... the command line it runs fine. ...
    (comp.lang.perl.misc)
  • mysql connection failing as CGI
    ... some new hosting which comes with a MySQL database but I'm struggling ... to get it working with any perl scripts; the hosting support are being ... The problem basically is that when the script is run as a CGI script it ... the command line it runs fine. ...
    (comp.lang.perl.misc)
  • Re: How do I Edit a list of files associated with a product ?
    ... So it succesfully adds the product and the files in a database and the filesystem. ... and you have done something like that or you know a url or script that does that, ... Just build an edit command with the selected file name and ... you better check out the syntax for the exec command since it has additional parameters. ...
    (comp.lang.php)
  • Re: Oracle database not starting up after reboot on RedHat ES4 Linux !
    ... I have Oracle database enterprise edition 9.2.0.4 running on RedHat ... I am using dbstart command via a /etc/init.d/oracle file. ... When working with shell scripts that are executed by cron or on system startup, it is often useful to run those scripts in a manner that does not have your environment included in the execution of that script. ...
    (comp.databases.oracle.server)