Snapshots refresh from package from another scheme

*Also posted to Database:General!
Hi all,
i have a trouble while refreshing snapshots.
First, i have a scheme where a package (for snapshots
update) and snapshots themselves reside:
package snp_update
procedure update_snapshots
is
begin
for s_name in ( SELECT owner, name
FROM user_snapshots )
loop
dbms_snapshot.refresh (s_name.owner || '.' ||
s_name.name, 'CA');
end loop;
end;
end;
Second, i have a scheme where reside only synonym to
snp_update package (synonym name is syn_snp_update) and
this scheme have granted 'execute' privilege on snp_update.
But when i try to use it as
begin
syn_snp_update.update_snapshot;
end;
i have error: ORA-01031: insufficient privileges.
But when i execute this pl/sql block from package
owner's scheme - everything ok.
Oracle: 8.0.5 on Sun Solaris 2.5
Plz, help me.
Maksym.

How has your schema been granted the rights on SYN_SNP_UPDATE? A common cause of this problem is that the rights have been granted to a role. Oracle does not allow you to build procedures, etc using objects that you have been granted through a role. If this is the case you'll have to grant EXECUTE on SYN_SNP_UPDATE to your schema explicitly.
Cheers, APCThrough
grant execute on snp_update <synonym's owner schema>;
BTW: Package's procedure is executing. Cursor (select ... from user_snapshots) retrieves first snapshot info in package's scheme and call to dbms_snapshot.refresh generates error.

