Chapter 13. Extending the PDBA Toolkit

   

In the preceding chapters we've introduced the Perl DBA Toolkit and tried to impress you with all the wonderful ways it can help make Oracle database administration more effective and efficient. But every site, and every DBA, is different. You will undoubtedly find that some of the scripts and supporting modules in the toolkit don't operate quite as you would like them to. You may also find that some of the scripts give you good ideas for other scripts you wish we had included. [1] Here are a few examples of PDBA Toolkit behavior that you may decide you want to modify:

[1] Following Vilfredo Pareto's 80-20 rule, most people end up being happy with 80% of a code library written by someone else but discover that the other 20% could stand improvement. The code might fail to fit the way we work, or we might just succumb to a moonlight programming urge and find tweaking irresistible. Tweaking is fine, but the particular way you tweak is quite important. A little forethought and planning can save you a lot of time later on. That's what this chapter is all about.

Formatting

You may want to change the way that data is displayed in the dba_jobsm.pl script, which reports on the DBA_JOBS view from multiple databases.

Logging

You may want to change the PDBA::LogFile module to create a unique file name at each invocation.

Data retrieval

You may want to change the default return type in PDBA::GQ from a hash reference to an array reference

Configuration files

You may want to modify the PDBA::ConfigFile module to alter the paths where it searches for configuration files.

Security

You may want to use a different form of cryptography in the PDBA::PWD module (it currently uses Crypt::RC4 ).

In writing the software in the toolkit, and in describing the scripts and modules in this book, we've tried to "expose the code" ” show you as clearly as possible how we've implemented the logic. One of our goals in developing this toolkit was to provide a ready-to-run set of DBA scripts, of course. But another goal was to supply a framework for you to improve our scripts and to write your own. In this chapter, we'll go a step further with the toolkit. We'll work through two extended examples, showing you some existing scripts and modules and demonstrating how you can change them to suit your specific needs.

The script example

In this example, we'll look at the problem of checking on scheduled jobs in an Oracle database and providing an easy way to report on those jobs. We'll work through the dba_jobsm.pl script in detail, showing our solution, and we'll suggest ways for you to change the script until it suits you.

The module example

In this example, we'll look at two different modules, PDBA and PDBA::GQ . For PDBA , we'll show how you can add a method. For PDBA::GQ , we'll show how you can write code that deals with NULL values returned by Oracle. Both modifications help make processing more efficient.

   


Perl for Oracle DBAs
Perl for Oracle Dbas
ISBN: 0596002106
EAN: 2147483647
Year: 2002
Pages: 137

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net