Forum Stats

  • 3,874,744 Users
  • 2,266,769 Discussions
  • 7,911,962 Comments

Discussions

I want to use execute_sql of emcli within python

User_4Y93Z
User_4Y93Z Member Posts: 2 Red Ribbon
edited Oct 31, 2019 10:46AM in Enterprise Manager

in Oracle 13.2.1 OEM,  I am using emcli tool.  In that I am passing test.py as below

emcli @test.py

cat test.py is as below

login ( username="Admin_user", password="admin_pw" )

myDBs = list( resource="Targets", search="TARGET_TYPE='oracle_database'" )

for DB in myDBs.out()['data']:

    print DB['TARGET_NAME']

    execute_sql -sql="select * from global_name;" -credential_set_name="DBCredsSYSDBA" -targets="DB["TARGET_NAME"],:oracle_database"   <-- That is within the python script, I am trying to call execute_sql.  How to do this?

Answers