Similar Messages

  • Create package in another schema (10gR2)

    Hi there,
    I'm trying to create a package in another schema, but I am getting an error when I do this.
    My script is as follow:
    i log in as user rwn.
    create or replace package mkw.test
    as
    procedure t;
    end mkw.test;
    create or replace package body mkw.test
    as
    procedure t as
    begin
    ..... code
    end;
    end mkw.test;
    I get the error: PLS-00103: Symbool "." aangetroffen terwijl een van de volgende
    werd verwacht:
    What am I doing wrong?
    Thanks in advance.

    user10674103 wrote:
    Hi there,
    I'm trying to create a package in another schema, but I am getting an error when I do this.
    My script is as follow:
    i log in as user rwn.
    create or replace package mkw.test
    as
    procedure t;
    end mkw.test;
    create or replace package body mkw.test
    as
    procedure t as
    begin
    ..... code
    end;
    end mkw.test;
    I get the error: PLS-00103: Symbool "." aangetroffen terwijl een van de volgende
    werd verwacht:
    What am I doing wrong?
    Thanks in advance.Assuming you have permission to create packages in the other schema?
    Are you running this through SQL*Plus? If so, you really need to have "/" terminators after each object you are creating...
    e.g.
    create or replace package mkw.test
    as
      procedure t;
    end mkw.test;
    create or replace package body mkw.test
    as
      procedure t as
      begin
       ..... code
      end;
    end mkw.test;
    /

  • Grant permission to all packages in another schema

    Is there a way I can grant access to all the packages in another user's schema?
    Please guide me.
    Thanks!

    The one way is to use cursor :
    BEGIN
      FOR Rec IN (SELECT object_name, object_type FROM all_objects WHERE owner='SOURCEUSER' AND object_type IN ('PACKAGE')) LOOP
          EXECUTE IMMEDIATE 'GRANT EXECUTE ON SOURCEUSER.'||Rec.object_name||' TO TARGETUSER';
        END IF;
      END LOOP;
    END;Edited by: Radrigez on 13.07.2011 21:38

  • Call a Package in another schema  from a Trigger?

    Is there a method to call a package procedure from a trigger when the package exists within a different schema than the trigger (table)?
    Do you need a dblink to execute a procedure in a different schema within the same database?

    Hello,
    you need execute prvilege given to target schema on source package and you can create synonym in target schema as well. And you don't need dblink if the procedure resides in same schema or different schema in same database
    CREATE OR REPLACE TRIGGER myschema.test_trg
       BEFORE INSERT OR DELETE OR UPDATE
       ON test_table
       REFERENCING NEW AS new OLD AS old
       FOR EACH ROW
    DECLARE
    BEGIN
       -- How to pass parameters
       otherschema.mypkg.myproc (:new.id, :new.code);
    END;
    /Regards

  • How to move functions and procedures from packages into a schema?

    Hello,
    I have below requirements for a homework and my question is if someone can point me in the right direction to find documentation which can help me solve the below. Any information will be very much appreciated. Thank you.
    Write procedures and functions (included or not in packages)under the form scripts  .txt or .sql . Once they have been launched in SQL developer they should more the functions and the procedures from the packages in the current schema. If the current schema contains only 2 packages, pac1( with procedures p11,p12 and the functions f11,f12,f13) and pac2( contains the following procedures p21,p22,p23 and the functions f21 and f21( overloading cases), the execution of the scripts will generate the following effects:
    The procedures p11,p12,p21,p22 ,p23 and the functions f11,f12 and f13 will be created in the current schema.
    pac2 will contain 2 instances of the overloading function- f21; they will be kept in the package, without being created in the current schema; so all the procedures/functions overloaded will be kept in the original packages
    If pac1 contains variables, cursors and public types, we will keep only the package specifics( and delete the body);generally if the packages do not contain procedures or functions overloaded the body will be deleted and if no variables, cursors, public types then we will delete the header.
    If in the triggers, procedures, functions  we will call procedures/functions from the packages(the procedures and the functions moved in the current schema) they reference will need to be updated ( via amending the body or recompile) for example if pa1.p12 will need to be replaced with p12.
    The scripts will have to have numbers in the following series( 01....n) and characters that explain the content.

    My only advice would be to remember that these are public forums and if YOU can find them, so can your instructors.
    Also, those are horrible procedure and function names
    This assignment seems to be around overloading pl/sql objects and order of precedence...do a search on the Oracle Docs around overloading and inheritence
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28371/adobjplsql.htm#i21148

  • How to create table from one to another schema?

    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,

    user2017273 wrote:
    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,When you give CREATE ANY TABLE TO A then user A will create table on any schema.But you can create stored PROCEDURE on schema B for creating table and give GRANT EXECUTE <PROC NAME> to A.

  • Sql Developer - View source code of procedures, functions & packages in another schema

    Our developers need the ability to view procedures, function, packages etc. in the production database (using SQL DEVELOPER).  They don't have access to sign on as the owner of these
    objects in Production.  They must use their own limited access UserID for this purpose.
    This limited access UserID has been granted select privilege on DBA_SOURCE & DBA_OBJECTS.  The developers need the ability to view the source of these object via
    the tree view in SQL DEV.  They should be able to click on "other users" in the SQL DEV tree view and see a listing of the owner schema objects.  Then they should
    be able to select the desired object and view the source code.  These developers are used to using GUI interfaces.  Selecting from DBA_SOURCE would not be an
    option for them.
    I understand that if the limited user is granted SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE then this functionality will work.  The problem is those
    privileges/roles  provide much more access than should be granted to these limited access users. Granting DBA to these users is also not an option.
    In TOAD and other end-user tools this functionality works when only select privilege on DBA_SOURCE & DBA_OBJECTS has been granted.  We need this same functionality
    in SQL DEV.
    While searching this forum and the internet, I see that other installations have this same issue.
    Please enhance SQL Developer with this functionality. 
    Thank you, ellen

    Just to double check that I'm interpreting the problem correctly, is the following true:
    select * from all_objects where object_name = 'DBA_SOURCE'
    returns nothing
    select * from dba_source where name = your PL/SQL module
    returns all the code

  • How do I view package bodies in another schema ?

    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 did some more searching on the forum... seems its already a request... TOAD gives access to DBA_Views to resolve the issue... SQL Developer has not integrated that functionality yet, but forum entries seem to indicate that it is on the horizon.
    Thanks for responding though.
    ~Barry

  • 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

  • Cannt execute stored proc of one schema in another schema from java app.

    I am posting my problem in this forum as i i though it could be server-independent.
    I am working on apache tomcat and spring framework with Oracle db (schema/user A)
    We access oracle db from our java application by setting jndi and works fine.We have sqlstatements, stored procs and functions all run fine.
    Now we create a role (DBROLE) with all permissions to that original db schema/user(A) . We created another empty schema B and assigned that role(DBROLE) to that user B.
    (We grant all kind of permissions on tables/packages of schema A to user role DBROLE and also created synonyms)
    Intentions are: to access the schema A though schema B from application and avoiding direct access.
    In our spring application, we replaced database-settings with schema B.
    Things work fine: When its plain SQL statement is run from Java code but Stored proc wont run and we get
    'Wrong num of arguments/data types' error.
    Also all stored procs are in packages.To execute stored proc in java code, we use SimpleJdbcCall.
    I also checked run stored proc from schema B and its works. Only from web app, it doesnt work.
    Please suggest,what should be done to make this working or if there is other alternative.
    Thanks

    Instead of importing a scema in another schema specifiy the schemas in the external-schemaLocation property.
    SAXParser saxParser = new SAXParser();
    saxParser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", "xmlschema1.xsd, xmlschema2.xsd");

  • Constraints From another schema

    Hi Guys,
    I have a table referral_contacts which has a column customer_id.This col is coming from a synonym whose base table is in another schema.
    So the current requirement is to establish the referential constratint from that table .I think there is no way to add constraint from a synonym whose base table is in another schema.Is there any method to achieve this without crating the same table .
    Any suggestions,coments are highly appreciated.
    Thanks,
    Prafulla

    Hi Prafulla
    It will be very tough for maintenance in long term if you create cross-reference constraints across schemas. That won't be a good design unless the same application owns both schemas. If each schema is used by different application and that only the second schema is populated with data realtime which is needed by the other application then you can create a new table and refresh it from the other schema in real time as well. You can check Materialized views (fast refresh, incremental refresh, using rowid, etc) for this purpose or you can also look at various other options (using trigger on the second schema to populate the new table in your schema and keep this in sync with that).
    Just for your information, Materialized views is a feature of EE. Tell us more about your environment

  • I load a package into SYS schema but cant resolve references made from a different sc

    I loaded javamail-1.2 (and associated dependencies) into the SYS schema, just because it has classes under the same package root "javax".
    If I try to load a second class having an import like "javax.mail.*" into a schema other than SYS, I get a message "can't find xxx".
    How can I make the SYS new classes visible to a different schema?
    Thanks for any help.

    1) A WHEN OTHERS exception handler that does not re-raise an exception is almost certainly an error. In your case, you are writing the error message out via DBMS_OUTPUT, but unless your front end happens to try to read and display the DBMS_OUTPUT buffer, the error will be ignored. You realistically want to remove that exception handler.
    2) Creating an index will not raise a NO_DATA_FOUND if there is no data in the table, so that exception handler is superfluous.Thank you very much, now that I removed that Exception it is telling me insufficient rights.
    3) If you want User A to be able to create an index in User B's schema, User A would need to be granted the CREATE ANY INDEX privilege (directly, not via a role). If you are getting a permissions error creating the index after removing the incorrect exception handlers, that is likely the problem. If you are getting a permissions error dropping the index after removing the incorrect exception handlers, you would need to ensure that User A has been granted the DROP ANY INDEX privilege.I thought that since I had specifically granted the INDEX privledge to SchemaA on a specific table in SchemaB that Schema A would be able to drop and create indexes on that specific table. However.. having just looked again at the documentation it would seem that I would need to be able to do exactly as you say and have the ANY to be able to create it in another schema.
    4) Since the various ANY privileges (CREATE ANY INDEX, DROP ANY INDEX, etc) are rather powerful and not restricted to a particular schema, is there a logical reason not to put this code in Schema B to begin with?Nothing in particular other than attempting to keep it all with the "parent" schema so that the select into's are run from the parent and populate the child (schemab). I guess I can have Schema A call the package in schema B and execute it however will that execute as Schema A or B?
    Thanks for such a fast and detailed response

  • Problem while executing my package from a different schema

    Hi,
    I developed a package.
    Now when i try to execute my package( which is in Schema1) from a different schema(Sc2) in the same database(9.2.0.1)
    i.e. execute <Sc1>.<package_name.Package_main_proc>;
    I'm able to execute the package successfully.. but .. my package is deleting all records in all the tables used by the package !!
    If I run the same package from my schema(Sc1).. everything is working fine.
    i.e. its deleted only unwanted records after executing the whole package.
    Can anyone pls help me.
    Regards
    Jack

    Guido,
    I'm sorry for asking a really vague question.
    I included all the dbms_output.put_line() in my code. As i executed in my schema. I couldnt find any error.
    So now, instead of calling my package from Sc1.
    I compiled my package in Sc2( I dint get any errors) and then executed it.
    Even now data is deleted from the tables.
    So now i tried thru another schema(SC3)..
    again compiled it and executed it.. now everything is working fine.
    So to my understanding i just there is some dependency is Schema 2. But i'm not able to figure it out as i'm not getting any error.
    Am i going is right direction. If not please correct me .
    Thanks

  • Calling package from another package

    Hi gurus,
    Quick question
    Say i m in user1 schema.
    I want to call package from another package in the same schema. So do i need to grant permission to the calling package to call.Thank you!!

    Why don't you test it?
    create or replace package pack2
    is
      procedure t2;
    end;
    Package created.
    create or replace package body pack2
    is
      procedure t2
      is
      begin
       dbms_output.put_line('Inside Pack2 And t2');
      end;
    end;
    Package Body created.
    create or replace package pack1
    is
      procedure t1;
    end;
    Package created.
    create or replace package body pack1
    is
      procedure t1
      is
      begin
        pack2.t2;
        dbms_output.put_line('Inside Pack1 And t1');
      end;
    end;
    Package Body created.
    begin
    pack1.t1;
    end;
    Inside Pack2 And t2
    Inside Pack1 And t1
    Statement processed.
    0.11 secondsRegards.
    Satyaki De

  • How do I move a table from one schema to another schema on Oracle XE?

    How do I move a table from one schema to another schema on Oracle XE?

    Hi,
    I tried to use the insert/select statement that you had given, it did not work.
    The error is ORA-00913: too many values.
    But finally what I did was, I went into the system schema where the table was and generated the DDL through the utilities and afterwards I imported them into the schema that I am currently working on. It solved the problem!
    However I am still curious to know why the insert/select statement did not work? Do you know any site/tutorial which gives a real time example?
    Thank you
    Skye

