GRANT table permissions for a limited time

I have a plsql job that runs as a specific user, and I need to complete a grant to give that user access to specific tables until the job completes. Work does not take more than 30 minutes.

My question is, is there any access to a specific user in oracle to access the table for a limited time, or do I just need to create another function to revoke privileges after completing the job? I did a few quick searches and couldn't find anything on this. Does anyone know if this is possible?

It would be great if I could provide all 30 minutes.

+6
source share
2 answers

Comment from @ksa is the right answer for this. You must create a new user with the required permissions and define this procedure in this diagram. You can GRANT EXECUTE perform this procedure for the role or users who need to run it. Although this is the default value, you can also explicitly specify AUTHID DEFINER . In essence, this means that the procedure is performed as a determinant, regardless of who names it. This saves you any time / planning problems, and the resolutions for your successors are clear. If you do not like to specify a scheme for each call, you can define a synonym.

+2
source

There is a method in plsql called grantAccess (). It allows you to specify the number of seconds that the user is granted access.

So, if you want to give them access, say, in a year, you should write the following:

 rightSideUser.grantAccess(31536000) 
-2
source

Source: https://habr.com/ru/post/989815/


All Articles