Proactively Monitoring your Database

Proactively Monitoring your Database

A Creating a Tablespace and Table with a Specified Treshold
B. Triggering a Tablespace Space Usage Alert
C. Setting up Notifications

1. Click the Server link on the database home page.
2. Click the Tablespaces link.
3. Click the Create button.
4. Enter TBSALERT as the tablespace name and then click
Add to define a datafile for the tablespace.
5. Enter tbsalert01.dbf as the datafile name and 20 MB
as the filesize. Click Continue.Click OK to create the tablespace.
6. Select your new tablespace, TBSALERT, and click Edit.
Click Thresholds to specify the space used warning and critical threshold levels
7. Select Specify Thresholds in the Space Used (%) section.
Enter 60 for the Warning%, and the critical threshold level of 68%.
Click Apply
8. You receive an update confirmation message. Click the Database
Instance link to go back to the Server property page
9. Select the Schema tab. Click the Tables link in the Database Objects section.
10. Click Create
11. Accept the default of Standard, Heap Organized and click
Continue.
12. Enter employees1 in the Name field. Specify SYSTEM as the schema
and TBSALERT as the tablespace. Click on the Define Using
drop-down list and select SQL. The page is refreshed.
Enter select * from hr.employees in the CREATE TABLE AS field.
Click Options
13. Select Yes in the Enable Row Movement drop-down menu.
Click OK to complete the table creation.
14. Your table has been created. Click the Database Instance breadcrumb.

Triggering a Tablespace Space Usage Alert

1. Open a SQL*Plus session and connect as the SYSTEM user as follows:
sqlplus system/<password>
2. Copy and paste the following SQL commands into your SQL*Plus session to simulate user activity on the EMPLOYEES1 table:

begin
for i in 1..1000 loop
insert into employees1
select * from hr.employees;
commit;
end loop;
end;
/

3. Return to Enterprise Manager and click the Tablespaces link on the Server page
4. Notice that the TBSALERT tablespace space used percentage has increased.
5. Return to the SQL*Plus window and copy and paste the following commands into your SQL*Plus session to simulate more user activity on the EMPLOYEES1 table:

delete employees1 where department_id = 50;
begin
for i in 1..500 loop
insert into employees1
select * from hr.employees;
commit;
end loop;
end;

6.Go to the Enterprise Manager window. Refresh your browser (for Linux Mozilla, select View from the menubar then select Reload). Notice that the TBSALERT tablespace space usage percentage has increased.

7. Switch back to the SQL*Plus window and copy and paste the following commands into your SQL*Plus session to simulate more user activity on the EMPLOYEES1 table:

begin
for i in 1..500 loop
insert into employees1
select * from hr.employees;
commit;
end loop;
end;
/

8. Copy and paste the following SQL commands into your SQL*Plus session to simulate user activity on the EMPLOYEES1 table:

delete employees1 where department_id = 30;
commit;
delete employees1 where department_id = 100;
commit;
delete employees1 where department_id = 50;
commit;
delete employees1 where department_id = 80;
commit;

exit

9. Go to the Enterprise Manager window. Refresh your browser
(for Linux Mozilla, select View from the menubar then select
Reload). Notice that the TBSALERT tablespace space usage percentage
has now exceeded the critical threshold level of 60%.

10. While you are waiting for the space usage alert to be displayed
on the Enterprise Manager home page, review the table segment
statistics. Click the Database breadcrumb, the Schema tab and then
click the Tables link.

11. To locate the SYSTEM.EMPLOYEES1 table, enter system in the
Schema field and emp in the Object Name field. Click Go.

12. Select the EMPLOYEES1 table. Click Edit.

13. Click Segments.

14. Notice the percentage of wasted space in the EMPLOYEES1 table. You may be able to resolve the tablespace space usage alert by reclaiming unused space in this table.

On this same page, you can project the EMPLOYEES1 table's future
space usage by specifying a date range for Space Usage Trend and
clicking Refresh. Because there has not been enough activity
history on the EMPLOYEES1 table, you will not see very meaningful
data in the space usage analysis graph. Click the Database tab.

15. Click the browser refresh/reload button a few times.
Scroll down to the Space Summary section of the Home page.
Locate a red x and a number next to Problem Tablespaces.
Scroll down to the Alerts table.


16.You should see a Tablespaces Full alert. Click the Tablespace
TBSALERT is 75 percent full link. (Note: Your system may display
slightly different data).

17. The Tablespaces page is displayed. Note that recommendations are given on how to resolve the issue by clicking on the Segment
Advisor Recommendations button. However, for the purposes of
this exercise, do not make any changes at this time. Note: If
you do not see the graph, manually refresh the page.

18. Remain on this page to continue with the next exercise.

Setting Up Notification

You can optionally provide notification when events that require your intervention arise. By default, alerts in critical state such as Database Down, Generic Alert Log Error Stats, and Tablespace Used are set up for notification. Perform the following:

1.
Click Setup at the top of the Database home page.




2.
Click Notification Methods.




3.
Enter <your mailserver> in the Outgoing Mail (SMTP) Server field, dbaalert in the Identify Sender As field and notify01@oracle.com in the Sender's E-mail Address field and click Apply.




