3

I'd like to call an ODI Scenario from command line and wait until its done. I am using ODI 12c and installed a standalone agent. I already found out that you can use the startscen.cmd command and it works for me. The only problem is that cmd is not waiting for the scenario to be done. Any Suggestions to achieve sth like that?

My .bat-file looks like this:

cd C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\bin
call startScen.cmd "-INSTANCE=CITestAgent" MAPPING 1_0_0 GLOBAL "-SESSION_NAME=TEST_RUN" "-AGENT-URL=http://localhost:20910/oraclediagent"
cd C:\Users\Redekera\documents\testFiles
"C:\Users\REDEKERA\Documents\instantclient_19_3\sqlplus.exe" db_user/pw@db/scheme @run_tests_lieferschein.sql

After that command i'd like to run an sql via sql*plus, which needs to wait until the scenario has finished.

Thanks for help guys :)

Aaron R.
  • 93
  • 2
  • 9
  • what do you mean by this ? why dont u add it in the batch After that command there's another, which needs to wait until the scenario has finished. – Moudiz Oct 11 '19 at 07:05
  • well as a start you can tell the cmd to wait specific time `timeout /t 30` then after the time finish it start executing the sql plus. – Moudiz Oct 11 '19 at 07:22
  • @Moudiz already thought about it, but I don't think that's a proper solution. I don't know how long the scenario needs to execute, depends on the scenario I want to call and the amount of data... – Aaron R. Oct 11 '19 at 07:45
  • Hi @AaronR. What OS is on the machine where you need to run the command lines? – F.Lazarescu Oct 14 '19 at 04:26
  • Hi @F.Lazarescu Windows – Aaron R. Oct 14 '19 at 08:26

2 Answers2

3

By default startscen.cmd will wait for the end of the execution to return. This can be changed with parameter -ASYNC=yes to start the execution asynchronously. In that case it would return the SESSION number that is useful to check the status of execution.

JeromeFr
  • 1,869
  • 2
  • 17
  • 20
1

If you want the second command to execute only if the first exited successfully:

execute scenario command && sql*plus command

Extracted from here

The main idea is the “&&” sign!

F.Lazarescu
  • 1,385
  • 2
  • 16
  • 31
  • also good idea in combination with first answer, but how the batch looks like when you have to change directory between the 2 commands? – Aaron R. Oct 15 '19 at 06:35
  • Cd change directory && execute senario command && change directory && sql*plus command – F.Lazarescu Oct 15 '19 at 06:37