cancel
Showing results for 
Search instead for 
Did you mean: 

How to change objects owners in HANA

Former Member
0 Kudos

hi, I have a schema and there are procedures developed by different developers. I want to change the ownership of a particular procedure to a different user. How do we change the ownership of objects in HANA

I am looking something similar to this in HANA -> REASSIGN OWNED BY old_role [, ...] TO new_role

-Thanks

Vinod Nair

Accepted Solutions (0)

Answers (4)

Answers (4)

pratik_doshi2
Participant
0 Kudos

The owner of an object and the owner of the schema in which the object is located are the only users who can access the object and grant object privileges on it to other users.


So what I think is if you change the schema of objects your job is done.

Try with the import-export utility of HANA, it have the rename_schema option and will make your life easier.

IMPORT - SAP HANA SQL and System Views Reference - SAP Library


There is also the other option to do it programmatically.

You can do in the script with the dynamic SQL which would be to like create the object into the target schema and drop the object in Source schema.

Former Member
0 Kudos

we can change the all objects with "Switch ownership job"

Switch ownership job will run and upon successful completion.


thanks

Ravindar

HakanHaslaman
Product and Topic Expert
Product and Topic Expert
0 Kudos

Ravindar, your provided solution looks to be for another issue than asked in the original posting.

Former Member
0 Kudos

Hi Vinod,

If developer develops procedure based on sql console, then as my knowledge, you cannot change ownership for them, you only can grant privilege to related user.

Besides, if developer develops procedure based on modeler perspective, then it already define default package and schema (_SYS_BIC), you cannot change ownership, and cannot move it.

Hope this can help you.

Regards,

Jerry

shashisingh
Participant
0 Kudos

try this command

GRANT <object_privilege>,... ON <object_name> TO <grantee> [WITH GRANT OPTION].

Thanks,

Shashi

Former Member
0 Kudos

Thanks for the reply Sashi, But I am not sure if this would change the ownership of the table this is just granting an user the access to that object. These two are two different things. Thanks!

former_member184768
Active Contributor
0 Kudos

Hi Vinod,

Frankly I am not aware if there is a direct method to change the owneship of objects like Stored Procedures.

One alternative I can think of, is to collect the script for the "Create procedure" (s) and then drop the procedures in the earlier user schema and re-create them with the new user schema.

I think with SP05 / SP06, the procedures can also be created under packages as HANA artifacts. Personally I haven't tried this, but it is worth looking into that option too. That way, it might be easy to change the ownership again, if required.

As I said, I don't have personal experience with this yet, but may be you can look into this and share on this forum.

Regards,

Ravi