01.09.2016 Views

Beginning Oracle Database 11g Administration From Novice to Professional

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

360<br />

CHAPTER 16 INSTANCE TUNING<br />

1. The users <strong>to</strong>ld the DBA that the problem was restricted <strong>to</strong> certain parts of the<br />

application only and that there had not been a problem the previous day. On<br />

questioning the application developers, the DBA learned that there had been an<br />

application upgrade the previous night.<br />

2. The DBA used the script <strong>to</strong> generate Statspack reports for a 1-hour<br />

period for the previous day and the current day. The DBA also traced a number of<br />

database sessions by using the procedure.<br />

3. Examination of the Statspack report for the current day showed large numbers of<br />

events; sessions were waiting, trying <strong>to</strong> lock an entire table.<br />

These events were not observed in the Statspack report for the previous day. The<br />

table in question was identified by searching through the trace files.<br />

4. The event indicates an unindexed foreign key. If a foreign<br />

key is not indexed, <strong>Oracle</strong> must lock the entire child table when a record is deleted<br />

from the parent table in the foreign-key relationship. The DBA queried the<br />

, , and views <strong>to</strong> identify the missing<br />

index and brought this <strong>to</strong> the attention of the developers.<br />

5. All that was left <strong>to</strong> do was <strong>to</strong> implement the solution in a safe and controlled manner.<br />

The developers followed the necessary change control procedures before<br />

creating the necessary index.<br />

Tip A good question <strong>to</strong> ask during the investigation phase is, “What changed?” If you have installed RDA<br />

as suggested in Chapter 6, you can compare old and new RDA collections by using the option and<br />

determine whether the database environment has changed.<br />

Analyzing DB Time<br />

The best way <strong>to</strong> analyze database performance is <strong>to</strong> find out where the database is<br />

spending time. This is powerfully summarized by the Statspack and AWR reports. To<br />

demonstrate this, I used the Swingbench <strong>to</strong>ol 3 <strong>to</strong> perform large numbers of transactions<br />

in my test database on my lap<strong>to</strong>p. I then used the and scripts<br />

<strong>to</strong> generate the Statspack and AWR reports for a 1-hour period; the scripts can be found<br />

in . Listing 16-2 shows the first page of the Statspack report; the<br />

AWR report contains similar information.<br />

3. The Swingbench <strong>to</strong>ol can be downloaded from .

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!