4.
Your update was successful. Click Preferences at the top of the page.




5.
Click Add Another Row in the E-mail Addresses section.




6.
Enter notify01@oracle.com as the email address and click Apply. Then click Database to return to the Database Home page.




Back to Topic

Diagnosing and Resolving Performance Problems
At times database performance problems arise that require your diagnosis and correction. Sometimes problems are brought to your attention by users who complain about slow performance. Other times you might notice performance spikes in the Host CPU chart on the home page.

In all cases, these problems are flagged by the Automatic Database Diagnostics Monitor (ADDM), which does a top-down system analysis every 60 minutes by default and reports its findings on the Oracle Enterprise Manager Home page. ADDM runs automatically every 60 minutes to coincide with the snapshots taken by the Automatic Workload Repository (AWR). Its output consists of a description of each problem it has identified, and a recommended action.

A Creating a Performance Finding
B. Resolving the Performance Finding using ADDM
Creating a Performance Finding

To show how ADDM works, you will create a performance finding. In this case, you will create a session waiting on a row lock. To perform certain operations such as updates and deletes, the session must obtain a lock on the row. Perform the following steps to create a performance finding:

1.
Open a terminal window and execute the following commands:

sqlplus hr/<password>
create table emp as select * from employees;
delete emp;




2.
Open another terminal window and execute the following commands to create a row locking conflict:

sqlplus hr/<password>
delete emp;




3.
Click Performance in your Enterprise Manager window.




4.
Click Application in the Average Active Sessions section.


You see that the sessions waiting is very high. Wait about 10 minutes and scroll down to the bottom of the window.

.



5.
You will now create a snapshot to capture the performance finding. Click on Snapshots.




6.
Click Create to create a snapshot.




7.
Click Yes to create a Manual Snapshot.




8.
Once the snapshot is created, click the Database tab.




9.
Scroll down the page. A performance finding is now detected and displayed as an alert in the ADDM Performance Analysis section.




Back to Topic

Resolving the Performance Finding using ADDM

When a performance finding is encountered, you can use ADDM to resolve it. Perform the following:

1.
Click the finding Row lock waits.




2.
Click the SQL ID in the Rationale section.




3.
Review the information on the SQL Details page. Click the Database Instance breadcrumb.




4.
Click Performance. Scroll down and select Blocking Sessions under Additional Monitoring Links.

Note: If Blocking Sessions does not appear in the Additional Monitoring Links, click Home to return to the Database Home page, and then click the Performance tab again.




5.
Make sure the highest level HR is selected and click Kill Session.




6.
Click Yes to kill the session.




7.
The session has been killed. Click the Database tab .




8.
Return to your SQL*Plus sessions and exit from each.



Back to Topic

Using the SQL Tuning Advisor
Create a directory named $HOME/wkdir. Download the sqltune.tar file and unzip the file into the $HOME/wkdir directory. Perform the following steps:

1.
Connect as SYSDBA in Enterprise Manager Database Control and navigate to the Performance tab of the Database Control Home page. On the Performance page, make sure that the View Data field is set to Real Time: 15 second Refresh.




2.
Open a terminal emulator window connected as the oracle user. Change your current directory to your wkdir directory. Then, enter the following command from the OS prompt:

./setup_dina.sh




3.
Execute the start_dinas.sh script as follows:

./start_dinas.sh




4.
Return to Enterprise Manager and observe the Performance page for six minutes.




5.
Return to your Database Home page. You will now determine the problem. If the time corresponding to the problematic time period corresponds with the latest ADDM run detected by Database Control, you should find the link corresponding to the correct performance analysis directly in the ADDM Performance Analysis section of the Database Control home page. If you do not see the ADDM results, return to the Performance page and click the View ADDM Run icon below the Average Active Sessions graph.

Click the finding with the highest impact on the database time. It should correspond to a SQL Tuning recommendation.




6.
On the Performance Finding Details page you see the high-load SQL statement captured by the ADDM analysis. The information provided indicates that there will be a significant benefit if you tune this statement. Click the SQL text.




7.
The SQL Details page is displayed. Click Schedule SQL Tuning Advisor.




8.
The Schedule Advisor page is displayed. Click Submit.




9.
The SQL Tuning Advisor task is scheduled. The page will advance when the task completes.




10.

Recommendations are displayed. In this case, the recommendation is to create a SQL Profile in order to get a better execution plan. Click Implement.




11.
On the Confirmation window, click Yes.




12.
The SQL Profile is created.




13.
Return to your terminal window. To see the changes you implemented, you must re-execute the SQL. Stop and start the workload by executing the following commands:

./stop_dinas.sh


./start_dinas.sh




14.
Return to Enterprise Manager and access the Performance page to see the benefit of your tuning.




15.
Return to your terminal window. Clean up your environment by executing the following commands:

./stop_dinas.sh


./cleanup_dina.sh




Back to Topic List

Using the SQL Access Advisor
The SQL Access Advisor provides a number of procedures which can be called to help decide which materialized views and indexes to create and drop. It makes this decision using either a hypothetical workload, which it bases on your schema, or from an actual workload which can be provided by the user, from Oracle Trace or from the contents of the SQL cache.