Maybe you are looking for

  • Conncting my PB 12' to a TV

    I am trying to connect my pb to my tv through the mini-dvi to Video Adapter, but the display preferences don't give NTSC/PAL Display (like they should) but rather, VGA Display. What's wrong? I'd appreciate if someone help me Thanx

  • Something wrong with nm-applet

    I can not edit system connections, can not make system connections. Can not connect to any of user connections, including vpn. Error: "No user settings service available". It happened after today kernel upgrade. But reverting to previous kernel foes

  • Kernel Upgrade

    Hi Gurus, I have questions regarding kernel upgarade. I have downloaded db dependent and independent .sar files and put it in new folder outside the directory usr/sap/SID/sys/exe/uc. Now my questions: 1. Is it ok to uncar .sar files in my own directo

  • Dynamic VLAN assignment on SG300

    Cisco documentation states that dynamic vlan assignment via RADIUS should provide the following IETF values: The RADIUS user attributes used for the VLAN ID assignment are: IETF 64 (Tunnel Type)-Set this to VLAN. IETF 65 (Tunnel Medium Type)-Set this

  • Postings to Non Leading Ledger

    Hi, My client requires 3 different non leading ledgers for management reoporting & stauatory reporting along with the leading ledger. For that i have created 1L,2L & 3L as non leading ledger in the system. Now the purpose of different ledgers is to p