0
votes

I'm setting up a Puppet provision file to install, configure and restore a dump file into a Oracle Database.

I would like to include a check in the exec command in order to check if the restore was successful.

Here is what I have so far:

exec {"import-dump":
  command => "impdp system/password DUMPFILE=MYDUMP.DMP LOGFILE=import-dump.log SCHEMAS=MYSCHEMA",
  path    => "/u01/app/oracle/product/11.2.0/xe/bin/",
  -- something to check if the import command already runned successfully ---
  require => Exec["install-oracle"],
}
1

1 Answers

1
votes

I would use an approach like the following:

exec { "import-dump":
  command => "impdp system/password DUMPFILE=MYDUMP.DMP LOGFILE=import-dump.log SCHEMAS=MYSCHEMA",
  path    => "/u01/app/oracle/product/11.2.0/xe/bin/",
  unless  => "/bin/grep 'terminated successfully' /path/to/import-dump.log",
  require => Exec["install-oracle"],
}

In this way you can check if a previous import job was run successfully.