In this article we will learn - How to define a design-time schema and maintain the schema definition in the repository.
Introduction:
SAP HANA XS enables you to create database schema as a design-time files in the repository. This is achieved with the help .hdbschema file.
For example a file MySchema.hdbschema will create a database schema MY_SCHEMA when activated.
Introduction:
SAP HANA XS enables you to create database schema as a design-time files in the repository. This is achieved with the help .hdbschema file.
For example a file MySchema.hdbschema will create a database schema MY_SCHEMA when activated.
Now let us see the steps to create a schema using hdbschema file in details.
Prerequisite:
- You have access to a HANA system
- You have all the role and privileges required
- You know how to Create Your First HANA XS Application using HANA Studio
Steps to create a schema using hdbschema file:
1. Create a XS project as mentioned in the article Create Your First HANA XS Application using HANA Studio
2. Right click and select New à Other à SAP HANA à Database Development à Schema.
3. Specify file name as “MySchema”.
4. Copy the below code and paste it in the file.
schema_name = "MY_SCHEMA";
5. Right click and select Team à Activate. This will activate the file.
6. Check in Catalog that the schema “MY_SCHEMA” is created.
Done!! You have successfully created schema using hdbschema file.
The Schema “MY_SCHEMA” is not visible in Catalog. What’s went wrong?
If you open the Catalog, you may not see the schema “MY_SCHEMA” created via hdbschema file.
Reason:
After activation in the repository, the schema object is only visible in the catalog to the _SYS_REPO user. To enable other users, for example the schema owner, to view the newly created schema, you must grant the user the required SELECT privilege.
Grant SELECT privileges on the new schema to you user:
To get access to the Schema, open SQL Console and call below procedure:
call _SYS_REPO.GRANT_SCHEMA_PRIVILEGE_ON_ACTIVATED_CONTENT(
'select, create any, insert, delete, update, execute, alter, drop',
'<SCHEMA_NAME>',
'<USER_NAME>');
<SCHEMA_NAME> is the name of the newly activated schema, and <USER_NAME> is the database user you want to give access to.
Continue reading:
Thanks for your interesting ideas.the information's in this blog is very much useful
ReplyDeletefor me to improve my knowledge.
Python Training in Chennai
Python Training in T.Nagar
JAVA Training in Chennai
Big data training in chennai
Selenium Training in Chennai
Python Training in Chennai
Python Training in Tambaram