on 08-20-2013 7:01 PM
Hello,
I need to dynamically provision Schema/Catalog, load data, analyze data, generate reports and drop the catalogs/schema from the server.
I got a schema called "MasterCatalog" having 10 tables (most of them are empty), 3 views and 10 stored procedures.
Now I want to copy the tables and procedures from MasterCatalog to newly created (empty) schema problematically.
First I create an empty schema using "CREATE SCHEMA" statement. Then copy the objects from master catalog to newly created schema.
For that, I tried Export & Import SQL commands. Using export command, i tried to export SQL objects onto a local server folder then tried to import the objects into newly created schema.
But it is trying to import SQL objects into the same source schema. There is no provision to specify the target schema on Import statement.
Any idea how to copy objects from one schema to another schema on the same server?
Regards,
TK
Hi there!
As of SPS 6 the IMPORT command allows for changing the target schema name(s):
Syntax
IMPORT <object_name_list> FROM <path> [WITH <import_option_list>] [AT [LOCATION] <indexserver_host_port>]
WITH <import_option_list>
<import_option_list> ::= <import_option> [{, <import_option>}]
<import_option> ::= REPLACE | CATALOG ONLY | DATA ONLY | NO DEPENDENCIES | THREADS <number_of_threads> | RENAME SCHEMA <rename_schema_list>
RENAME SCHEMA <rename_schema_list> <rename_schema_list> ::= <rename_schema_token> [{, <rename_schema_list>}] <rename_schema_token> ::= <source_schema> TO <target_schema>
It is possible to rename the objects' schema during import. Multiple schemas can be renamed by specifying multiple <rename_schema_token>. It is not allowed to specify the same schema as both <source_schema> and <target_schema> in same or different <rename_schema_token>.
This is not yet in the released documentation, but will be soon.
- Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Lars,
Thanks for your idea! Finally it works!
The statements used to copy content from one schema to another schema are as below:
EXPORT "SFLIGHT"."*" AS BINARY INTO '/tmp/SFLIGHT' WITH REPLACE SCRAMBLE THREADS 10;
IMPORT "SFLIGHT"."*" AS BINARY from '/tmp/SFLIGHT' with RENAME SCHEMA "SFLIGHT" TO "SHANA";
Note: /temp/SFLIGHT is a temp folder in server; "*" can be a table or all content
BR.
Bella
Hello Team,
We have migrated SQL Server 2008 to SAP HANA Instance. We deployed the Tables in SAP HANA. But we would like to know the best alternative solution to deploy Stored Procedures in SAP HANA. We are not using any ETL tools (BODS). So, kindly let me know the alternative solutions.
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Praveen,
Please find below the article on "How to Convert SQL from the Microsoft SQL Server Database to the SAP HANA™ Database".
Regards,
TK
Hi Thandava,
If your number of tables, views and procedures are limited, you might keep them in a single script and run the script every time a new schema is created. Please ensure that your object names in CREATE VIEW, CREATE PROCEDURE and within the procedure are not prefixed with the schema name,
You can create tables using CREATE TABLE ... like...with data; option, but it will not work for Views and procedures.
I'd recommend using the CREATE objects script and run it after the schema creation.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi TK,
The "import/export" function of HANA studio, it is only support for same schema and cannot change it during import, it has no special method to copy tables and SP on HANA studio so far, you may use BODS tool.
besides, you can modify your export *.sql script to modify schema by manually, and exec on sql console, or you can use sql script "like" key word to create table, such as create table "target schema name"."table name" like "original schema name"."table name" with data.
Hope this can help you.
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi TK,
Yes, right, the like keyword only support table, not support procedure and view, sorry to missed content and confuse you.
Do you check and consider PowerDesigner tool can do or not, I remembered HANA database can use PowerDesigner tool.
Please check below link for PowerDesigner and HANA.
Hope this can help you.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.