Reg:-grant to the procedure.
Hi friends,I want to give Executre grant to the other diagram how to give...
Example:-Package stored in Schema1
But I want to run this package through schema to.
Pls help.
Kind regards
Aude
grant execute on PROCEDURE to SCHEMA;
Make sure you have either a synonym for the procedure or it is referenced using the procedures scheme
for example, MySchema.myprocedure
Tags: Database
Similar Questions
-
Create the privilege granted procedure, but cannot create the procedure
I have a user that I have given the following privileges:
CREATE THE SESION
SELECT ANY TABLE
CREATE A PROCEDURE
CREATE PROCEDURE
RUN THE PROGRAM
RUN THE PROCEDURE
But when I try to create a procedure with this user I get, error proveleges not enough. What I am doing wrong?What's wrong? You open the doors of barn proverbial ito security. This isn't how security should be made - allowing a schema create any code of procedure anywhere in the database. Or select data from any table.
How do you think that Sony's PS network has been hacked and millions of stolen credit card data users?
By this precarious type of stuff-security approach to security.
A schema has the minimum privileges in order to achieve its goals and its requirements. Nothing more.
For example
// standard logical database schema, 10Gb space allocation create user HRDB identified by
default tablespace USERS quota 10G on USERS; // configure the basic security layer for the schema grant create session, --// allow client-server connections to schema create table, create trigger, --// allow to create standard db objects create sequence, create view, --// allow access to defining extended objects create procedure --// allow creating stored proc code to HRDB; In addition, you can decide on assign a profile of resources and specific roles and so on. In some cases, you can also leave the schema create types, synonyms and private database links, views materialized, etc.
Don't grant access. No access to the SYS code and objects. By default. Everything else is a security exception requiring a valid justification.
-
GRANT IN THE STORED DATABASE PROCEDURE
Can I use GRANT IN STORED PROCEDURE in DATABASE?
I got an error so I try this code
MATT PROCEDURE (FROMUSER Varchar2, VARCHAR2 TOUSER, PCOL VARCHAR2) IS
MTab CURSOR IS
Select TABLE_NAME from SYS. DBA_TAB_COLUMNS where OWNER = FROMUSER AND COLUMN_NAME = PCOL;
TYPE MTab_Type IS Table of MTab % RowType Directory Index;
MTable MTab_Type;
MSql Varchar2 (4000);
BEGIN
MTab open;
Loop
MTab FETCH BULK COLLECT IN MTable LIMIT 10000;
When the exit MTab % NOTFOUND;
End loop;
For i in 1.MTable.Count loop
MSQL: = 'start' |
"GRANT SELECT, UPDATE, INSERT, DELETE ON ' | '. FROMUSER |'. ' || MTable (i). Table_Name | » À ' || TOUSER | « ; » ||
"End;";
RUN IMMEDIATELY MSQL;
End loop;
END;
Error is
ERROR on line 1:
ORA-06550: line 1, column 8:
PLS-00103: encountered the symbol "GRANT" when expected in the following way:
begin case declare exit for goto if loop mod null pragma
raise return select update while < ID >
< between double quote delimited identifiers of > < a variable binding > < <
Close current delete fetch locking insert open rollback
SAVEPOINT SQLExecute set pipe fusion commit forall
ORA-06512: at the 'TEMP '. MATT", line 18
ORA-06512: at line 1
Can someone please help me?
Thank you
AmraniAhamed Rafeeque wrote:
PLS-00103: encountered the symbol "GRANT" when expected in the following way:GRANT is the DOF and cannot be run PL/SQL (dynamic or not). Change:
Msql:= 'Begin '|| ' GRANT SELECT, UPDATE, INSERT, DELETE ON '||FROMUSER||'.'||MTable(i).Table_Name||' TO '||TOUSER||';'|| 'End;';
TO
Msql:= 'GRANT SELECT, UPDATE, INSERT, DELETE ON '||FROMUSER||'.'||MTable(i).Table_Name||' TO '||TOUSER;
SY.
-
ORA-06508, procedure cannot call the procedure of package
I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not. (It checks authorization of the student to enroll in a class). We have a web process calling the stored procedure, and that works fine. What does not work, is a call to the package. Oracle returned ORA-06508: PL? SQL: could not find program unit called.
I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508. Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package. (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).
When I log in the user account with sqlplus and run a test, everything works fine. But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.
It seems as if the web process runs with the rights of the appellant, or a role is not granted.
Can someone help me understand what the problem is?
offered hv, I appreciate your comments.
We solved the problem: remove the package that couldn't be cited, then re-create. That's all!
Apparently, something in the database was tangled upward. The server recently had problems with disk space, then it might have been related to that. But we'll never know for sure.
The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant. But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.
I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.
Finally let it drop and then re-create the package, it's which solved the problem.
Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle. Thanks for all the tips and suggestions.
-
insufficient privileges when you create sequence using the procedure
CREATE OR REPLACE PROCEDURE schema1.proc1 AS BEGIN EXECUTE IMMEDIATE 'DROP SEQUENCE schema1.add_ins_seq'; EXECUTE IMMEDIATE 'CREATE SEQUENCE schema1.add_ins_seq MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 1000 NOORDER NOCYCLE'; END;
This procedure is created to schema1 by schema1.
Schema1 boasts a CREATE SEQUENCE privilege.
When I run this procedure through SQL Developer after the Cup to schema1, the error is thrown in insufficient privilege to CREATE SEQUENCE, however, DROP SEQUENCE is executed. I can create the sequence without the procedure call.
If I add AUTHID CURRENT_USER so I don't get the error of insufficient privileges.
Why it gives this error when the owner and the applicant of the procedure is schema1?
Hello
1st thing to know: when a procedure is defined (and updated), any privileges granted through ROLE is not taken into account. This is because these privileges can be active or not at the level of the session (as happens if for example a user has active 'role A' in session 1 but not in session 2 and if this role has been used to define a procedure?) The proecedure must at the same time be VALID in session 1 and INVALID session 2? Is not possible.
Thus, for instance in a situation of 'standard': user SYSTEM has 'DBA Rôle', so you can for example make a sqlplus session "SELECT * v $ instance;", but you would write a procedure owned by system making instance_name SELECT INTO l_variable OF v$ instance; "then"surprise": the procedure cannot be compiled because of the ORA-904 Table or view does not exist..." To be able to create the procedure, a DSS system needs to be done.
2nd thing for your special case, a little more complex: default for a procedure is 'AUTHID DEFINE', but once more: it means "privileges of the author creating the procedure", so without taking into account the acquired privileges through roles... Your user name is 'sequence create' through a role, it cannot use the privilege within the procedure. But... but when you define the procedure with AUTHID CURRENT_USER, privileges are evaluated at run time, and thanks to the active ROLE in the session by calling the procedure, at this time, the user can create the sequence. If try again you but with 'The VALUE NONE ROLE' in the session before the call, you will again have the question.
Conclusion: If you need to do the action, you must grant the user the necessary privilege directly.
Best regards
Bruno Vroman.
-
Problem with the procedure. Help, please
Schema: HR
Here is the procedure I created, when I compile the procedure it works very well and without errors or warnings are displayed. However, when I run, I get "01031. 00000 - "insufficient privileges" "error. "I tried 'GRANT ALL HR', 'ANY GRANT to HR'.," to HR WITH ADMIN OPTION GRANT ' nothing works. Not sure is code that has questions or privileges.
create or replace procedure new_create_PROC IS BEGIN EXECUTE IMMEDIATE 'CREATE TABLE NEW_CREATE1(EMP_ID NUMBER,EMP_NAME VARCHAR2(20))'; END; / EXECUTE new_create_PROC; TE new_create_PROC; /
Help, please.
You are connected to the DB under what user? You must grant this user the CREATE TABLE privilege.
-
Vs role directly privilege on the creation of the procedure
I gave an our develpers create them all procedure/run procedures privleges and also granted him a role that has choose, update privileges, but always as insufficient privileges error when attempting to create a procedure.
On the other hand, when I grant the same privilege directly to the user, it is able to create the procedure without error.
What I'm doing wrong - I'd like only to all privilege granted through roles.
Your input please.
acquired through ROLE privileges do NOT apply within the named PL/SQL procedures
-
UTL_MAIL does not work in the procedure.
Hello guys, I have given privilege to run on my user and executed UTL_MAIL package the following
exec utl_mail.send (sender = > ' < user_id1 > @ < domain_name > .com ', recipients = > ' < user_id2 > @ < domain_name > .com ', subject = > 'Test eMail', message = > 'blah');
the utl_mail perform very well.
But now I want to put the utl_mail package in a procedure.
CREATE OR REPLACE PROCEDURE test_email AS
BEGIN
UTL_MAIL. SEND (sender = > ' < user_id1 > @ < domain_name > .com ',)
recipients = > ' < user_id2 > @ < domain_name > .com '.
subject = > 'Test eMail ',.
message = > "blah");
END;
now, when I run the procedure "run the test_email", I get the following error.
BEGIN user_id1.test_email; END;
Error on line 1
ORA-24247: network access denied by access control list (ACL)
ORA-06512: at "SYS." UTL_MAIL", line 654
ORA-06512: at "SYS." UTL_MAIL", line 671
ORA-06512: at "USER_ID1. TEST_EMAIL', line 3
ORA-06512: at line 1
Script done on line 10.
can someone help me on this point, which is UTL_MAIL to work when running individually and does NOT when it is used in a procedure, where mistaken?
Thank you
The procedure has worked. to get the UTL_MAIL work with in a process, outside the grant execute on UTL_MAIL to the user, that user is referred to an ACL as follows. previously, I thought a creation of ACL is sufficient to generate emails for all users.
BEGIN
DBMS_NETWORK_ACL_ADMIN. (ADD_PRIVILEGE)
ACL-online "."
main-online "."
IS_GRANT => TRUE,
privilege of-online 'connect');
END;
/ -
Dynamic insertion within the procedure error
Hi allI use under oracle database on HP - UX.
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE Production 10.2.0.5.0
AMT for HP - UX: 10.2.0.5.0 - Production Version
NLSRTL Version 10.2.0.5.0 - ProductionI'm not able to run the procedure below and it returns the error. The insert in the procedure returns error. If I execute manually only the insert statement, it works well.
Can someone help me with this issue?Procedure
===========
create or replace procedure test_proc
as
v_sql varchar2 (2000);
Start
v_sql: =' insert into TABLE1 (select owner, object_type, object_name, "S", "Y" of dba_objects@LINK1 )
where owner = "ABC" and object_type = "TABLE" less
Select the owner, object_type, object_name, "S", "Y" from dba_objects where owner = "ABC" and object_type = "TABLE") ';immediately run v_sql;
commit;
end;
/exec test_proc;
Error:
===========ERROR on line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SYSTEM. TEST_PROC", line 8
ORA-06512: at line 1user running this procedure doesn't have permission to read data from DBA_OBJECTS. Grant select permission on that to the user running this procedure and it should work.
Onkar
-
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
Hello
Could you tell me how to run a procedure that lies under different scheme serve in a schema to another without mentioning the name of schema before the procedure every time?
Below is the code in the right way, say, if there are two schemas, test1 and test2 and I want the procedure in Test2 will run under the Test1 schema?
Connect to test2 schema and grant permission to run for test1
grant exec on test2.prc to test1;
create a public synonym for procedure... with execute privilege...
so that you can use wth on the schema name.
-
EXECUTE privilege is not granted on the following SYS packages: UTL_FILE
Hi brothers and sisters.
Hope that you are well. I installed Oracle Developer Suite 10 g on Windows 7 successfully and that it works correctly.
I created a new user with the following script:
Grant
resource,
connect,
create session,
create the table,
create view.
create sequences,
create a synonym,
create database link,
create the role
Create the procedure
to orcdesign;
And then he GRANTS the following privileges:
Grant execute on dbms_lock to orcdesign;
Grant execute on dbms_pipe to orcdesign;
Grant execute on dbms_rls to orcdesign;
Grant select on dba_rollback_segs to orcdesign;
Grant select on dba_segments to orcdesign;
Grant select on parameter v_$ orcdesign;
Grant select on sys.v_$ nls_parameters to orcdesign with the option grant.
When I connect to the repository Administration utility, click on install and then start button in order to install an instance of repository, an error pops up with the message: ' EXECUTE privilege is not granted on the following SYS packages: UTL_FILE'.
Please help me what should I do to be able to successfully run Oracle Designer?
NoorNoor ul Huda wrote:
When I connect to the repository Administration utility, click on install and then start button in order to install an instance of repository, an error pops up with the message: ' EXECUTE privilege is not granted on the following SYS packages: UTL_FILE'.Hi, Noor
As salamu AsalamTry this SQL
GRANT EXECUTE ON SYS.UTL_FILE TO orcdesign WITH GRANT OPTION;
I hope this works...
If anyone has the answer is useful or appropriate mark it.
-
403 Forbidden error of execution of the procedures of the URL of the browser stored
I am currently trying to run a simple stored procedure (ea.hello_world, where "ea" is the pattern and "hello_world" is the name of the procedure) a URL from the browser, but am getting a 403 Forbidden - error message "you don't have permission to access /pls/apex/ea.hello_world on this server. I use APEX 3.2 with Oracle 11 g and mod_plsql and gave the steps of apex_public_user. Any thoughts on what I am doing wrong?
Here is the process I have used so far:
Create the "Hello_World" procedure in the "EA: schema
create or replace
procedure hello_world
is
Start
HTP. Print ("'Hello World!");
end;
I then successfully granted to run the apex_public_user procedure:
Grant execute on ea.hello_world to apex_public_user;
Then, I tried to call the stored procedure from the browser using the following syntax:
http:// < Server >: < port > / pls/apex/< schema >. < Procedure & gt;
I also experimented with the use of a public synonym and the configuration of the wwv_flow_epg_include_mod_local, but I do not think that the function s relevant since I'm using mod_plsql and not the embedded pl/sql gateway.Hello
If you have below the line in dads.conf, then wwv_flow_epg_include_mod_local sets
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Try:
Create public synonymCREATE PUBLIC SYNONYM hello_world FOR ea.hello_world;
Grant privilege to execute procedure to the public
GRANT execute on hello_world to public;
Then change the APEX_030200.wwv_flow_epg_include_mod_local function
CREATE OR REPLACE FUNCTION APEX_030200.wwv_flow_epg_include_mod_local( PROCEDURE_NAME IN VARCHAR2) RETURN BOOLEAN IS BEGIN IF UPPER(procedure_name) IN ( UPPER('hello_world')) THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END; /
Then try
http://: /pls/apex/hello_world If you can now run your procedure in URL, you can then low and e.g. grant execute procedure to the user of DAD.
Kind regards
Jarihttp://dbswh.webhop.NET/dbswh/f?p=blog:Home:0
Published by: jarola on December 6, 2011 16:20
Published by: jarola on December 6, 2011 16:24
typo in the name of the function
-
selection of multiple grants on the same object
Hello
(The following SQl code will be run on 9i, 10g and 11g database versions)
Im trying to produce a list of the directory of the subsidies that are the same from 2 different users (but only display the details of a user grants)
to clarify...
lets say we have 100 directories and 2 users who have granted permissions on them, user A and user B.
Permissions can be granted on a directory by just A user, to any user B or the same permission granted on the same directory by users A and B.
I want to make a list that displays the details of the directories where user A and user B are granted this permission (but in the list only display the details of A user grants)
If the following SQL code will give me all the directory permissions that are granted by user A
Select p.table_name, p.grantee, p.owner, p.grantor, p.privilege, o.object_type
of dba_tab_privs p
dba_objects o inner join
on o.object_name = p.table_name
where o.object_type = 'DIRECTORY '.
and p.grantor = 'USER ';
so I want to make the same list of grants by USERA just, but only if these directories have also been granted the same permission by USERB
any ideas on the best way to do it?
Thank you882817 wrote:
What's the advantage I have this solution on the previous?Well, I just introduced two solutions. Depending on the particular case compare you execution plans and choose a better. Here we have quite complex views, but I would say the analytical solution is a little bit faster:
SQL> explain plan for 2 select p.table_name, 3 p.grantee, 4 p.owner, 5 p.grantor, 6 p.privilege, 7 o.object_type 8 from dba_tab_privs p 9 inner join 10 dba_objects o 11 on ( 12 o.object_type = 'DIRECTORY' 13 and 14 o.owner = p.owner 15 and 16 o.object_name = p.table_name 17 and 18 p.grantor != 'U2' 19 ) 20 where not exists ( 21 select 1 22 from dba_tab_privs p1 23 where p.owner = p1.owner 24 and p.table_name = p1.table_name 25 and p.grantee = p1.grantee 26 and p.privilege = p1.privilege 27 and p1.grantor = 'U2' 28* ) SQL> / Explained. SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1557554763 ---------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 494 | 131K| | 864 (5)| 00:00:11 | |* 1 | HASH JOIN | | 494 | 131K| | 864 (5)| 00:00:11 | |* 2 | TABLE ACCESS FULL | USER$ | 73 | 1095 | | 3 (0)| 00:00:01 | |* 3 | HASH JOIN ANTI | | 494 | 124K| | 861 (5)| 00:00:11 | |* 4 | HASH JOIN | | 522 | 96570 | | 681 (5)| 00:00:09 | | 5 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 6 | HASH JOIN | | 522 | 88740 | | 678 (5)| 00:00:09 | | 7 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 8 | HASH JOIN | | 38597 | 5842K| 1752K| 674 (5)| 00:00:09 | |* 9 | HASH JOIN | | 24484 | 1458K| | 172 (5)| 00:00:03 | |* 10 | HASH JOIN | | 24221 | 685K| | 23 (9)| 00:00:01 | | 11 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | |* 12 | TABLE ACCESS FULL | OBJAUTH$ | 24221 | 449K| | 21 (5)| 00:00:01 | | 13 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | | 14 | VIEW | DBA_OBJECTS | 49670 | 4559K| | 164 (10)| 00:00:02 | | 15 | UNION-ALL | | | | | | | |* 16 | FILTER | | | | | | | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 17 | HASH JOIN | | 52627 | 2826K| | 162 (10)| 00:00:02 | | 18 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 19 | TABLE ACCESS FULL | OBJ$ | 52627 | 2055K| | 158 (9)| 00:00:02 | |* 20 | TABLE ACCESS BY INDEX ROWID | IND$ | 1 | 8 | | 2 (0)| 00:00:01 | |* 21 | INDEX UNIQUE SCAN | I_IND1 | 1 | | | 1 (0)| 00:00:01 | |* 22 | TABLE ACCESS BY INDEX ROWID| SUM$ | 1 | 8 | | 1 (0)| 00:00:01 | |* 23 | INDEX UNIQUE SCAN | I_SUM$_1 | 1 | | | 0 (0)| 00:00:01 | |* 24 | FILTER | | | | | | | |* 25 | HASH JOIN | | 9 | 513 | | 5 (20)| 00:00:01 | | 26 | INDEX FULL SCAN | I_LINK1 | 9 | 378 | | 1 (0)| 00:00:01 | | 27 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 28 | VIEW | VW_SQ_1 | 1530 | 109K| | 179 (4)| 00:00:03 | |* 29 | HASH JOIN | | 1530 | 158K| | 179 (4)| 00:00:03 | | 30 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 31 | HASH JOIN | | 1530 | 135K| | 176 (4)| 00:00:03 | |* 32 | HASH JOIN | | 1514 | 89326 | | 27 (8)| 00:00:01 | | 33 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 34 | HASH JOIN | | 1514 | 66616 | | 24 (9)| 00:00:01 | | 35 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | | 36 | NESTED LOOPS | | 1514 | 51476 | | 22 (5)| 00:00:01 | | 37 | TABLE ACCESS BY INDEX ROWID | USER$ | 1 | 15 | | 1 (0)| 00:00:01 | |* 38 | INDEX UNIQUE SCAN | I_USER1 | 1 | | | 0 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 39 | TABLE ACCESS FULL | OBJAUTH$ | 1514 | 28766 | | 21 (5)| 00:00:01 | | 40 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | ---------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("OA"."GRANTOR#"="UR"."USER#") 2 - filter("UR"."NAME"<>'U2') 3 - access("U"."NAME"="NAME" AND "O"."NAME"="NAME" AND "UE"."NAME"="NAME" AND "TPM"."NAME"="NAME") 4 - access("OA"."GRANTEE#"="UE"."USER#") PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 6 - access("O"."OWNER"="U"."NAME" AND "U"."USER#"="O"."OWNER#") 8 - access("O"."OBJECT_NAME"="O"."NAME") 9 - access("OA"."OBJ#"="O"."OBJ#") 10 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 12 - filter("OA"."COL#" IS NULL) 16 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND (SELECT 1 FROM "SYS"."IND$" "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAG E',11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB SUBPARTITION',42,NVL( (SELECT DISTINCT 'REWRITE EQUIVALENCE' FROM SYS."SUM$" "S" WHERE "S"."OBJ#"=:B2 AND BITAND("S"."XPFLAGS",8388608)=8388608),'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='DIRECTORY') 17 - access("O"."OWNER#"="U"."USER#") 19 - filter("O"."LINKNAME" IS NULL AND "O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND BITAND("O"."FLAGS",128)=0) 20 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ "I"."TYPE#"=7 OR "I"."TYPE#"=9) 21 - access("I"."OBJ#"=:B1) 22 - filter(BITAND("S"."XPFLAGS",8388608)=8388608) 23 - access("S"."OBJ#"=:B1) 24 - filter(NULL IS NOT NULL) 25 - access("L"."OWNER#"="U"."USER#") 29 - access("U"."USER#"="O"."OWNER#") 31 - access("OA"."OBJ#"="O"."OBJ#") 32 - access("OA"."GRANTEE#"="UE"."USER#") 34 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 38 - access("UR"."NAME"='U2') PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 39 - filter("OA"."COL#" IS NULL AND "OA"."GRANTOR#"="UR"."USER#") 89 rows selected. SQL> explain plan for 2 select table_name, 3 grantee, 4 owner, 5 grantor, 6 privilege, 7 object_type 8 from ( 9 select p.table_name, 10 p.grantee, 11 p.owner, 12 p.grantor, 13 p.privilege, 14 o.object_type, 15 count(case when p.grantor != 'U2' then 1 end) over(partition by p.table_name,p.grantee,p.owner,p.privilege) u2_indicator 16 from dba_tab_privs p 17 inner join 18 dba_objects o 19 on ( 20 o.object_type = 'DIRECTORY' 21 and 22 o.owner = p.owner 23 and 24 o.object_name = p.table_name 25 ) 26 ) 27 where u2_indicator = 1 28 / Explained. SQL> SQL> SQL> @?\rdbms\admin\utlxpls PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1974693759 ------------------------------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 522 | 59508 | | 674 (5)| 00:00:09 | |* 1 | VIEW | | 522 | 59508 | | 674 (5)| 00:00:09 | | 2 | WINDOW SORT | | 522 | 101K| | 674 (5)| 00:00:09 | |* 3 | HASH JOIN | | 522 | 101K| | 673 (5)| 00:00:09 | | 4 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 5 | HASH JOIN | | 522 | 96570 | | 670 (5)| 00:00:09 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 6 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 7 | HASH JOIN | | 522 | 88740 | | 666 (5)| 00:00:08 | | 8 | INDEX FULL SCAN | I_TABLE_PRIVILEGE_MAP | 24 | 240 | | 1 (0)| 00:00:01 | |* 9 | HASH JOIN | | 522 | 83520 | | 665 (5)| 00:00:08 | | 10 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 11 | HASH JOIN | | 38597 | 5465K| 1512K| 661 (4)| 00:00:08 | |* 12 | HASH JOIN | | 24484 | 1219K| | 170 (4)| 00:00:03 | |* 13 | TABLE ACCESS FULL | OBJAUTH$ | 24221 | 449K| | 21 (5)| 00:00:01 | | 14 | TABLE ACCESS FULL | OBJ$ | 52647 | 1645K| | 147 (3)| 00:00:02 | | 15 | VIEW | DBA_OBJECTS | 49670 | 4559K| | 164 (10)| 00:00:02 | | 16 | UNION-ALL | | | | | | | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ |* 17 | FILTER | | | | | | | |* 18 | HASH JOIN | | 52627 | 2826K| | 162 (10)| 00:00:02 | | 19 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | |* 20 | TABLE ACCESS FULL | OBJ$ | 52627 | 2055K| | 158 (9)| 00:00:02 | |* 21 | TABLE ACCESS BY INDEX ROWID | IND$ | 1 | 8 | | 2 (0)| 00:00:01 | |* 22 | INDEX UNIQUE SCAN | I_IND1 | 1 | | | 1 (0)| 00:00:01 | |* 23 | TABLE ACCESS BY INDEX ROWID| SUM$ | 1 | 8 | | 1 (0)| 00:00:01 | |* 24 | INDEX UNIQUE SCAN | I_SUM$_1 | 1 | | | 0 (0)| 00:00:01 | |* 25 | FILTER | | | | | | | |* 26 | HASH JOIN | | 9 | 513 | | 5 (20)| 00:00:01 | | 27 | INDEX FULL SCAN | I_LINK1 | 9 | 378 | | 1 (0)| 00:00:01 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ | 28 | TABLE ACCESS FULL | USER$ | 74 | 1110 | | 3 (0)| 00:00:01 | ------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("U2_INDICATOR"=1) 3 - access("OA"."GRANTEE#"="UE"."USER#") 5 - access("OA"."GRANTOR#"="UR"."USER#") 7 - access("OA"."PRIVILEGE#"="TPM"."PRIVILEGE") 9 - access("O"."OWNER"="U"."NAME" AND "U"."USER#"="O"."OWNER#") PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 11 - access("O"."OBJECT_NAME"="O"."NAME") 12 - access("OA"."OBJ#"="O"."OBJ#") 13 - filter("OA"."COL#" IS NULL) 17 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND (SELECT 1 FROM "SYS"."IND$" "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND DECODE("O"."TYPE#",0,'NEXT OBJECT',1,'INDEX',2,'TABLE',3,'CLUSTER',4,'VIEW',5,'SYNONYM',6,'SEQUENCE',7,'PROCEDURE',8,'FUNCTION',9,'PACKAGE' ,11,'PACKAGE BODY',12,'TRIGGER',13,'TYPE',14,'TYPE BODY',19,'TABLE PARTITION',20,'INDEX PARTITION',21,'LOB',22,'LIBRARY',23,'DIRECTORY',24,'QUEUE',28,'JAVA SOURCE',29,'JAVA CLASS',30,'JAVA RESOURCE',32,'INDEXTYPE',33,'OPERATOR',34,'TABLE SUBPARTITION',35,'INDEX SUBPARTITION',40,'LOB PARTITION',41,'LOB SUBPARTITION',42,NVL( (SELECT DISTINCT 'REWRITE EQUIVALENCE' FROM SYS."SUM$" "S" WHERE PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ "S"."OBJ#"=:B2 AND BITAND("S"."XPFLAGS",8388608)=8388608),'MATERIALIZED VIEW'),43,'DIMENSION',44,'CONTEXT',46,'RULE SET',47,'RESOURCE PLAN',48,'CONSUMER GROUP',51,'SUBSCRIPTION',52,'LOCATION',55,'XML SCHEMA',56,'JAVA DATA',57,'SECURITY PROFILE',59,'RULE',60,'CAPTURE',61,'APPLY',62,'EVALUATION CONTEXT',66,'JOB',67,'PROGRAM',68,'JOB CLASS',69,'WINDOW',72,'WINDOW GROUP',74,'SCHEDULE',79,'CHAIN',81,'FILE GROUP','UNDEFINED')='DIRECTORY') 18 - access("O"."OWNER#"="U"."USER#") 20 - filter("O"."LINKNAME" IS NULL AND "O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND BITAND("O"."FLAGS",128)=0) 21 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9) 22 - access("I"."OBJ#"=:B1) PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ 23 - filter(BITAND("S"."XPFLAGS",8388608)=8388608) 24 - access("S"."OBJ#"=:B1) 25 - filter(NULL IS NOT NULL) 26 - access("L"."OWNER#"="U"."USER#") 70 rows selected. SQL>
SY.
-
Problem with the execution of the procedure
Hello
Kindly help me. It is a matter of urgency
When I execute the block anonymous as @Tmp.sql, it has successfully passed.
The anonymous block
But when I'm putting in a procedure and trying to run it, I get the error:DECLARE TYPE curVar IS REF CURSOR; curIndex curVar; IDX_Name varchar2(38); parseString varchar2(5000); parseString2 varchar2(5000); int_cur int; bck number; BEGIN parseString := 'select index_name from USER_INDEXES '; parseString := parseString || ' where index_name not like '||chr(39)||'%MXTEMPOID%'||chr(39); -- DBMS_OUTPUT.PUT_LINE(parseString); open curIndex for parseString; loop fetch curIndex into IDX_Name; exit when (curIndex%NOTFOUND); parseString2 := 'alter index '||IDX_Name||' rebuild online compute statistics parallel'; -- DBMS_OUTPUT.PUT_LINE(parseString2); int_cur := dbms_sql.open_cursor; dbms_sql.parse(int_cur,parseString2,dbms_sql.native); bck := dbms_sql.execute(int_cur); dbms_sql.close_cursor(int_cur); -- DBMS_OUTPUT.PUT_LINE('Index '||IDX_Name||' rebuilt.'); end loop; close curIndex; -- DBMS_OUTPUT.PUT_LINE('All Indexes are rebuilt.'); END ;
Runcreate or replace PROCEDURE REBUILD_INDEX AS TYPE curVar IS REF CURSOR; curIndex curVar; IDX_Name varchar2(38); parseString varchar2(5000); parseString2 varchar2(5000); int_cur int; bck number; BEGIN parseString := 'select index_name from USER_INDEXES '; parseString := parseString || ' where index_name not like '||chr(39)||'%MXTEMPOID%'||chr(39); -- DBMS_OUTPUT.PUT_LINE(parseString); open curIndex for parseString; loop fetch curIndex into IDX_Name; exit when (curIndex%NOTFOUND); parseString2 := 'alter index '||IDX_Name||' rebuild online compute statistics parallel'; -- DBMS_OUTPUT.PUT_LINE(parseString2); int_cur := dbms_sql.open_cursor; dbms_sql.parse(int_cur,parseString2,dbms_sql.native); bck := dbms_sql.execute(int_cur); dbms_sql.close_cursor(int_cur); -- DBMS_OUTPUT.PUT_LINE('Index '||IDX_Name||' rebuilt.'); end loop; close curIndex; -- DBMS_OUTPUT.PUT_LINE('All Indexes are rebuilt.'); END REBUILD_INDEX;
ErrorBEGIN REBUILD_INDEX(); END;
Published by: Dhabas on August 9, 2011 12:55Connecting to the database qqraida. ORA-01031: insufficient privileges ORA-06512: at "SYS.DBMS_SQL", line 1199 ORA-06512: at "QQRAIDA.REBUILD_INDEX", line 25 ORA-06512: at line 2 Process exited. Disconnecting from the database qqraida.
Dhabas wrote:
Thanks for your quick response. I saw the error.
But, how then I don't get the same with anonymous block?Code that runs through procedures/functions/packages is based on explicit grants to the user who runs it.
Anonymous blocks use subsidies based on the roles that are ignored by the functions/procedures/packages.Do not depend on subsidies based on the roles for your access, get explicitly grants to the user.
Maybe you are looking for
-
Vista SP2 stamp on error performance
tried to install to 64-bit. SP2 received buffer overflow error. He always loaded SP2 but after four hours or so has expired and restored the system pre SP2 state due to the failure. .. .but network problems now squirely and missing network on the tas
-
I have the EA6500 router and I was wondering if it is safe to disable the firewall software on the computers of my OS X while the firewall of the router is turned on? In other words, is it enough? The firewall software on OS X offers an additional la
-
Toshiba HDDR250E03X does not open backup files in Windows 7
I just bought a Dell computer brand new with Windows 7 and tried to transfer files from my XP system, but it won't work. It recognizes the external hard drive, but I can't restore the backup files.
-
The time hack regarding when I send or receive incorrect emails
For the past few weeks the Nick of time (so received or sent) on my email is incorrect. For example, I can send an email to 13:00, but the email receiver gets watch that I sent it at 16:45. The same thing happens to the messages I receive. Hack of ti
-
Deleting blackBerry Smartphones call log
If anyone knows, is there a way to delete the log of calls at a time, rather than delete every single entry?