If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > grants for dbms_lock

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-21-04, 10:49
Alex71 Alex71 is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
grants for dbms_lock

Hi,
I want to use the dbms_lock in a pl/sql procedure. The EXECUTE_CATALOG_ROLE has granted execute rights on this package. So I granted that role to my user and tried to compile my procedure, but:
PLS-00201: identifier 'DBMS_LOCK' must be declared
After direct grant of dbms_lock to the user the procedure compiles without any error.

Do you have any idea, what the problem is?

Thanks
Alex
Reply With Quote
  #2 (permalink)  
Old 09-21-04, 10:52
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
grant via a role do not apply to stored objects. grant execute directly to the procedure owner
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
  #3 (permalink)  
Old 09-21-04, 11:12
Alex71 Alex71 is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
Hi,
I'm really not a newby with Oracle ... but you are right
Is there no other way than granting the dbms_lock directly - via dynamic sql or so? I don't like another connection to sys in my installation routine ...

Alex
Reply With Quote
  #4 (permalink)  
Old 09-21-04, 11:15
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
whether dynamic or not, the grant must be executed from sys.
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
  #5 (permalink)  
Old 09-21-04, 11:18
Alex71 Alex71 is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
okay, thank you, so I will do that.
Is there any reason, why dbms_lock is not grantable by system, like other dbms packages are?

Alex
Reply With Quote
  #6 (permalink)  
Old 09-21-04, 11:25
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
no idea what oracle's thinking on that one. e.g., dbms_lock is not granted to system at all, dbms_aq is granted to system with grant privs, dbms_alert is granted to system without grant privs.

you could grant execute to system (or some other user) with grant option, then do grants to other users from that schema/
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
  #7 (permalink)  
Old 09-21-04, 12:33
mrswarn mrswarn is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
Hi,

Are u using DBMS_LOCK inbuilt procedure in a PLSQL package/PLSQL Procedure, then it is not possible.

The other alternative is,

save the procedure with the extension .sql and run it from the command promt.Now the DBMS_LOCK Procedure will work fine.

To run the SQL Script :

i) go to the directory where u actually created the Script
ii) Get connected to the Database. say SQLPLUS username/password@database
iii)@script_name.sql [ where script_name is the name of the script]


If u have any input parameters , then give it while running the script like
@script_name.sql param1 param2
and access the param1 and param2 inside the script as $1 [param1] and $2 [param2].

or To get the input paramater inside the script :
accept var_name prompt 'enter path?' [ var_name not needed to initialize]
And u can the var_name inside the script using &.[ say &var_name...]

I hope this info will help.

Thanks ,
Swarna
Reply With Quote
  #8 (permalink)  
Old 09-22-04, 09:26
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
what do you mean "it is not possible"? I just explained that it is possible, and simply requires granting execute to the user. Try reading the other responses - you may learn something.
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
  #9 (permalink)  
Old 09-23-04, 02:35
mrswarn mrswarn is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
yeah....i just explained the other way to do......So try to learn from others!!!
Reply With Quote
  #10 (permalink)  
Old 09-23-04, 04:09
mrswarn mrswarn is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
Dont u know abt the meaning of Not possible ?
Reply With Quote
  #11 (permalink)  
Old 09-23-04, 09:48
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
you said "Are u using DBMS_LOCK inbuilt procedure in a PLSQL package/PLSQL Procedure, then it is not possible."

It is very much possible to use dbms_lock within a stored pl/sql object (package, procedure, function). It is simply required to grant execute to the owner of the stored object. Maybe you don't understand the meaning of "not possible"?
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
  #12 (permalink)  
Old 09-23-04, 09:56
mrswarn mrswarn is offline
Registered User
 
Join Date: Sep 2004
Posts: 17
Oracle - DBForum is the place to discuss abt Oralce and not abt Not Possible.
Reply With Quote
  #13 (permalink)  
Old 09-23-04, 10:05
shoblock shoblock is offline
Registered User
 
Join Date: Apr 2004
Posts: 246
Then why did you previously ask "Dont u know abt the meaning of Not possible ?" You seem to be ignoring your own advice.
__________________
Give a man a fish, you feed him for a day. Club him over the head with a fish, he'll leave you alone.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On