cancel
Showing results for 
Search instead for 
Did you mean: 

Export liste of table

Patrice1
Explorer
0 Kudos

Hello

i would like to export a list of table with hdbsql command line.

would like this list of table read from a file, like a parfile.

i know i can do hdbsl export with schema.table but i am wondering if the hdbsql can read command from a parameter file?

thank you for your help

best regards

Patrice

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello!

You can use the hdbsql input paramenter which is "-I" as you can see by executing "hdbsql --help | grep input":

hdbsql --help | grep input

  -I <file_name>    use file <file_name> to input queries (default: stdin)

So, if you write the export commands into a file which name is "/tmp/export_tables_command.sql" with this:

EXPORT "MYSCHEMA"."MYTABLE1" AS BINARY INTO '/usr/sap/<SID>/HDB<INSTANCENUMBER>/work/<MYFOLDER>;

EXPORT "MYSCHEMA"."MYTABLE2" AS BINARY INTO '/usr/sap/<SID>/HDB<INSTANCENUMBER>/work/<MYFOLDER>;

You can then use this:

hdbsql -I /tmp/export_tables_command.sql

PS: You can set the access information with hdbsql parameters as follow:

hdbsql -n 192.168.1.101 -i 35 -u SYSTEM -p Password1*

hdbsql -U <hdbuserstore>

Regards,

Pablo Silva

Patrice1
Explorer
0 Kudos

Hello

I have created the file exp.sql:

EXPORT "SAPSID"."T000" AS BINARY INTO '/mnt/SAP/CLONE/' WITH REPLACE;

i have define a userstore key like this :

hdbuserstore set CLONE host:30015 SAPSID password


and running the command line :

hdbsql -U CLONE -l exp.sql

and get the following ???:

/***************************************************************************

Welcome to the SAP HANA Database interactive terminal.

Type:  \h for help with commands

       \q to quit

hdbsql=>

*********************************************************************************/

when i do enter i get the prompt

hdbsql TB1=>

but no export file is created where i attend in dir /mnt/SAP/CLONE/

so i try with all the detail command line below:

hdbsql -n host:30015 -u sapsid -p password -I exp.sql

it run withiout error and still not get  my export file

can you help? can you explain me why i cannot succeed?

thank you very much for your help

regards

patrice

Former Member
0 Kudos

Hi, Patrice.

Could try providing the full path of the input file to the I parameter?

Could you make sure the SAPSID schema exists?

Also, could you make sure the SAPSID user has export permission?

Could you create a folder under $ DIR_INSTANCE/work and use that to export your table into?

Finally, try to use the "-o" parameter to send the query result to another file as well.

Enviado por Samsung Mobile.

Patrice1
Explorer
0 Kudos

Hello Pablo

i fact my export work, it is just that i was not looking in the right directory.

in fact when a say in my exp.sql file that i want the export file to be located in /mnt/SAP/CLONE, it creates after many subdirectories.

i found my file here in fact:

/mnt/SAP/CLONE/index/SAPSID/BA/BALHDR/attributes --> for a BINARY export

and

/mnt/SAP/CLONE/index/SAPSID/BA/BALHDR --> for a CSV export

didn't knew this.

best regards

Patrice

Answers (0)