Workloads may also be filtered according to different criteria, such as only use queries containing these tables or queries which have a priority between this range.

A Preparing the Environment
B. Using the SQL Cache to Get Recommendations
C. Reviewing and Implementing the Recommendations
Preparing the Environment

To prepare the environment for using the SQL Access Advisor, perform the steps below. Materialized views and indexes can be present when the advisor is run, but for the purposes of this example they are removed so that you can see what the advisor will recommend. You need to also set up the cache so that the SQL Access Advisor can generate recommendations. Perform the following:

1.
Open a terminal window and execute the following commands to clean up your environment:

sqlplus system/<password>

SELECT * FROM user_objects
WHERE object_type = 'MATERIALIZED VIEW';


If any of the following materialized views exist, delete them as shown:

DROP MATERIALIZED VIEW all_cust_sales_mv;
DROP MATERIALIZED VIEW costs_mv;
DROP MATERIALIZED VIEW costs_pm_mv;
DROP MATERIALIZED VIEW cust_sales_mv;
DROP MATERIALIZED VIEW some_cust_sales_mv;
DROP MATERIALIZED VIEW cust_id_sales_aggr;
DROP MATERIALIZED VIEW sales_cube_mv;
DROP MATERIALIZED VIEW sales_gby_mv;
DROP MATERIALIZED VIEW CUST_TOTAL_SALES_MV;
DROP MATERIALIZED VIEW CUST_SALES_TIME_MV;


2.
Now you need to create the cache. Ensure that the SH user is unlocked and then execute the following commands:

alter system flush shared_pool;
grant advisor to sh;


connect sh/<password>;
SELECT c.cust_last_name, sum(s.amount_sold) AS dollars,
sum(s.quantity_sold) as quantity
FROM sales s, customers c, products p
WHERE c.cust_id = s.cust_id
AND s.prod_id = p.prod_id
AND c.cust_state_province IN ('Dublin','Galway')
GROUP BY c.cust_last_name;


SELECT c.cust_id, SUM(amount_sold) AS dollar_sales
FROM sales s, customers c WHERE s.cust_id= c.cust_id GROUP BY c.cust_id;
select sum(unit_cost) from costs group by prod_id;






Back to Topic

Using the SQL Cache to Get Recommendations

You will use the SQL Cache you just set up to obtain recommendations from the SQL Access Advisor. Perform the following:

1.
Scroll to the bottom of the Database Home page and click Advisor Central under Related Links.




2.
Click the SQL Advisors link.




3.
Click SQL Access Advisor.




4.
Select Recommend new access structures and click Continue.




5.
Ensure Current and Recent SQL Activity is selected. Expand Filter Options.


Select Filter Workload Based on these Options. Select Include only SQL statements executed by these users. Enter SH in the Users field and click Next.




6.
Select Indexes and Materialized Views and click Next.




7.
Enter the task name SQLACCESS<Today's Date>, select Standard for the Schedule Type and click Next.




8.
At the summary window, click Submit.




9.
A confirmation message appears.



Back to Topic

Reviewing and Implementing the Recommendations

Now you can look at the results and implement them if you wish. Perform the following:

1.
On the Advisor Central page, ensure your job is selected and click View Result.




2.
The Summary page is displayed. Click Recommendations.


Click on the Recommendation ID 1 to see the details of the Recommendations.




3.
Here you can customize the Object Name, Schema and Tablespace to implement the recommendations. Scroll down and change the Schema Name for the Create Materialized View to SH and click OK.




4.
To implement the recommendations, click Schedule Implementation.




7.
Enter SQLACCESSIMPL<today's date> for the Job Name and click Submit.




8.
Your implementation job was created and is now executing.




9.
Click Database to return to the Database Home page. Click Schema.




10.
Click Materialized Views in the Materialized Views section.




11.
Enter SH in the schema field and click Go.




12.
Notice that the newly created Materialized View appears in the list. Click the Database breadcrumb then click the Home tab.




Back to Topic

Enabling Automatic Shared Memory Management Using the Memory Advisor
In this section, you will proactively manage and automate some of the tasks related to Oracle Instance memory configuration. By automating memory configuration, you have more time to deal with real application or business issues that affect your enterprise.

The Memory Advisor is an intelligent expert system within the Oracle database that proactively determines optimal settings for various SGA and PGA components. When automated, Oracle will automatically adjust the settings for the various pools and caches according to the requirements of the workload.

In this section you will verify that automatic shared memory management is enabled. If it is disabled, you can enable it by following the steps outlined below.

1.
Scroll down to the bottom of the home page and click on Advisor Central under Related Links.




2.
Select Memory Advisors.




3.
Confirm that Automatic Shared Memory Management is enabled. If you would like to disable Automatic Shared Memory Management, click Disable. Click the Database tab to return to the Database Home page.




Back to Topic List

Summary

In this tutorial, you learned how to:

Create a tablespace with a specified threshold.
Triggering a tablespace usage alert.
Set metric thresholds.
Create a performance finding.
Solve the performance finding using ADDM.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值