Access package body in once schema by another

I have package defined in one schema (A). How can another user (B) access the body of that package logged in as B?

SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE     10.2.0.1.0     Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> connect o/o
Connecte.
SQL> create or replace package p is procedure p; end;
  2  /
Package cree.
SQL> create or replace package body p is procedure p is begin null;end; end;
  2  /
Corps de package cree.
SQL> grant execute on p to u;
Autorisation de privileges (GRANT) acceptee.
SQL> connect u/u
Connecte.
SQL> select * from all_source where owner='O';
OWNER                      NAME                     TYPE
      LINE
TEXT
O                      P                     PACKAGE
      1
package p is procedure p; end;
O                      P                     PACKAGE BODY
      1
package body p is procedure p is begin null;end; end;
OWNER                      NAME                     TYPE
      LINE
TEXT
SQL>

Similar Messages

  • Export sequence from once schema to another using dbms_datapump

    Hello,
    Can anybody help me how to export only sequences from one schema to another using dbms_datapump or using any other packages.
    I cannot use the expdp/impdp from command prompt.
    Thanks.

    Hello Richard,
    No luck yet, it's new one now.
    declare
    l_dp_handle NUMBER;
    v_job_state varchar2(4000);
    l_last_job_state VARCHAR2(30) := 'UNDEFINED';
    l_job_state VARCHAR2(30) := 'UNDEFINED';
    l_sts KU$_STATUS;
    v_logs ku$_LogEntry;
    v_row PLS_INTEGER;
    BEGIN
    dbms_output.put_line('get_sequence - Started');
    l_dp_handle := DBMS_DATAPUMP.open(operation => 'IMPORT',
    job_mode => 'SCHEMA',
    remote_link => 'PSUP_DATA',
    version => 'LATEST');
    dbms_output.put_line('get_sequence - get handle :'||l_dp_handle);
    DBMS_DATAPUMP.add_file(handle => l_dp_handle,
    filename => 'test.log',
    directory => 'DMPDIR',
    filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE); dbms_output.put_line('get_sequence - add file');
    DBMS_DATAPUMP.METADATA_FILTER(l_dp_handle, 'SCHEMA_LIST', '''PSUP_DATA'''); dbms_output.put_line('get_sequence - metadata filer1');
    DBMS_DATAPUMP.METADATA_FILTER(l_dp_handle,
    'INCLUDE_PATH_EXPR',
    'IN (''SEQUENCE'')'); dbms_output.put_line('get_sequence - metadata filer2');
    DBMS_DATAPUMP.METADATA_REMAP(l_dp_handle,
    'REMAP_SCHEMA',
    'PSUP_DATA',
    'IRIS_DATA'); dbms_output.put_line('get_sequence - metadata remap');
    DBMS_DATAPUMP.start_job(l_dp_handle); dbms_output.put_line('get_sequence - starting job');
    DBMS_DATAPUMP.WAIT_FOR_JOB(l_dp_handle, v_job_state);
    dbms_output.put_line('get_sequence - completed');
    exception
    WHEN OTHERS THEN
    dbms_datapump.get_status(NULL, 8, 0, v_job_state, l_sts);
    v_logs := l_sts.error;
    v_row := v_logs.FIRST;
    LOOP
    EXIT WHEN v_row IS NULL;
    dbms_output.put_line('logLineNumber=' || v_logs(v_row).logLineNumber);
    dbms_output.put_line('errorNumber=' || v_logs(v_row).errorNumber);
    dbms_output.put_line('LogText=' || v_logs(v_row).LogText);
    v_row := v_logs.NEXT(v_row);
    END LOOP;
    RAISE;
    end;
    get_sequence - Started
    get_sequence - get handle :58
    get_sequence - add file
    declare
    ERROR at line 1:
    ORA-31623: a job is not attached to this session via the specified handle
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 2772
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 3886
    ORA-06512: at line 43
    ORA-39001: invalid argument value
    I go ogled some of adive i could see is grant create table to user, but my user is having DBA role as well.
    Please help.

  • Invalid package body for flows_010500 schema

    The following package body will not compile, I ran the utlprp.sql script to recompile as sysdba and they still compile with errors. Is this the schema for version 1.5 and no loner needed if we are using 1.6 htmldb? if so can the flows_010500 be dropped?
    wwv_execute_immediate
    wwv_flow_audit
    wwv_flow_builder
    wwv_flow_collection
    wwv_flow_disp_page_plugs
    wwv_flow_imp_item
    wwv_flow_item
    wwv_flow_load_data
    wwv_flow_query
    wwv_flow_svg
    wwv_flow_svg
    wwv_flow_sw_api
    wwv_flow_util
    wwv_flow_temp
    wwv_flow_utilities
    wwv_flow_upgrade
    wwv_flow_wizard_api
    wwv_render_calendar2
    wwv_render_chart2
    wwv_render_report3

    Janice,
    If you have installed 1.6 and upgraded your 1.5 applications, you technically no longer need the FLOWS_010500 schema, and you can drop it.
    To be super conservative, you can take an export of it before dropping it, should you find the extremely unlike scenario where you would need to revert back to 1.5.
    Thanks,
    - Scott -

  • Grant command to view package body

    I sent a request for the DBA's to grant me rights to the package body but I only see the spec with the grant execute command.
    Here is the command I just sent:
    grant create any procedure to DEVELOPER1;
    But the DBA changed my grant command to:
    grant create procedure to DEVELOPER1;
    But I still cannot see the package body. This is on a test environment.
    Would the "create any procedure" command help me see the package body of different schema owners package bodies?
    Or is there another grant command to see different schema package bodies?

    primefsu wrote:
    My dba say that you cannot use debug in this grant because session belongs right after debug.I have no clue what your dba is talking about. Anyway:
    SQL> create or replace
      2    package pkg1
      3      is
      4        procedure p1;
      5  end;
      6  /
    Package created.
    SQL> create or replace
      2    package body pkg1
      3      is
      4        procedure p1
      5          is
      6          begin
      7              null;
      8        end;
      9  end;
    10  /
    Package body created.
    SQL> grant execute on pkg1 to u1
      2  /
    Grant succeeded.
    SQL> connect u1@orcl
    Enter password: **
    Connected.
    SQL> exec scott.pkg1.p1;
    PL/SQL procedure successfully completed.
    SQL> select  text
      2    from  all_source
      3    where owner = 'SCOTT'
      4      and name = 'PKG1'
      5      and type = 'PACKAGE BODY'
      6    order by line
      7  /
    no rows selected
    SQL> connect scott@orcl
    Enter password: *****
    Connected.
    SQL> grant debug on pkg1 to u1
      2  /
    Grant succeeded.
    SQL> connect u1@orcl
    Enter password: **
    Connected.
    SQL> select  text
      2    from  all_source
      3    where owner = 'SCOTT'
      4      and name = 'PKG1'
      5      and type = 'PACKAGE BODY'
      6    order by line
      7  /
    TEXT
    package body pkg1
        is
          procedure p1
            is
            begin
                null;
          end;
    end;
    8 rows selected.
    SQL> As you can see, package body became visible to user U1 as soon as user U1 was granted DEBUG on package.
    SY.

  • Unable to see package body in all_source

    schema owner can see package and package body in all_source
    another user, which has execute any procedure privs can only see the package, not the package body in all_source
    Is there another privilege necessary to see the package body? I can't find any.
    thanks, ...jrb

    Is your package valid? OWB will not show invalid packages in the project tree. Go to the database schema and check if the package is valid. If the package is invalid, recompile and reimport it into OWB.

  • Issue with viewing Package Body in SQL Developer 2.1 EA1

    I was able to view the package body from different schemas after I log in with user account in SQL Developer 1.5.5.
    But with SQL Developer 2.1 EA1, I could view only spec and I can see the package body only if I log in with DBO account.
    Is there any setting that needs to be configured to be able to view the package body?
    Thanks!

    Thanks for replying my message.
    It's Oracle 9i.
    What I meant 'spec' is you can see only the headers you defined in spec. You can expend the package and be able to see the all functions and procedures but you won't be able to see the '%packagename% Body' where all the detail code were written.
    As I mentioned in my previous post, with SQL Developer 1.5.5 version, you can see spec and package body if you expend the package.

  • View package body in another schema

    I have developers who want to view the code in the package body in another's schema.
    I know select text from all_source/ user_source works only for packages in your own schema.
    Granting system privelege 'create any procedure' allows the developer to view as well as update priveleges.
    As the owner of the objects what grants do I need to give to developers so that they can only view the code.

    You can grant select_catalog_role permissions to your developers. This will give your developers select access to all of the V$ views and DBA_% views. Then they can view the dba_source table to view other schema's package code..
    Regards,
    David

  • VIew of Package body in another schema in EA 3.0

    I would like the ability in SQL Developer to view the package body of another schema with the CREATE ANY PRIVILGE.
    For instance, in TOAD you can grant access to DBA_SOURCE or SELECT_CATALOG_ROLE and then be able to view another schema's package body.
    This is long overdue without having to log into that schema or granting CREATE ANY PRIVILEDGE to user.
    This one is really needed

    "CREATE ANY PRIVILEGE" is irrelevant to the ability of viewing the source owned by other users.
    Please provide exact script for creating a user, which is able to see the code, say in HR schema, via the query
    select * from all_source
    where owner = 'HR'
    and yet missing the nodes in the OtherUsers->Packages->PKG_A->PKG_A Body in the navigator.

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • "Read Only" open other schema's package body even have write permission

    Oracle SQL Developer 2.1 (2.1.0.63)
    I can view and modify package under my schema, but when I open other schema's package body, it show "Read Only" in status bar and can't type in code editor.
    I'm sure my connected user have write permission and it works fine in old sql developer version.
    Is there some toggle for "read only" view or some issue for new release?

    Not very helpful for you at the moment, but according to EA 2.1. Can't edit another users store procedures. this has been bugged and will hopefully get fixed soon.
    theFurryOne

  • Unable to access the objects with out schema as prefix.. can any body help

    Hi,
    i am using 10g.I have one problem like i unable to get the table access with out mention prefix for that table.
    but i created public synonym and gave all grants to all users also. but still i need to mention schema name as prefix otherwise it give the error..
    can any body tell me reason and give me solution.
    ex: owner:eiis table:eiis_wipstock
    connect to: egps schema
    in this position if i try with eiis.wipstock it gives error but if i mention like eiis.wiis_wipstock then its working fine.

    Pl do not spam the forums with duplicate posts - Unable to access the objects with out schema as prefix.. can any body help

  • SQL developer 3.1 in schema browser doesn't show package body

    Hi,
    When i search a package with schema browser, i can't see the package body of other owner, the menu "edit body" is disabled.
    My user as select any dictionary et select_catalog_role
    When i connect with a DBA's user, i can see all.
    I'am on windows with sqldev 3.1
    Thanks

    Hi erifet,
    This one seems to go back and forth. It was originally fixed in Schema Browser for 3.0. The "Edit Body" was greyed out, but an "Open Body" icon in the code editor toolbar for Package Spec was enabled. Here is the forum reference:
    30EA1 package bodies missing in schema browser still not fixed
    In 3.1, both "Edit Body" and "Open Body" are greyed out, and that applies both to Schema Browser and Connection Navigator for Other Users packages, so at least 3.1 is consistent. The difference between the Browser and the Navigator is Schema Browser has no option to display a Package Body type (must go through Package Spec type), while the Connection Navigator displays a Package Body node type in the tree beneath the Spec node. In the forum thread AM references, Vadim explains what 3.1 does: it uses the ALL_OBJECTS view, which apparently does not include package bodies. Off-hand I'm not sure why it does not include them, and the following link doesn't shed any light:
    http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_1001.htm
    Adding the execute privilege on the package does not help either. At least you have the workaround of using the Connection navigator to view the package body metadata (code) of Other Users if you have been granted either SELECT_CATALOG_ROLE or SELECT ANY DICTIONARY. As for returning to the 3.0 Schema Browser behavior, perhaps Vadim will notice your post and have some explanation as to why or why not that may be possible.
    Regards,
    Gary
    SQL Developer Team

  • Accessing database packages in a different schema

    This is frustrating me...
    I've created a forms 6 application under the username vimich.
    In order to access the tables using a different user name I simply created public synonyms for the tables.
    This process does not seem to work for packages in the vimich schema.
    How can I get around this?
    Thanks for your help.
    Lesley.

    Lesley;
    I'm not a fan of creating public synonyms. The technique for making your forms schema independent that I perfer is as follows. Your tables are in the vimich schema. So when you log into the database from Forms log in as the SYSTEM user (default password is MANAGER... hopefully you've changed it).
    SYSTEM is the default DBA and has privileges on all tables. When you use the Data Block Wizard to create your data blocks, the fact that you're not logged in as vimich will cause the wizard to preface all table names with vimich. in the SQL that it generates. Then anyone with priviledges on your tables can use the forms. I have not tried this with packages, but it might work.
    One thing to remember about this approach is that if you log in as vimich using the forms, they will work fine until you try to reference a sequence. Oracle does not like you to prefix your own sequences with schema. even though it has no problems with you prefixing your own tables.
    Best!

  • 3.1EA2 bug still not fixed - Members of package body not listed in the tree

    Hi, I was working today with SQL Developer again and found that this bug is still not fixed even when it was reported more than 1 year ago!!!
    I did a quick search and found it here
    Package Body Tree not always showing
    The problem is when you expand the package specification or package body tree, not all members of the specification/body are listed. This is mostly observable in the package body, but it regards to the specification as well.
    Consider this case:
    CREATE TABLE EMP (
        ID               NUMBER(6,0) DEFAULT 0,
        NAME             VARCHAR2(20 BYTE) DEFAULT NULL,
        DEPT             VARCHAR2(20 BYTE) DEFAULT NULL,
        FUNCTION         VARCHAR2(20 BYTE),
        PROCEDURE        VARCHAR2(20 BYTE));
    CREATE TABLE LOOP (
      AREA    VARCHAR2(5),
      VALUE   VARCHAR2(2));
    CREATE OR REPLACE PACKAGE Test_Package1 AS
    gvc_const CONSTANT VARCHAR2(10) := 'xxx';
    PROCEDURE Test(p_RC OUT NUMBER,
                   p_ID IN NUMBER);
    END Test_Package1;
    CREATE OR REPLACE PACKAGE BODY Test_Package1 AS
    PROCEDURE Test(p_RC OUT NUMBER,
                   p_ID IN NUMBER)
    IS
    BEGIN
      --INSERT INTO EMP (ID, NAME, DEPT, PROCEDURE) VALUES (1, 'Tina', 'xxx', 'xxx');
      --INSERT INTO EMP (ID, NAME, DEPT, FUNCTION) VALUES (2, 'Jeff', 'xxx', 'xxx');
      --INSERT INTO LOOP(AREA, VALUE) VALUES('a','b');
      NULL;
    END;
    END Test_Package1;Compile the package specification and the body. Expand the spec + body in the tree. Uncomment any of the commented lines in the package body and compile the body again. Now expand the package body again and look what is displayed.
    Why? It is because SQL Developer handles words "Function", "Procedure" and "Loop" as keywords and according to them does the parsing.
    Another case
    CREATE OR REPLACE PACKAGE Test_Package1 AS
    gvc_const CONSTANT VARCHAR2(10) := 'xxx';
    TYPE Loop_rec IS RECORD(
      item1   LOOP.AREA%TYPE);
    PROCEDURE Test(p_RC OUT NUMBER,
                   p_ID IN NUMBER);
    END Test_Package1;Compile just this specification and try to expand it in the tree. Again, during parsing the package, SQL Developer takes the word "LOOP" into consideration and fails to parse the specification.
    There is exactly the same problem when you declare functions from external dll libraries in package body. Since there is no "END;" in this case, SQL Developer's parser fails...
    To me it seems you simply blindly took some keywords like "FUNCTION" and expect there will be some "END;" keyword corresponding with it.
    Can anyone have a look at this and finally fix it?

    Hi,
    Thanks for trying out SQL Developer 3.1 EA2 and providing a clear, reproducible test case for this issue. I logged an internal bug for it:
    Bug 13438696 - 3.1EA2: FORUM: CERTAIN KEYWORDS IN PKG BODY BLOCK MEMBERS FROM CONN VIEW TREE
    It seems the bug noted in the other forum thread you reference has been fixed, but really had nothing to do with problems discussed either here or there. That fix involved adding an Edit Body... item to the Package context menu in the Schema Browser, not displaying Package members correctly in the Connection view tree.
    Regards,
    Gary
    SQL Developer Team

  • What is the GRANT or permission setting that allows viewing of package body

    For purposes of SOX and security/audit control, we log in under our network id's in our production environment. We have sourcecode compiled into Oracle seeded schemas ( APPS ) so that scheduled jobs are able to run with submitted from the Oracle Applications environment. We don't compile code into our personal network account areas.
    I know how to GRANT EXECUTE privs so that we can execute a package in another schema, but what I want to do is to be able to view the sourcecode in another schema. Compile into APPS but be able to see the package body from my network id schema account.
    I can't seem to find what the correct permission is anywhere. Granted I can look at DBA_SOURCE to get to it, but I want to use a tool like SQL Developer or TOAD to look at the code in a more presentable and easier to debug manner.
    Any help ?

    I guess you need GRANT DEBUG ON SCOTT.PKG TO U
    SYS@LSC01> create or replace package scott.pk is procedure p; end pk;
      2  /
    Package created.
    SYS@LSC01> create or replace package body scott.pk is procedure p is begin null; end; end pk;
      2  /
    Package body created.
    SYS@LSC01> grant create session to u identified by u;
    Grant succeeded.
    SYS@LSC01> grant execute on scott.pk to u;
    Grant succeeded.
    SYS@LSC01> connect u/u
    Connected.
    U@LSC01> select text from all_source where name='PK';
    TEXT
    package       pk is procedure p; end pk;
    U@LSC01> connect / as sysdba
    Connected.
    SYS@LSC01> grant debug on scott.pk to u;
    Grant succeeded.
    SYS@LSC01> connect u/u
    Connected.
    U@LSC01> select text from all_source where name='PK';
    TEXT
    package       pk is procedure p; end pk;
    package body       pk is procedure p is begin null; end; end pk;

