1. Trang chủ
  2. » Công Nghệ Thông Tin

OReilly perl for oracle DBAs aug 2002 ISBN 0596002106

1,2K 84 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1.184
Dung lượng 7,1 MB

Nội dung

Table of • Contents • Index • Reviews Reader • Reviews • Errata Perl for Oracle DBAs By Andy Duncan, Jared Still Publisher : O'Reilly Pub Date : August 2002 ISBN : 0-596-00210-6 Pages : 620 Slots : 1 Perl is a very powerful tool for Oracle database administrators, but too few DBAs realize how helpful Perl can be in managing, monitoring, and tuning Oracle9i, Oracle8i, and earlier databases You don't need to be a Perl expert to reap the rewards of reading Perl for Oracle DBAs The book explains what you need to know about Perl, profiles the best Perl open source applications available to DBAs, and provides the Perl DBA Toolkit, a comprehensive suite of ready-to-use scripts designed to ease the burden of Oracle database administration Perl for Oracle DBAs By Andy Duncan, Jared Still Table of Publisher : O'Reilly • Contents Pub Date : August 2002 ISBN : 0-596-00210-6 • Index Pages : 620 • Reviews Slots : 1 Reader • Reviews • Errata Copyright Preface Audience for This Book Which Platform and Version? Structure of This Book About the Perl DBA Toolkit and Examples Conventions Used in This Book Comments and Questions Acknowledgments Part I: Introducing Perl for Oracle Chapter 1 Perl Meets Oracle Section 1.1 What is Perl? Section 1.2 The Perl/Oracle Architecture Section 1.3 Perl for Oracle DBAs Section 1.4 For Further Information Chapter 2 Installing Perl Section 2.1 Installing Perl Section 2.2 Installing Perl DBI Section 2.3 Running Perl DBI Section 2.4 Installing Cygwin Part II: Extending Perl Chapter 3 Perl GUI Extensions Section 3.1 Perl/Tk Section 3.2 OraExplain Section 3.3 StatsView Section 3.4 Orac Section 3.5 DDL::Oracle Section 3.6 SchemaDiff Section 3.7 Senora Section 3.8 DBD::Chart Section 3.9 SchemaView-Plus Section 3.10 Open Source Perl IDEs Section 3.11 Open Source Perl GUI Debuggers Chapter 4 Perl Web Extensions Section 4.1 Apache Section 4.2 Oracletool Section 4.3 Karma Chapter 5 Embedding Perl into Apache with mod_perl Section 5.1 mod_perl Section 5.2 Apache::OWA Chapter 6 Embedded Perl Web Scripting Section 6.1 Embperl Section 6.2 Mason Chapter 7 Invoking the Oracle Call Interface with Oracle::OCI Section 7.1 What is Oracle::OCI? Section 7.2 What Is OCI? Section 7.3 Installing Oracle::OCI Section 7.4 Coding with Oracle::OCI Section 7.5 The Future of Oracle::OCI Chapter 8 Embedding Perl into PL/SQL Section 8.1 Communication Between Perl and PL/SQL Section 8.2 Embedding Perl Within Oracle Part III: The Perl DBA Toolkit Chapter 9 Installing the PDBA Toolkit Section 9.1 Introducing the PDBA Toolkit Section 9.2 Toolkit Modules Section 9.3 Installing the PDBA Toolkit for Unix Section 9.4 Installing the PDBA Toolkit for Win32 Section 9.5 Configuring the PDBA Toolkit Chapter 10 Performing Routine DBA Tasks with the PDBA Toolkit Section 10.1 Managing User Accounts Section 10.2 Maintaining Indexes Section 10.3 Killing Sniped Sessions Section 10.4 Managing Extent Usage Section 10.5 Extracting DDL and Data Chapter 11 Monitoring the Database with the PDBA Toolkit Section 11.1 Monitoring the Alert Log Section 11.2 Monitoring the Databases Chapter 12 Building a Database Repository with the PDBA Toolkit Section 12.1 Repository Table Structure Section 12.2 Installing the Repository Section 12.3 Loading the Repository with Data Section 12.4 Reporting on Database Changes Section 12.5 Reporting on SQL Execution Plans Chapter 13 Extending the PDBA Toolkit Section 13.1 Modifying a Script in the Toolkit Section 13.2 Modifying a Module in the Toolkit Part IV: Appendixes Appendix A The Essential Guide to Perl Obtaining Online Information Running Perl Scripts Perl Variable Types: Scalars, Arrays, and Hashes Perl Contexts: Void, Scalar, List, and Boolean Program and Subroutine Parameters Perl References Perl's Object Orientation Appendix B The Essential Guide to Perl DBI DBI Class Methods Database Handles Preparation Statement Handle Methods Database Handles SQL and Cleanup Metadata Oracle-Specific Methods Appendix C The Essential Guide to Regular Expressions The Origins of Regular Expressions Built-in String Handling Functions Regular Expression Concepts Metacharacters Match Suffixes Appendix D The Essential Guide to Perl Data Munging What Is Data Munging? Data-Munging Example: An Inter-Database Transfer Numeric Modules Date Modules Conversion Modules XML Modules Colophon Index Copyright © 2002 O'Reilly & Associates, Inc All rights reserved Printed in the United States of America Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly & Associates books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://safari.oreilly.com) For more information contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly & Associates, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps The association between the image of thread-winged lacewings and the topic of Perl for Oracle DBAs is a trademark of O'Reilly & Associates, Inc Oracle® and all Oracle-based trademarks and logos are trademarks or registered trademarks of Oracle Corporation, Inc in the United States and other countries O'Reilly & Associates, Inc is independent of Oracle Corporation While every precaution has been taken in the preparation of this book, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein Preface There are many books on Perl and many books on Oracle, but until now there have been no books dedicated to describing the relationship between these two popular technologies Our aim is to bridge the gap between the world's leading data-processing language and the world's leading database The Perl language was created with the goal of making "the easy things easy and the hard things possible." Oracle's everexpanding purpose is to provide a complete database environment for the entire interconnected world This mission makes Oracle a tough taskmaster and thus an environment ideally suited to Perl, because being an Oracle database administrator is one of the toughest jobs around Oracle DBAs need enormous intelligence, infinite patience, and considerable courage We think they also need Perl The Perl open source language is a many-splendored thing; you can write scripts with it, develop GUIs with it, create web sites with it, generate XML with it and you can probably hang your towels from it! Perl fills data warehouses and runs on virtually every operating system around Perl is the toolkit without limitations, the salvation of your 24x7 lifestyle If Gandalf the Wizard were to choose a scripting language, he would choose Perl Our mission in this book is to show you how Perl can revolutionize your life as an Oracle DBA We'll focus on four aspects of the Perl/Oracle connection: The Perl language itself We'll introduce you to the Perl language, with its rich history and culture, present some language basics, and shine some light on CPAN, the Comprehensive Perl Archive Network, the main distribution point for Perl modules The Perl/Oracle architecture We'll introduce you to the modules that allow Perl programs to communicate with Oracle databases Perl applications for Oracle DBAs We'll profile about a dozen of the best ready-made applications written in Perl for use by Oracle DBAs These provide help with database administration, monitoring, tuning, and daily troubleshooting They also provide components you can use in your own Perl scripts, should you choose to add a little program development to your daily DBA routine The PDBA Toolkit We'll present, for your enjoyment, an Oracle database administration toolkit we've written ourselves The Perl Database Administration (PDBA) Toolkit contains nearly 100 Perl scripts and reusable modules that perform operations ranging from creating new Oracle users to monitoring the Oracle alert log to building a repository of database information for use in tuning and troubleshooting All of this code is available on the O'Reilly web site (http://www.oreilly.com/catalog/oracleperl/pdbatoolkit) Audience for This Book If you're an Oracle DBA who is trying desperately to keep up with the daily demands of administering, monitoring, and tuning your Oracle databases, this book is for you We are Oracle DBAs ourselves, and we know how difficult your job can be This book provides both information and software that we hope will ease your burden Although the primary audience is Oracle DBAs, many DBAs end up being devel-opers from time to time, and there is no better language than Perl for writing those quick scripts Anyone doing Perl development will find Chapter 7, Chapter 8, and Chapter 13, as well as the appendixes, particularly useful This book assumes no prior experience with Perl, though some knowledge of the language will help you get the most out of the material presented here Although the book's appendixes explore the essential syntax of Perl, Perl DBI (DataBase Interface), Perl's regular expressions, and Perl's data-munging modules, a complete Perl tutorial is beyond our scope Our goal here is to jump-start your explorations into the intersection where Perl meets Oracle We'll provide plenty of suggestions for where to go next on your journey Which Platform and Version? Both Perl and Oracle run on virtually every hardware platform and operating system To demonstrate this ubiquity, we've used a wide variety of OS platforms and Oracle versions in the preparation of this book Oracle versions range from Oracle7.3 through Oracle9i OS platforms include Linux Red Hat 6, Linux SuSE 7.3, Solaris 8, Windows NT 4, Windows 2000, and others We've focused on Unix and Win32 operating systems, but we've also included specific installation instructions for particular operating system variants when necessary Against this irresistible surge of platforms, our immovable rock is the Perl version we've used on all of these operating systems Perl 5.6.1 was the latest stable Perl release available as we wrote this book and developed the toolkit software We also used the most current stable version of Perl DBI, Version 1.20, in conjunction with Perl DBI's Oracle-specific driver module, DBD::Oracle (DataBase Driver for Oracle), Version 1.12 By the time you read this book, it's possible that the latest stable versions on the CPAN web site will have been upgraded, particularly if Perl itself is upgraded to Perl6, which was under development as we wrote this book We'll be updating our toolkit as an open source project in order to cope with any such Perl enhancements square brackets ([]) Perl Perl regex metacharacter square brackets-caret sign ([^]), Perl regex metacharacter square brackets-exclamation points ([! !]), Perl in Embperl template square brackets-hyphens ([- -]), Perl in Embperl template square brackets-plus signs ([+ +]), Perl in Embperl template SSL (Secure Sockets Layer), modules used with LWP.pm tag (spdrvr.pl) STARTUP_EXTPROC_AGENT, debugging external procedures setup statement handle metadata, Perl DBI statement handles, creating statistics, gathering [See StatsView] StatsView 2nd downloading gnuplot installation PNG installation PNG, need for zlib installation installing ps -ef command sv program installing Tk::GBARR Storable downloading Storable package 2nd required by Mason Storable.pm Embperl on Unix, storing data structures in Perl interface with Apache strings functions for handling in Perl interpolated in Perl regexes subroutines, Perl scripts substitution operator, regexes substr function (Perl) suffixes of regexes sv program (StatsView) svplus program SXP (SQL explain plan) repository tables scripts sxp.pl 2nd 3rd command-line options password/privilege messages unique constraint error sxpcmp.pl 2nd 3rd example output sxprpt.pl 2nd 3rd sys_privs_diff_rpt, reporting on changes to system privileges sys_privs_rpt, reporting on system privileges SYSDBA/SYSOPER, login cases for with PDBA::CM [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] table_info method (Perl DBI) table_privs_diff_rpt, reporting changes to table privileges 2nd table_privs_rpt, reporting on table privileges table_rpt, reporting on tables 2nd tables analyzing via ANALYZE command dumping several [See sqlunldr.pl] indexes on [See indexes] in PDBA repository, structure of Oracle data dictionary tables reporting on [See also reports, of database changes]2nd 3rd SXP repository tracking changes to [See PDBA repository] tables method (Perl DBI) tablespace_rpt, reporting on tablespaces tablespaces creating, PDBA repository installation locally managed reporting on taint mode in Perl scripts Template Toolkit templating [See embedded web scripting] TermReadKey.pm installing testing extproc_perl mod_perl on Win32 text processing, modules for Text::Abbrev Text::ParseWords Text::Soundex throttleDelaySeconds parameter (chkalert.pl) time/date information -dateformat option leap seconds in calendar modules parsing 2nd 3rd PDBA repository reports, changing in time/date utilities Time::HiRes, required by Mason TimeDate module 2nd XML::XMLtoDBMS and Tk::GBARR, installing Tk::JPEG DBD::Chart installation using Perl/Tk canvas applications with Tk::PNG, DBD::Chart installation TNS_ADMIN variable cm.conf and Oracletool and 2nd PDBA Toolkit and tnsnames.ora, setting up external procedures trace method (Perl DBI) tracing levels, table of translate operator, regular expressions troubleshooting developer PDBA role/connect PDBA role SQL execution slowdown zzz [See also debugging][See also debugging] Tuning.pm module TWO_TASK variable Oracle::OCI and PDBA Toolkit and type_info method (Perl DBI) type_info_all method (Perl DBI) TZ variable, Date::Manip and [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] uc\/ucfirst functions (Perl) %udat variable UltraEdit (Perl IDE) Unix administering [See StatsView] alert log on background programs configuring chkalert.pl on configuring dbup.pl on configuring Karma on Karma OS monitor agent daemons creating in Perl resource for further information using in Perl directory for PDBA Toolkit scripts installing Apache on APACI installation directory for CGI scripts installing Apache::OWA on installing chkalert.pl on locating/updating chkalert.conf installing Date::Manip on installing DBD::Chart on gd library and GD.pm JPEG and required downloads required libraries required modules Tk::JPEG Tk::PNG installing DDL::Oracle on 2nd installing Embperl on LWP.pm installation modules required installing Karma on MailTools.pm installation TermReadKey.pm installation installing kss.pl on installing Mason on modules required installing mod_perl on build options include paths LWP.pm modules required by LWP.pm optional SSL modules preinstallation security measure specifying mod_perl Apache library installing Oracle::OCI on errors in build, troubleshooting installing Oracletool on installing password server as daemon installing PDBA Toolkit on account to install from Perl modules/scripts installation setting PDBA environment installing PDBAx on installing Perl DBI on installing Perl on from prebuilt package from source installing Perl/Tk on X Windows server access installing SchemaView-Plus on installing XML::Generator::DBI on installing XML::LibXML on installing XML::Parser on installing XML::XMLtoDBMS on running PDBA password server on running Perl scripts on shared objects upDays parameter (dbup.conf) upHours parameter (dbup.conf) URI module XML::Parser and "use strict" line in Perl code user accounts [See accounts] user_rpt, reporting on users username parameter (dbup.conf) %users data structure (pwd.conf) utilities in PDBA Toolkit [See PDBA module] development [See Oracletool] [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] V$INSTANCE parameter (pdbarep_grants.sql) V$PARAMETER parameter (pdbarep_grants.sql) V$SQLTEXT data dictionary table, tracking SQL in variables CGI environment, Apache::Registry and config, referring to by package name naming, Embperl syntax Perl DBI naming conventions Perl hash uninitialized lexical, Apache::Registry and version control system, reporting database changes and _version function (extproc_perl) vertical bar (|), Perl regex metacharacter vi program, regular expressions and [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] wantarray function (Perl) watchdogLength/Time parameter (chkalert.pl) web data, storing persistent web extensions to Perl web forms handling via Embperl storing data associated with web servers [See Apache] web sites for downloading Perl, modules, tarballs, and items related to this book [See downloading] while loops, Embperl syntax Win32 alert log on background programs CGI scripts configuring dbup_NT.pl on configuring Karma on configuring mod_perl on creating daemon in Perl 2nd DDLs directory for PDBA Toolkit scripts environment variables PPM and web resource for extproc_perl and installing Apache on directory for CGI scripts running Apache as console application installing Apache::OWA on installing chkalert_NT.pl on installing Date::Manip on TZ variable installing DBD::Chart on loading DBD::Chart for ActivePerl installing DDL::Oracle on installing Embperl on installing Karma installing kss_NT.pl on installing Mason on installing mod_perl on installing Number::Format on installing Oracle::OCI on ORACLE not available errors on Linux SuSE 7.3 precursor modules required installing Oracletool on securing oracletool.pl installing password server as service installing PDBA Toolkit on additional Perl modules installation registry settings installing PDBAx on installing Perl DBI on installing Perl on local drives installing Perl/Tk on installing SchemaView-Plus on Perl and Perl Apache modules, writing porting Unix applications to [See Cygwin] running Karma on Perl modules, extra running PDBA password server running PDBA password server on Windows NT 4.0/2000 running Perl on, Cygwin and running Perl scripts on service control application, Perl services sniped sessions, killing testing mod_perl on using services in Perl web resource for Apache Win32::Daemon 2nd 3rd chkalert_NT.pl and creating Win32 daemon in Perl PDBA password server and using Win32 services in Perl Windows 2000 installing kss_NT.pl on PDBA password server on starting alert log monitoring service starting kill sniped session service on Windows 95/98 MSI Microsoft Windows program installer Windows NT MSI Microsoft Windows program installer starting alert log monitoring service starting kill sniped session service Windows NT 4.0 PDBA password server [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] X PixMap (XPM), support for X Windows server, Perl/Tk Unix installation and XML (Extensible Markup Language) data parsing [See SchemaView-Plus] database facilities modules database facilities parsers XML::XMLtoDBMS XML-DBMS Version 2.0, forthcoming features XML::Dumper downloading installing XML::Generator::DBI installing on Unix XML::Handler::YAWriter XML::LibXML installing on Unix XML::LibXSLT XML::Parser XML::Parser::PerlSAX XML::XMLtoDBMS installing on Unix modules required by Oracle date format and XML sink input XML sink mapping XML source mapping XML source output XML::XPath xmlGenDBI.pl XPM (X PixMap), support for XSLT (Extensible Stylesheet Language Transformations) [SYMBOL] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Z] zlib program DBD::Chart and ... Introducing Perl for Oracle Chapter 1 Perl Meets Oracle Section 1.1 What is Perl? Section 1.2 The Perl/ Oracle Architecture Section 1.3 Perl for Oracle DBAs Section 1.4 For Further Information... These modules interact to allow Perl programs access to Oracle databases Perl for Oracle DBAs We'll discuss why Perl is a particularly appropriate language for Oracle DBAs to learn and use We'll also provide a list of additional Perl resources... popular and powerful language Perl/ Oracle architecture We'll see how Perl connects to the Oracle database via the Perl DBI module, the DBD: :Oracle program, and Oracle' s own OCI product These modules interact to allow Perl programs access to Oracle

Ngày đăng: 26/03/2019, 16:29