Vous êtes sur la page 1sur 8

Creating Custom Grid Report for database availability Oracle Enterprise Manager GRID Server contains built in reports

to support Database Administrators to generate sightly reports. However, in my company, we need some reports that cannot be find in GRID and needs custom development. Here is how i did it. First Thing is to click to "Reports" tab on the top, right hand side of the GRID Management Console (figure_grid_management_console). This page is where all the predefined and custom reports can be find. Now click on the "Create" Button on top of the page to create a new custom report. "Create Report Definition" page comes to the screen. There are four tabs for the definition of the report.

figure_grid_management_console General After specifiying title of the report then select category and subcategory from the comboboxes. Category and subcategory defines our newly custom report's group and standing place in the reports list of the GRID reports page. You can also create new categories by clicking the buttons between the comboboxes. Targets section enables you to limit the available list of target selection while generating the report or you can select a specified target to be used. I used "Specified Target" and left the

textbox blank because this report will apply to all database and rac targets and is not allowed to be changed. You can enable to select time periods by end user or you can preset the time period from the "Time Period" section (figure_create_report_general_tab). This custom report always displays the last known and most updated state of the databases uptimes and downtimes.

figure_create_report_general_tab Elements In the Elements tab, you can define the report elements and their positions in the report page (figure_add_elements_1). Report elements are structures that displays selected data from the GRID Servers repository. Click "Add" Button to add elements. I used IPMSG_USER_CHART_FROM_SQL and IPMSG_USER_TABLE_FROM_SQL elements (figure_add_elements_2). Click on the "Set Parameters" icon on the right hand side of the listed items to obtain a statement for the elements (figure_add_elements_2). Here you can enter the sql statement that brings data into the element from Management Servers repository. Following you can find the sql statements for the elements.

figure_add_elements_1

figure_add_elements_2

figure_add_elements_2 IPMSG_USER_TABLE_FROM_SQL select target_name, target_type, sum(up_time) up_time, sum(down_time) down_time, sum(blackout_time) blackout_time, trunc(sum(up_time)/(sum(nvl(up_time,1))+sum(nvl(down_time,1)))*100) availability_pct from ( select target_name, target_type, sum(trunc((nvl(end_timestamp,sysdate)-start_timestamp)*24)) total_hours,

case availability_status when 'Target Down' then 0 when 'Target Up' then 0 when 'Blackout' then sum(trunc((nvl(end_timestamp,sysdate)-start_timestamp)*24)) end blackout_time, case availability_status when 'Target Down' then 0 when 'Target Up' then sum(trunc((nvl(end_timestamp,sysdate)-start_timestamp)*24)) when 'Blackout' then 0 end up_time, case availability_status when 'Target Down' then sum(trunc((nvl(end_timestamp,sysdate)-start_timestamp)*24)) when 'Target Up' then 0 when 'Blackout' then 0 end down_time, availability_status from MGMT$AVAILABILITY_HISTORY where target_type in ('oracle_database','rac_database') and availability_status in ('Target Down','Target Up','Blackout') group by target_name, target_type, availability_status order by target_name, availability_status ) group by target_name, target_type order by target_name

--sample output:

TARGET_NAME ----------ACTV ACTV_ACTV1 ACTV_ACTV2 ARCH.AVEA.COM ARCHCM ARCHDB

TARGET_TYPE ----------rac_database

UP_TIME ------4823

DOWN_TIME --------0 0 0 0 1126 0 31 0 2

BLACKOUT_TIME ------------1 1 1 0 0 653 652 652 0

AVAILABILITY_PCT ---------------100 100 100 100 66 100 99 100 99

oracle_database 4823 oracle_database 3964 oracle_database 3334 oracle_database 2210 rac_database 3858

ARCHDB_ARCHDB1 oracle_database 3514 ARCHDB_ARCHDB2 oracle_database 3725 ASPDB ... oracle_database 1750

IPMSG_USER_CHART_FROM_SQL

select availability_status, sum(trunc((end_timestamp-start_timestamp)*24)) total_hours from MGMT$AVAILABILITY_HISTORY where target_type in ('oracle_database','rac_database') and availability_status in ('Target Down','Target Up','Blackout') group by availability_status

--sample output:

AVAILABILITY_STATUS ------------------Target Up

TOTAL_HOURS ----------130008

Target Down Blackout

2086 2405

Schedule You can schedule a report to be emailed to an email by setting schedules (figure_schedule_tab).

Access Report creator can define user groups or users who will be allowed to access this report. Here i used user groups (figure_access_tab).

Database availability report is now ready for managers

Vous aimerez peut-être aussi