Home » RDBMS Server » Server Administration » how to view packages bodies from other user?
how to view packages bodies from other user? [message #126146] Fri, 01 July 2005 04:31 Go to next message
aline
Messages: 92
Registered: February 2002
Member
Hi,

I just want to know if it's possible to authorize other user (which have not the DBA granted) to view my packages bodies?

thk
Re: how to view packages bodies from other user? [message #126170 is a reply to message #126146] Fri, 01 July 2005 06:29 Go to previous messageGo to next message
tarundua
Messages: 1080
Registered: June 2005
Location: India
Senior Member

As i know Package body is present in DBA_SOURCE view.

So u can explicitly grant select privilege on DBA_SOURCE view to that user.

And even if u want to hide other information and want to show only package specification then create another view on DBA_SOURCE view and extract only those rows which contains data for packages. and then grant select privilege on this new view to that user.

Check it out,
Tarun
Re: how to view packages bodies from other user? [message #126225 is a reply to message #126170] Fri, 01 July 2005 12:50 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
You don't want to grant select on DBA_SOURCE - all the code in the database (including sys) would be visible. Not that the std code in sys can't be viewed elsewhere of course...

Use ALL_SOURCE. If you grant execute on your code, then the other user will be able to see your spec. Grant all and they will be able to see your spec and body.
Re: how to view packages bodies from other user? [message #126396 is a reply to message #126225] Mon, 04 July 2005 04:32 Go to previous messageGo to next message
aline
Messages: 92
Registered: February 2002
Member
Thk for the tips!

What is the difference between the grant execut and the grant all?

Is it impossible to use the dbms_metadata package to view source?

I tried it but impossible for others to view my package with this.

select dbms_metadata.get_ddl('PACKAGE', 'TEST', 'ALINE') from dual;
return for others 'objects test of type package not fund in Aline's schema '

[Updated on: Mon, 04 July 2005 04:33]

Report message to a moderator

Re: how to view packages bodies from other user? [message #128191 is a reply to message #126396] Fri, 15 July 2005 11:05 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
see some documentation on it...
http://www.psoug.org/reference/dbms_metadata.html

SQL> create or replace package pkg1 is
  2  function f1 return number;
  3  end;
  4  /

Package created.

SQL> create or replace package body pkg1 is
  2  function f1 return number as begin return 1; end;
  3  end;
  4  /

Package body created.

SQL> grant all on pkg1 to public;

Grant succeeded.

SQL> -- all_tab_privs_made has objects - not just tables
SQL> select table_name, grantor, privilege from all_tab_privs_made
  2  where table_name = 'PKG1';

TABLE_NAME                     GRANTOR                        PRIVILEGE
------------------------------ ------------------------------ ----------
PKG1                           TATST                          EXECUTE
PKG1                           TATST                          DEBUG
Previous Topic: compilation of SYS.DBMS_STANDARD
Next Topic: global_name parameter
Goto Forum:
  


Current Time: Fri Jan 10 08:23:24 CST 2025