User Defined Policies, Step by Step Example - Oracle

42 downloads 20 Views 854KB Size Report
The following step by step example will walk you through creating a User Defined Metric and User Defined Policy with. Oracle Enterprise Manager. In this case ...
USER DEFINED POLICY AND METRIC

STEP BY STEP EXAMPLE FOR CREATING USER DEFINED POLICIES AND METRICS Oracle Enterprise Manager Release 10.2.0.5 provides a simplified User Defined Policy and User Defined Policy Group Step by step example of creating a user Defined Metric and User Defined Policy User Defined metric • Utilize Oracle Enterprise Manage • Management Repository Views

interface. This allows System and Database Administrators to mitigate system vulnerabilities by defining and implementing configuration policies based on operation best practices, governance and industry standard requirements. The following step by step example will walk you through creating a User Defined Metric and User Defined Policy with Oracle Enterprise Manager. In this case the User Defined Metric will be utilized by the Policy. Step 1, User Defined Metric In the following Step by step example, we will create a User Defined Metric to be utilized by a User Defined Policy in the next step. A user defined metric is only needed when the necessary information/metric is not already collected by Oracle Enterprise Manager. To understand the Oracle Enterprise Manager collected information/metrics please view the Oracle Enterprise Manager Extensibility Guide, section on Management Repository Views.

Start by:

In a database instance create a user called OPS$TEST Create user OPS$TEST identified by Oracle Grant connect,resource to OPS$TEST Create a table as OPS$TEST create table app_table(col1 varchar(5),col2 varchar(5));

1

USER DEFINED POLICY AND METRIC

1, Log into the Enterprise Manager Console. Select Targets tab and select Databases target type. Click on a Name of a database instance to go to Home page for that database

2, Select User-Defined Metrics at the bottom of the page.

3, Select Create button

2

USER DEFINED POLICY AND METRIC

4, Enter the UDM Details as follows:

The SQL Query is: select object_name,owner from dba_objects where owner not in ('SYS','SYSTEM','SYSMAN','PUBLIC','WMSYS','DBSNMP',' ORACLE_OCM') order by object_name

3

USER DEFINED POLICY AND METRIC

5, Select Test button to see the following Test Results

6, Click OK to save and return to UserDefined Metrics page

After some time the metric will be evaluated. At which time you can use the results by selecting the ‘+’ in the details columns.

You can now move on to creating the User-Defined Policy.

4

USER DEFINED POLICY AND METRIC

Step 2, User Defined Policy

The following example will generate a User Defined Policy for the Metric you just created

7, Select Compliance tab and Library Sub-tab to view the Policy Library. Then Select Create… to create a new Policy. ( You must be SYSMAN to proceed. )

8, Fill in the Policy Information as shown and select Next.

9, Enter the SQL specified below and select Next.

5

USER DEFINED POLICY AND METRIC

SELECT v.target_guid as TARGET_GUID, key.key_part2_value as OBJECT_NAME, v.string_value as OWNER from mgmt_current_metrics v, mgmt_metrics_composite_keys key where v.metric_guid in (select METRIC_GUID from mgmt_metrics where METRIC_NAME = 'SQLUDMSTR' and target_type='oracle_database' AND METRIC_COLUMN = 'StrValue' ) and key.target_guid = v.target_guid and key.composite_key = v.key_value and key.key_part1_value = AppUsersOwningObjects' and v.collection_timestamp > sysdate -1 10, Change the columns to 2, Condition to SQL and enter the Where clause as shown. Then click Next.

11, Select the Database Instance where you created the OPS$TEST user and select Run Test. You should see the results as shown containing 1 row violation. Select Next

6

USER DEFINED POLICY AND METRIC

12, Change the Frequency to 1 hour and select Next

13, Review the information for accuracy and select Finish.

14, Return to the Database Instance Home page and select Metric and Policy Settings.

7

USER DEFINED POLICY AND METRIC

15, Click Add Policies. For clarity, all other Policies have been removed ).

16, Find and select the newly created Policy and select Continue.

17, Select Yes.

18, Be sure to select OK to add the policy.

8

USER DEFINED POLICY AND METRIC

19, Select Ok.

20, Return to the Grid Control Home page, change the View to be Database Instance and then click on the Critical Instance Policy Violation Link.

21, You can see the Policy Violation for your test database.

22, Click on the Violation Count link (1) to see the details of the violation.

9

USER DEFINED POLICY AND METRIC

Copyright © 2009, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. 0109

10