Maybe you are looking for

  • How do I display font one character at a time?

    Right now the way I present my font is it all appears instanenous. I don't know if this is even possible or not, but I would like to find a way to have the font be displayed one character at a time over the course of a variable amount of seconds. For

  • Anyone using Mac Mini as a DAW with Logic?

    Hello Applers', I am currently using an imac as my DAW ith Logic Pro 9. I am wondering if anyone is using a mini with logic and how does it perform. The one thing that worries me is the 5400 RPM drive and I fear that the Solid State drive, even duale

  • Shockwave 11 Javascript API

    I'm seeking any information regarding the javascript API for Shockwave 11. Does it exist? Is there documentation? I've seen one example using a javascript to control the shockwave player created for 8.5 at famous3D website, but it appears to be broke

  • Transport routes  queries

    Hi , I have some doubt in transport route configuration for below structure, I develop a change in Dev 100 , once release the changes needs to move to Dev 200 and QAS 100 , once test completed in QAS 200 move to QAS 300( UAT client), tehn PRd 100 Dev

  • "The file "_" couldn't be opened because you don't have permission to view it." on Ipad.

    It happens whilest adding files from PC to Ipad (*.png) using Itunes... Is this solveable in any way?? Its driving me crazy! Oh, and it takes HOURS with Itunes! :/ (50mb)