using a java to grant a user problem! [message #91962] |
Wed, 24 December 2003 16:00 |
powerljh2000
Messages: 1 Registered: December 2003
|
Junior Member |
|
|
i hava two instance(finc & hrms) in a solaris system, the DB version is oracle8.1.7, i have create the java server in hrms instance and not in finc instance
follow is the my operate process:
1.create a java cmd.java, the java only a static function grant(String cmd) for run a command
2.loadjava -u user/pwd@hrms -resolve -verbose cmd.java
3.in hrms instance,create function cmd(p_cmd varchar2) return varchar2 as language java name 'cmd.grant(java.lang.String) return java.lang.String';
4.in solaris system,create grant.sh script and grant.sql file in path /u01/app/scripts, such as:
#grant.sh ->
oracle_sid = hrms
oracle_home = /u01/app/oracle/product/8.1.7
export oracle_sid
export oracle_home
$oracle_home/bin/sqlplus /nolog @/u01/app/scripts/grant.sql
#grant.sql ->
connect internal;
grant dba to username(hrms);
exit;
5.run the cmd function in hrms instance, such as:
declare
return varchar2(100);
begin
return := cmd('/usr/bin/sh /u01/app/scripts/grant.sh');
end;
-----------------------------------
all the process is work OK, the user in hrms be grant dba role successfully, so i want to grant dba to a user in finc instance by internal user, then i change the grant.sh and grant.sql, such as:
#grant.sh ->
oracle_sid = finc #change to finc instance
oracle_home = /u01/app/oracle/product/8.1.7
export oracle_sid
export oracle_home
$oracle_home/bin/sqlplus /nolog @/u01/app/scripts/grant.sql
#grant.sql ->
connect internal;
grant dba to username(finc); #change to finc user
exit;
then i execute process 5 again, but dba role can't be grant to finc user, why not? help me please!help!help!
|
|
|