Oracle Scripts: Powerful Tools for DBAs and Developers

Oracle Scripts: Powerful Tools for DBAs and Developers

by Brian Lomasky, David C. Kreines
     
 

This book provides a powerful set of tools for Oracle database administrators and developers. During their many years of administering, tuning, and troubleshooting Oracle databases, the authors have developed hundreds of useful scripts. Now you can instantly take advantage of their experience by putting these scripts to work at your own site. DBAs and developers

Overview

This book provides a powerful set of tools for Oracle database administrators and developers. During their many years of administering, tuning, and troubleshooting Oracle databases, the authors have developed hundreds of useful scripts. Now you can instantly take advantage of their experience by putting these scripts to work at your own site. DBAs and developers are constantly reinventing the wheel. Most Oracle sites have similar requirements, problems, and crises, and at most of these sites DBAs and developers find themselves reinventing the wheel by writing the same kinds of scripts — and too often they're writing them under pressure, in hit-or-miss and error-prone fashion.The scripts in this book are tried-and-true. They've been thoroughly tested in many different environments. You can use them right now to simplify the tasks you perform each day — monitoring databases for reliability, protecting your database against data loss, improving performance, increasing security, and building reports that provide insight into the inner workings of Oracle databases. You can also turn to these scripts in emergencies to diagnose system problems and repair databases when the pressure is on.The book includes:

  • Scripts for DBAs — The ways that DBAs structure files, allocate disk space, tune systems, and enforce security have an enormous impact on how efficiently and effectively systems will operate. The scripts in this category analyze performance, check database reliability, produce security and auditing reports, perform backups and restores, and work with the Oracle Applications.
  • Scripts for developers and designers — These scripts help to create, analyze, report, and reverse-engineer the objects in the database. They also allow developers to easily create EXPLAIN PLAN reports on SQL statements, and they provide a front end to RCS (the Revision Control System).
  • Utility scripts — These scripts perform a variety of operating system, file, directory, and memory operations (aimed particularly at UNIX sites). You can customize these scripts for your own operating system. The accompanying CD-ROM provides a comprehensive resource for DBAs and developers. It contains complete source code for all of the scripts described in this book, as well as additional software that you will find helpful in monitoring and improving the performance of your databases.
A brief table of contents follows:Part I: Overview
  • Introduction
Part II: Scripts for DBAs
  • Database Control Utilities
  • Database Performance and Trend Analysis Utilities
  • Database Reliability Monitoring Utilities
  • Database Security Reports and Utilities
  • Database Backup Utilities
  • Oracle Applications Utilities
Part III. Scripts for Developers and Designers
  • Database-Design/DDL Utilities
  • Database Developer Utilities
IV: UNIX Utility Scripts
  • General System Utilities
  • Directory and File Management Utilities
  • Memory Usage Reports
Part V. Appendixes
  • A. SQL Scripts That Create Oracle Tables
  • B. Tables Created by SQL Scripts
  • C. SQL Scripts That Create Output Files
  • D. Output Files Created by SQL Scripts

Product Details

ISBN-13:
9781565924383
Publisher:
O'Reilly Media, Incorporated
Publication date:
05/28/1998
Edition description:
BK&CD ROM
Pages:
204
Product dimensions:
7.01(w) x 9.23(h) x 0.54(d)

Read an Excerpt

Chapter 5: Database security Reports and Utilities

grantall.sql

Directory: $DBA
File Type: SQL Script
Edit Required: No
Output File: grall_tmp.sql, grall.sql

This script creates and then executes a script to grant the specified username (such as OPS$ORACLE) all privileges to all nonsystern objects in a database.

grantool

Directory: $DBA
File Type: Shell Script
Edit Required: No
Output File: Screen

This script grants SELECT access on required tables to a specific user, for use in running the $TOOLS/dbousers, $TOOLS/dbo_sql, and $TOOLS/locks utilities.

Note that if this procedure has a privilege violation when trying to grant access to the V$ tables, you must first run the grantsys.sql script, which will grant SELECT WITH GRANT OPTION to yourself, and then rerun the grantool script.

The script will prompt for the Oracle SID of the database to be accessed, and the username to be granted SELECT access to the required tables.

grantool.sql

Directory: $DBA
File Type: SQL Script
Edit Required: No
Output File: Screen

This script is called by the grantool script to perform the actual grants, as described in the previous section.

grantsys.sql

Directory: $DBA
File Type: SQL Script
Edit Required: No
Output File: Screen

This script grants to the current user account the privileges required to grant other users access to the $TOOLS/dbo and locksutilities (via the grantools script).

You will use this script when your account (typically, OPS$oracle) does not have the SELECT privilege WITH GRANT OPTION on the required V$ tables. The script will prompt you for the SYS account password.

makeops

Directory: $DBA
File Type: Shell Script
Edit Required: No
Output File: Screen
Syntax: makeops sid newuser
sid

The Oracle SID of the database to be accessed.

newuser
The new User ID (less the "OPS$" prefix) to be created.

This script creates a new OPS$ username account for a given user, matching the configuration and privileges of the user's current non-OPS$ account. This allows the DBA to quickly create an OPS$ account for a given user which is otherwise identical to the user's existing account without having to determine and duplicate existing privileges. If an OPS$username account exists, the user can then easily log into the database without having to specify a username or password. Here is an example for SQL*Plus:

sqlplus /

The account is created with an "impossible" password, so that it can only be accessed from the server, and even then only by the sqlplus "/" clause.

Restrictions

  • This script requires that the following files exist:

    $DBA/makeqps.sql
    $DBA/copyusis.sql
    $TOOLS/define
    $T0OLS/fixcase
    $DBA/valid_db

  • An OPS$username account must exist (where username matches your UNIX operating system username). This can be created by executing the creops script.
  • The PWSYS environment variable must exist. This variable must contain the password to the Oracle database's SYS account.
  • The PW environment variable must exist. This variable must contain the password to the Oracle database's SYSTEM account....

Meet the Author

Brian Lomasky is a senior principal consultant with Oracle Corporation Consulting Services. He specializes in Oracle database and UNIX/OpenVMS/WinNT operating system tuning, troubleshooting, configuration, backup and recovery, and database auditing. When he isn't busy creating new scripts to solve day-to-day problems for DBAs, he has been a featured speaker at the national IOUG-A and Oracle OpenWorld conferences, as well as at local user groups.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >