Problem in compiling procedure from another schema
Hi all
I have got 2 schemas, say A and B.
Schema A owns a procedure P which selects data from table T1 ( external table ) and updates table T2.
i have granted Schema B
1) read, write privilege on the directory that table T1 refrences.
2) all on table T1
3) all on table T2
4) execute on P
I have created public synonyms for T1, T2 and P ( same name ).
Now when i try to compile procedure P from schema B I get error
ORA-01031: insufficient privileges
Where am i wrong?
Please Help
You'll need CREATE ANY PROCEDURE privilege for that.
Is there any reason why you don't post the one thing on which you are asking about : the alter procedure statement?
(apart from also not posting the version, which you always should include)
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
EXECUTE IMMEDIATE Procedure from another schema
When running this procedure... I get an error ORA-00900.
Does someone kwow the problem? Can we launch procdeure in EXECUTE IMMEDIATE?
DECLARE
jobname VARCHAR2(10) := 'test';
datedebut DATE := SYSDATE;
statut VARCHAR2(10) := 'En cours';
BEGIN
EXECUTE IMMEDIATE 'WEXPSTAGN_DEVL.bicstg_standard.ins_log_job('''||jobname||''',
'''||statut ||''',
'||datedebut ||')';
END;
Edited by: 995370 on 2013-03-21 07:58995370 wrote:
When running this procedure... I get an error ORA-00900.
Does someone kwow the problem? Can we launch procdeure in EXECUTE IMMEDIATE?
DECLARE
jobname VARCHAR2(10) := 'test';
datedebut DATE := SYSDATE;
statut VARCHAR2(10) := 'En cours';
BEGIN
EXECUTE IMMEDIATE 'WEXPSTAGN_DEVL.bicstg_standard.ins_log_job('''||jobname||''',
'''||statut ||''',
'||datedebut ||')';
END;
Edited by: 995370 on 2013-03-21 07:58You just want to do...
DECLARE
jobname VARCHAR2(10) := 'test';
datedebut DATE := SYSDATE;
statut VARCHAR2(10) := 'En cours';
BEGIN
WEXPSTAGN_DEVL.bicstg_standard.ins_log_job(jobname,statut,datedebut);
END;No need for execute immediate (and you were using it wrongly anyway) -
Calling PL/SQL Procedure In Another Schema Gives Unexpected Result
I have a SQL Script that does this:
conn pnr/<password for user pnr>;
set serveroutput on;
exec vms.disable_all_fk_constraints;
SELECT owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R';
and the disable_all_fk_constraints procedure that is owned by user 'vms' is defined as:
create or replace
procedure disable_all_fk_constraints is
v_sql VARCHAR2(4000);
begin
dbms_output.put_line('Disabling all referential integrity constraints.');
for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type='R') loop
dbms_output.put_line('Disabling constraint ' || rec.constraint_name || ' from ' || rec.table_name || '.');
v_sql := 'ALTER TABLE ' || rec.table_name || ' DISABLE CONSTRAINT ' || rec.constraint_name;
execute immediate(v_sql);
end loop;
end;
When I run the SQL script, the call to vms.disable_all_fk_constraints disables the FK constrains in the 'vms' schema, whereas I wanted it to disable the FK constraints in the 'pnr' schema (the invoker of the procedure). I know that I could make this work by copying the disable_all_fk_constraints procedure to the 'pnr' schema and calling it as "+exec disable_all_fk_constraints;+" from within the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.
What can I do?
Thank youYou have two issues to solve.
First you need to write a packaged procedure that works with INVOKER rights. The default is DEFINER rights.
The difference is excatly what you need. Usually the package has the rights from the schema where it is defined (=Definer rights). In your case schema VMS. Whereas you need the privileges from the user that calls the package (PNR).
=> Check out the documentation for INVOKER rights
The second problem is that the view "user_constraints" will not give the results you expect when called from inside a procedure in another schema. An alternative could be to use the view DBA_CONSTRAINTS with a filter on the owner (where owner = 'PNR'). Not sure if there are other working possibilities. Well you could create a list of constraint names that you want to disable, instead of creating the list dynamically.
And you could have another potential disaster creeping up upon you. If you run this thing, then at this moment you don't have any referential integrity anymore. You can't be sure that you can create the FKs again after this action. This is EXTREMLY DANGEROUS. I would never ever do this in any kind of production or test database. I would be very careful when I do it on a development database. -
Grant to let user just see a procedure from another user!
Hi,
Is there a GRANT to let a user see a procedure from another user but not compile it?
Tks,
Paulo.The problem is that is not just one procedure, but more then 30 and a lot of developments want this privilege.
Tks,
Paulo
ps: can you help me on my other post "ALTER TABLESPACE tbs READ ONLY" --hang -
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,
MahiFirst 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 -
Exec stored procedure from another stored procedure - not working
Hey, we've got a bunch of .sql files that we run, and some of them are stored procedures. Our programs call the stored procedures from within the .sql files and that works, but we've tried calling a stored procedure from another stored procedure and it won't compile. The syntax looks the same, and we can run that second stored procedure from the SQL*Plus command prompt just fine, so we know it's in there. It doesn't matter whether we type exec or execute in the first stored procedure--it still gives us a compilation error. Here's the relevant bit of the code:
delete CMHISTORYINDEX;
commit;
exec SP_DAILY_TOTAL;
END SP_DAILY_CLOSING;
/Here's where we go into SQL*Plus and try to compile it:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> @sp_daily_closing.sql
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE SP_DAILY_CLOSING:
LINE/COL ERROR
34/7 PLS-00103: Encountered the symbol "SP_DAILY_TOTAL" when expecting
one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "SP_DAILY_TOTAL" to continue.
SQL>We've also tried changing SP_DAILY_CLOSING to lowercase, but it doesn't seem to help. As I mentioned before, we can type that same sort of thing in .sql files that are not stored procedures and the exec is compiled fine and runs correctly. What are we doing wrong?In the stored procedure remove "exec" :
delete CMHISTORYINDEX;
commit;
SP_DAILY_TOTAL;
END SP_DAILY_CLOSING; -
Selection from Another schema by default without schema name qualifier.
Hi
Oracle10g release 2, LinuxOS
i want my schema (User_1) to always select,insert, update, delete the objects from another schema (User_2) without passing full schema qualifier every time whenever i don't pass any schema name explicitly.
i.e. if i pass the following guerry
select * from table_a;
the table of user User_2.table_a (User_2.table_a) will be queried by default instead of table (User_1.table_a)
and the same implementation is also required in Functions , procedures, sequences etc.
WishesThree relatively easy options
1) Create private synonyms in User_1's schema for each object in User_2's schema, i.e.
CREATE SYNONYM table_a
FOR user_2.table_a2) Create public synonyms for each object in User_2's schema. This will make it possible for all users to query user_2's objects without specifying the schema name
CREATE PUBLIC SYNONYM table_a
FOR user_2.table_a3) Change the current schema for the session (potentially in a login trigger)
ALTER SESSION SET current_schema = USER_2There are other options that are a bit more complicated like using enterprise users with shared schemas. But most people are perfectly happy with one of these three.
Justin -
Call procedure from another procedure
Hi All,
I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .
thanksuser13424229 wrote:
I have a requirement to call a procedure from another procedure and don't want to return to the main procedure again.please suggest me how to achive this .A very strange requirement.. that perhaps you should expand on in order to get proper technical input and advice from forum members.
Assuming a valid requirement, it should be implemented in the following way:
SQL> create or replace procedure ProcB is
2 begin
3 DBMS_OUTPUT.put_line( 'ProcB(): executing...' );
4 end;
5 /
Procedure created.
SQL>
SQL>
SQL>
SQL> create or replace procedure ProcA is
2 E_CEASE_PROCESSING exception;
3 pragma exception_init(E_CEASE_PROCESSING, -20000 );
4 begin
5 DBMS_OUTPUT.put_line( 'ProcA(): executing...' );
6 DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 1...' );
7 raise E_CEASE_PROCESSING; --// typically a conditional instruction
8 DBMS_OUTPUT.put_line( 'ProcA(): doing stuff 2...' );
9
10 exception when E_CEASE_PROCESSING then
11 ProcB;
12 end;
13 /
Procedure created.
SQL>
SQL>
SQL> exec ProcA
ProcA(): executing...
ProcA(): doing stuff 1...
ProcB(): executing...
PL/SQL procedure successfully completed.
SQL> -
Cant view objects from another schemas
Hi everybody!
I have a 10.1.2 Jdeveloper and a 9.2.4 Oracle database.
I successfully created a database connection.
With provided login I can access to tables from another schemas in SQL Worksheet, but I cant see any objects from those schemas in the connection tree.
What's wrong?The Schemas are being filtered so that you only automatically see the schema for the connection that you logged on with. To change the schemas that are visible you need to :
1) Select the connection name in the Navigator (you should see that it has a filter icon overlaid showing that it is being filtered)
2) Invoke the context menu and select 'Apply filters'
3) Shuttle over the other Schemas you wish to see and press OK
Regards,
Lisa Sherriff
JDev QA -
If I want to select table from another schema, I have to type
select * from [username].table_name.
What can I do inorder not to write shema name all the time.
for instance:
instead of writing
select * from [username].table_name.
select * from table_name.create synonym for the object in other schema:
create synonym <syn-name> for schema.tablename;
then use syn-name in place of schema.tablename in ur query
like
select * from syn-name; -
SQL Report From Another Schema
Is there anyway to select a table from another schema?I have a default schema for my application but i want each user to use their own schema.
I'm looking for something like #OWNER#.table_name but replacing #OWNER# with the name of another schema in the workspace.
Kind Regards,
BgUrsea
APEX 4.0 10g XEHello BgUrsea,
you could achieve this by granting the needed privileges (e.g. select, insert, update, delete) on each table in the #OWNER#-schema to your applications parsing schema.
If you can't use a direct mapping (e.g., you can't assign the schema name of a user as usernames for his application user), you probably need a mapping table in your parsing schema. Define an application item (e.g. "F_OWNER") and create a application computation that executes "On New Instance" and does something like
SELECT schema
FROM mapping_table
WHERE owner=v('APP_USER');If you aren't sure you always have a mapping, you might think about an application process that not only computes the value but also handles the action to be performed in case there is no mapping for a user.
But I suppose it could be easier to have a copy of you application for each user and assign the appropriate schema to each copy. That way, you don't need the mapping, you don't need to care about always using the #OWNER# when developing your application, and of course, no user can (not even accidently) access another users (or your default) schema.
-Udo -
Problem with creating site from another computer!
Hi
I have WebDB 2.2 and Oracle8i instaled on the same computer. I have a problem to create site from another computer. There is not any process when I try to create site. There is always 0%.
But I have no problem with creating site on the origin computer.
Does anybody know something about it?I am just not clear what to do once I have made changes and have published the new information.
You shouldn't have to do anything. iWeb will save the information in the Domain.sites file. You can keep this file in a folder, or even on your desktop and iWeb will launch from a double-click on the file. -
Create stored procedure with table from another schema throws PLS-00201
Oracle 10g. I'm new to procedures, so maybe I'm missing something obvious.
Schema owner ABC has table T2001_WRITEOFF. The SYSDBAs granted SIUD to Some_Update_Role, and granted that role to developer user IJK. User IJK then created a private synonym T2001_WRITEOFF for ABC.T2001_WRITEOFF. This worked with normal SQL DML commands.
When I try to create a simple procedure as follows, it throws PLS-00201 identifier 'T2001_WRITEOFF' must be declared, and points to the 2nd line.
create or replace procedure woof1(
fooname in T2001_WRITEOFF.territory%TYPE, <=== error points here
bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
BEGIN
INSERT into T2001_WRITEOFF
VALUES ( fooname, bardesc);
END woof1;
What am I doing wrong?
Thanks
JimRHi,
The reason I've heard has to do with knowing when a procedure becomes invalid due to privileges being revoked. Any time a grant to a role is revoked, you would have to check all procedures that depended on that role to know if they were still valid. Even worse, since roles can be granted to other roles, every time a role is revoked from another role, you would have to check all procedures that depended on anything to see if they were still valid.
Oracle 11 behaves the same as earlier versions in this regard, and I don't expect this to change.
This whole thread applies only to AUTHID DEFINER stored procedures (which is the default). If you can make the procedure AUTHID CURRENT_USER, then you can run it with privileges granted through roles. Usually, however, you really want AUTHID DEFINER, and granting the necessary privileges directly to the procedure owner (or to PUBLIC) isn't too hard. -
How to use type, packages, functions, and procedures in another schema ?
I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
If I cannot use synonym for this issue, is there another way to solve the problem?Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
Mike -
Query in Stored Procedure accessing another schema
Hi - this is going to sound kind of strange and even i can't come up with an explanation. My JDK 1.1.7 applet uses a type 4 JDBC thin driver (i think v 8.04.06) to access an Oracle 7.3.4 database. We also have a link with full grants and synonymns to another Oracle schema in an Oracle 8 database. Has never been a problem - we can access anything we need to through queries or stored procedures from either of these databases.
So, i have a new stored procedure that needs to be called through JDBC that queries a table in the Oracle 8 database. For some reason, whenever i execute this stored procedure from java it hangs on this query and the instance needs to be restarted. If i execute that same stored procedure from SQL Plus, it runs fine.
I tried a little test. I put a straight query in my java code that goes directly to that table (no stored procedure involved). It runs great through java!
is this weird or what? my dbas have checked out all privelages and it seems that i have access to everything i could possibly need.
If anyone has any suggestions i would love to hear them.
thanks for your help...
Lori - [email protected]
nullYou can only access an object in another user's schema if you either:
(a) Specify the 'other' schema name explicitly: SCHEMA.OBJECT
(b) A synonymn has been created to access the object: CREATE SYNONYM OBJECT FOR SCHEMA.OBJECT.
The user requiring the synonym should create it, or the user owning the object can create a PUBLIC synonym, if they have the authority.
To check my hypothesis, try typing 'DESCRIBE procedure_name' from SQL*Plus as both users.
Maybe you are looking for
-
It was fine yesterday, this morning got up to do what I usally do, Shut down on me Called Apple 3 times followed thier instructions (Wifi Troubleshhot and Connectivity) EVERYTHING now its garbage! I know I can get a protection plan but my mom said th
-
Constant system overload errors
Since yesterday I can't play any project anymore. When I hit play the projects plays for two seconds, slows down and a system overload error pops up saying 'system overload or disk too slow'. Logic crashes after that. Nothing on my system has changed
-
Unable to update WADAT_IST in Outbound Delivery via iDoc WHSCON (DELVRY03)
Processing iDoc WHSCON (DELVRY03) to update an Outbound Delivery and post Goods Issue, the field ACTUAL GI DATE (WADAT_IST) is not updated. I am using segment E1EDT13 of iDoc WHSCON to inform dates. Can anyone tell me if there is any other segment, f
-
Hi, Can you tell me how to make or use (may be a library ) a listener that can response if an incoming sms received. Thanks.
-
Adding a domain controller to an existing Domain inside server 2012
I have created a domain contoso.com with an administrator account.Then i moved to 2nd server which i want to add in this existing domain.Being logged in at the 2nd server with administrator account, i added the role of ADDS and then i tried to promo