The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

orac_Oracle.pm - the Oracle module to the Orac tool

DESCRIPTION

This code is a database object that can be created by the Orac tool. It inherits from orac_Base, which has all the basic data and methods. Some of those are called from here, some are overridden, most are inherited and used as is.

PUBLIC METHODS

&new() &init1() &init2() &dba_user()

new

This constructor method basically sucks up the orac_Base functions to create the orac_Oracle object.

init1

This sets some environmental variables that DBD::Oracle requires to get to the right database.

init2

Picks up a few values used again and again by the rest of the orac_Oracle object (eg: block size).

tune_wait

Works out if anything is waiting in the database and then produces the relevant report.

tune_pigs

This function gives you two differing reports which measure the Shared Pool disk reads for various SQL statements in the library.

who_what

Works out who is holding whom, so we can unblock needless locking. Gives you various options for trying to view the blocking SQL. Gives a schematic report to try and pinpoint the offending program.

all_stf

Takes particular PL/SQL statements, and generates DDL to recreate ALL of a particular object in the database.

orac_create_db

Generates a script with which you can completely regenerate the skeleton of your database (files, users, etc).

selected_error

Pumps out information on a particular error. This error comes from the pick-list error screen, which detects invalid objects in the database.

univ_form

A complex function for generating on-the-fly Forms for viewing database information. This examines DBA tables, and works out how to build the form. Then it asks the user to input SQL, and order the way it comes back.

Once this is done, Orac goes off and fills the on-the-fly data viewer with the required information.

selector

User may wish to narrow search for info with universal form, down to a particular set of rows, and order these rows. This function helps univ_form() and allows them to do that.

and_finally

Now we've built up our full SQL statement for this table with selector(), fill a Perl array with everything and display it in the univ_form(), on-the-fly viewer.

calc_scale_record

This whizzes backwards and forwards through the univ_form() records' array, displaying up the required information.

go_for_gold

Work out which row of information to display, and then display it. The name of this function comes from a very bad 80's TV show, hosted by Henry Kelly :)

build_ord

It all gets a bit nasty here. This works out the user's intentions on how to order their required information for the univ_form() set of functions.

now_build_ord

This helps build up the ordering SQL string.

really_build_index

Picks up everything finally reqd. to build up the DDL for index creation. It then works out the exact DDL, including INITIAL and NEXT sizes, to create a particular index, on a particular database object.

ind_prep

Small helper function for working out Index DDL.

j_inri

Here lies the end of sanity. Welcome! This function drove me mad when I first wrote it. It basically takes several lines of radiobuttons, and makes sure only one of the is set in each column. This is used to help the user select the correct ordering for their table selections. There must've been an easier way than this, but it worked at the time, looked nice, and still works now, so I'm leaving it alone. I'll let you work out what j_inri stands for.

work_out_why

Works out new Y-coordinate positions for various simple canvas graphs called by Orac.

add_item

Produces rectangular bar line on canvas for simple charts.

dbwr_fileio

Works out File/IO and produces graphical report.

this_pak_get_y

Another small helper function to increment the Y-coord values on simple Canvas line graphs.

dbwr_print_fileio

Prints out lines required for File/IO graphical report.

errors_orac

Creates Viewer window, for selecting invalid database objects. Once this is done, all the reported compilation errors on the object are printed in the main screen.

dbas_orac

Creates DBA Viewer window, for selecting various DBA_XXXX tables, which can then be selected upon.

addr_orac

Produces a list of all the PADDR addresses in the database, to help a DBA examine what's running. Useful info for deciding what to kill off in a locked up database.

sids_orac

Produces a list of all the SIDs in the database, to help a DBA examine what's running. Useful info for deciding what to kill off in a locked up database.

gh_roll_name

Produces Rollback report.

gh_roll_stats

Produces Rollback Statistics report.

gh_pool_frag

Produces reports trying to determine shared pool fragmentation, etc.

explain_plan

Produces a scrolling box, with which to view all of the SQL code in the database library. If the user is the logged-on user, gives Orac user opportunity to "Explain Plan". Alternatively, Orac user can clear screen and input their own new SQL to "Explain".

explain_it

Takes the SQL statement directly from the screen and tries an 'Explain Plan' on it. I'm leaving the SQL hard-coded here so you can see EXACTLY what's going on, particularly as we're dipping our toes into DML.

calc_scale_sql

Whizz backwards and forwards through the v$sqlarea records, picking up the right ones to put into the SQL Browser.

pick_up_sql

Takes a DBI information array, and takes out the correct required line from it, and pastes it onto the screen. What fun! :)

check_exp_plan

Check if the currently logged on DBA user has a valid PLAN_TABLE table to put 'Explain Plan' results to insert into.

block_size

Reads storage of the required Block Size value from a package variable, and then gives it back to the caller.

who_hold

One of my most life-saving functions. This works out which user is blocking which user is nasty lockup situations. Kill, is usually the answer.

mts_mem

Report for finding MTS statistics, and providing secondary button to reveal further stats.

do_a_generic

On the final level of an HList, does the actual work required.

Takes the final PL/SQL function, runs it, and then splatts out the results into a DialogBox for the User to peruse.

tab_det_orac

Produces simple graphical representations of complex percentage style reports.

dev_tables

Creates DBA Viewer window, for selecting various DBA_XXXX tables, which can then be selected upon.

dev_png

Creates various graphs and inserts them into a pop-up screen.