Skip to Main Content

Enterprise Manager

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EM how to download logs for job execution steps?

Mikhail VelikikhAug 16 2015 — edited Aug 16 2015

I'm looking for a way to download logs for job executions steps.

For example, some of DBaaS task jobs are quite complex: Database Profile Creation, DBaaS SnapClone creation and so on.

They consists from many steps and I want to obtain logs for each step.

oem_create_database_profile_screen_logs_exec_id.PNG

Currently I clicked on each step and press download button. I'm looking for more automatic way to download all logs at once.

I have tried to utilize emcli to accomplish my task and found a command get_job_execution_detail.

Unfortunately, passing a job execution_id from EM screen is not enough:

bash-4.1$ emcli get_job_execution_detail -execution=1D6BC98B3CC6325EE0540800279F63AC

Execution ID, Name, Owner, Target Name, Target Type, Hostname, Scheduled, Status ID

1D6BC98B3CC6325EE0540800279F63AC, CreateDatabaseProfile_SYSMAN_08_16_2015_18_59_PM, SYSMAN, Targetless, Targetless, Targetless, 2015-08-16 11:59:44.0, 5

bash-4.1$ emcli get_job_execution_detail -execution=1D6BC98B3CC6325EE0540800279F63AC -xml

<?xml version = '1.0' encoding = 'UTF-8'?>

<jobExecution jobOwner="SYSMAN" status="5" startTime="2015-08-16 11:59:44.0" id="1D6BC98B3CC6325EE0540800279F63AC" jobName="CreateDatabaseProfile_SYSMAN_08_16_2015_18_59_PM" statusBucket="-5">

<TargetList/>

<steps/>

</jobExecution>

bash-4.1$ emcli get_job_execution_detail -execution=1D6BC98B3CC6325EE0540800279F63AC -xml -showOutput

<?xml version = '1.0' encoding = 'UTF-8'?>

<jobExecution jobOwner="SYSMAN" status="5" startTime="2015-08-16 11:59:44.0" id="1D6BC98B3CC6325EE0540800279F63AC" jobName="CreateDatabaseProfile_SYSMAN_08_16_2015_18_59_PM" statusBucket="-5">

<TargetList/>

<steps/>

</jobExecution>

I enabled SQL tracing for EM sessions and found some internal queries executed under the hood when I request job logs.

I have constructed below query and it looks like that this query can be used to obtain the job logs:

SELECT level, s.step_guid, s.inner_execution_guid, s.exec_id, ex.execution_id, 'emcli get_job_execution_detail -execution='||s.exec_id||' -xml -showOutput' emcli_cmd

FROM EM_PAF_STATES s, MGMT_JOB_EXEC_SUMMARY ex, MGMT_JOB job

WHERE s.execution_guid = ex.execution_id

and job.job_id(+) = s.job_id

start with ex.execution_id = '1D6BC98B3CC6325EE0540800279F63AC' --<execution_id>

connect by prior s.inner_execution_guid = ex.execution_id

order by s.started;

At least this query returns emcli commands that can be used to return all logs for DB Profile creation job.

I'm looking for a more documented and officially supported approach to accomplish my task.

Any recommendations will be highly appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2015
Added on Aug 16 2015
0 comments
410 views