0

I have written a small shell script to automate the Big SQL and HIVE synchronization. Code is as below

echo "Login to BigSql"
<path to>/jsqsh bigsql --user=abc --password=pwd
echo "login succesfull"

echo "Syncing hive table <tbl_name> to Big SQL"
call syshadoop.hcat_sync_objects('DB_name','tbl_name','a','REPLACE','CONTINUE');

echo "Syncing hive table TRAINING_TRACKER to Big SQL Successfully"

Unfortunately, I am getting the message:

Login to BigSql
Welcome to JSqsh 4.8
Type "\help" for help topics. Using JLine.

And then it enters the Big SQL command prompt. Now when I type "quit" and hit enter, it gives me following messages:

login succesful
    Syncing hive table <tbl_name> to Big SQL
    ./script.sh: line 10: call syshadoop.hcat_sync_objects(DB_name,tbl_name,a,REPLACE,CONTINUE): command not found

What am I doing wrong?

learner
  • 73
  • 2
  • 9

2 Answers2

0

You would need to redirect the output of your later commands into the jsqsh command. E.g. see this example

You can start JSqsh and run the script at the same time with this command:

/usr/ibmpacks/common-utils/current/jsqsh/bin/jsqsh bigsql < /home/bigsql/mySQL.sql

from here https://www.ibm.com/support/knowledgecenter/en/SSCRJT_5.0.2/com.ibm.swg.im.bigsql.doc/doc/bsql_jsqsh.html

Paul Vernon
  • 3,818
  • 1
  • 10
  • 23
0

There already is an auto-hcat sync job in Big SQL that does exactly what you're trying to do

Check if the job is running by

su - bigsql (or whatever instance owner)

db2 connect to bigsql 

db2 "select NAME, BEGIN_TIME, END_TIME, INVOCATION, STATUS from 
SYSTOOLS.ADMIN_TASK_STATUS where BEGIN_TIME > (CURRENT TIMESTAMP - 60 minutes) 
and name ='Synchronise MetaData Changes from Hive' "

if you don't see an output , simply enable it through Ambari :

Enable Automatic Metadata Sync

iender
  • 1