cancel
Showing results for 
Search instead for 
Did you mean: 

HANA Database Explorer: import catalog objects in HDI container

pierre_dominique2
Contributor

Hi,

I'm trying to import catalog objects (exported from a different container) in an HDI container on SAP HANA Cloud via the Database Explorer but I always get the following error:

An error occurred while performing a catalog import
(dberror) [651]: cannot use duplicate object name: object XXXX already exists

And when I check the Replace existing objects option, I get the following error:

An error occurred while performing a catalog import
(dberror) [258]: insufficient privilege: Detailed info for this error can be found with guid '00C706790CD6624E8143F016A83916B3'

Apparently my user doesn't have the required DROP privilege so I tried to grant it but this also gives me an error:

set schema "MY_SCHEMA#DI";
create local temporary column table "#PRIVILEGES" like "_SYS_DI"."TT_SCHEMA_PRIVILEGES"; 
insert into "#PRIVILEGES" ("PRIVILEGE_NAME", "PRINCIPAL_SCHEMA_NAME", "PRINCIPAL_NAME") values ('DROP', '', 'MY_ADMIN_USER');
call "MY_SCHEMA#DI"."GRANT_CONTAINER_SCHEMA_PRIVILEGES"("#PRIVILEGES", "_SYS_DI"."T_NO_PARAMETERS", ?, ?, ?);
drop table "#PRIVILEGES";
"DROP": cannot grant privilege; accepted values are "CREATE ANY", "CREATE TEMPORARY TABLE", "EXECUTE", "SELECT", "SELECT METADATA", "INSERT", "UPDATE", "DELETE", "DEBUG", "DEBUG MODIFY", "UNMASKED", "SQLSCRIPT LOGGING", "TRIGGER", "INDEX", and "REFERENCES"

The documentation says that the user must have the INSERT/UPDATE, DROP, or CREATE object privileges for the destination catalog objects and must have the IMPORT system privilege but it doesn't say how to do it so it's not really helpful.

Cheers,

Pierre

pierre_dominique2
Contributor
0 Kudos

dj.adams.sap or thomas.jung > do you have any idea? What kind of user are we supposed to use to export/import catalog objects in an HDI container? Or is there a better way to save the data of a container before deploying a new release (in the CAP context)?

View Entire Topic
thomas_jung
Developer Advocate
Developer Advocate

Are you doing the import catalog object or import HDI container. There is a separate import option for HDI that will restore the entire state of the container. You should never do just a SQL object import into a container as that will disrupt the managed metadata of the container.

That said to use the import HDI container you should use an HDI Admin user or HDI Group Admin users as described in the online help:

https://help.sap.com/viewer/3823b0f33420468ba5f1cf7f59bd6bd9/2.0.05/en-US/8bad1a8605b343ababf821350b...

https://help.sap.com/viewer/3823b0f33420468ba5f1cf7f59bd6bd9/2.0.05/en-US/54fa5466cdeb4e488b08d6c7da...

There is also a video on the setup and usage of the HDI Admin user: https://youtu.be/zyHhxZWW40M

pierre_dominique2
Contributor
0 Kudos

Thanks Thomas, I'll check the video. I've already created an HDI admin user (and an HDI group admin user and an HDI container admin user) by following the documentation but all of this is a bit overwhelming.

pierre_dominique2
Contributor
0 Kudos

Hi thomas.jung. Thanks for the link to the video, this was really helpful to understand the concepts and pick the right APIs to create the different HDI admin users.

I can now export HDI containers with an HDI admin group user. Is this the recommended way to backup HDI containers before deploying a new release in production (export then import if something goes wrong)? I recently deleted some data in a productive application because I didn't know about the undeploy.json concept and I'd like to better understand how to prevent such issues in the future.

Note: I just discovered your new series on hana-opensap-cloud-2020, great stuff!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I don't think that backup and recovery was the original design intention of this feature. From reading the documentation, I think you get the sense that it was built more for copy operations (like copying back to QA from Production). But I don't see why it couldn't be used as a kind of backup and recovery. That said I don't personally have experience using it as a back up and recovery mechanism within the same instance (overwriting a new state of an HDI container). I'd defintely recommend testing that in a Dev/Sandbox environment with a throwaway container before relying upon it on a real situation.

draschke
Active Contributor
0 Kudos

Hi Thomas,

I would like to see that video about usage of HDI Admin user, but it doesn't work for me.

"Video not available

This video is private"

Is that yours? Can you do anything?

Thanks for your help!

thomas_jung
Developer Advocate
Developer Advocate

That video was moved to the SAP Developers YouTube channel. The new URL is: SAP HANA Deployment Infrastructure (HDI) Administration - YouTube