Oracle Administrator's Reference User manual
PDF
Dokument
Reklama
Reklama
Oracle8i Administrator’s Reference Release 2 (8.1.6) for IBM DYNIX/ptx June 2000 Part No. A85265-01 Includes topics on: Administering Oracle8i Tuning Oracle8i Administering SQL*Plus Using Oracle Precompilers and the Oracle Call Interface Configuring Net8 Running Oracle Data Option Demos Optimal Flexible Architecture Oracle8i Administrator’s Reference Release 2 (8.1.6) for IBM DYNIX/ptx Part No. A85265-01 Copyright © 1996, 2000, Oracle Corporation. All rights reserved. The programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee’s responsibility to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of such applications if the programs are used for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the programs. The programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the programs is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error free. Except as may be expressly permitted in your license agreement for these programs, no part of these programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation. If the programs are delivered to the U.S. Government or anyone licensing or using the programs on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer software" and use, duplication, and disclosure of the programs, including documentation, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement. Otherwise, programs delivered subject to the Federal Acquisition Regulations are "restricted computer software" and use, duplication, and disclosure of the programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. Oracle is a registered trademark, and JDeveloper, Net8, Network Computing Architecture, Oracle Call Interface, Oracle Enterprise Manager, Oracle interMedia, Oracle Names, Oracle Parallel Server, Oracle Server Manager, Oracle8i, Pro*COBOL, Pro*FORTRAN, and SQL*Plus are trademarks or registered trademarks of Oracle Corporation. All other company or product names mentioned are used for identification purposes only and may be trademarks of their respective owners. Contents Send Us Your Comments ................................................................................................................... ix Preface............................................................................................................................................................ xi Purpose................................................................................................................................................... xii Audience ................................................................................................................................................ xii Typographic Conventions ................................................................................................................... xii Command Syntax ................................................................................................................................. xiii Accessing Online Documentation ...................................................................................................... xiii Related Documentation ...................................................................................................................... xiv Oracle Services and Support .............................................................................................................. xiv 1 Administering Oracle8i Setting the Environment ................................................................................................................... Displaying Environment Variables............................................................................................ Setting and Exporting the Value of a Variable in a Current Session .................................... Setting a Common Environment................................................................................................ Database Examples....................................................................................................................... Environment Variables for Oracle8i................................................................................................ Oracle Environment Variables on UNIX................................................................................... UNIX Environment Variables Used with Oracle8i.................................................................. Setting the System Time ............................................................................................................ Initialization Parameters ................................................................................................................. Customizing the initsid.ora File................................................................................................ Default Initialization Parameter Values .................................................................................. 1-2 1-2 1-2 1-3 1-4 1-6 1-6 1-8 1-10 1-11 1-11 1-12 iii Database Limits................................................................................................................................. Managing Special Accounts and Groups ..................................................................................... Managing Security............................................................................................................................ Groups and Security................................................................................................................... Security for Server Manager Commands ................................................................................ Security for Database Files ........................................................................................................ Security and Remote Passwords .............................................................................................. Estimating Oracle8i Memory Usage.............................................................................................. Server Resource Limits .................................................................................................................... Controlling the System Global Area............................................................................................. Size Limits of the SGA ............................................................................................................... Calculating the Size of the SGA................................................................................................ Relocating the SGA..................................................................................................................... Building and Running Demonstrations....................................................................................... SQL*Loader Demonstrations .................................................................................................... Administering SQL*Loader....................................................................................................... Loading PL/SQL Demonstrations ........................................................................................... Running PL/SQL Demonstrations........................................................................................... Relinking Executables ..................................................................................................................... 2 Tuning Oracle8i Importance of Tuning......................................................................................................................... DYNIX/ptx Tools ................................................................................................................................ sar .................................................................................................................................................... swap................................................................................................................................................ SQL Scripts ............................................................................................................................... ........... Tuning Memory Management ......................................................................................................... Allocate Sufficient Swap Space .................................................................................................. Control Paging ............................................................................................................................. Hold the SGA in a Single Shared Memory Segment .............................................................. Lock the SGA in Physical Memory ............................................................................................ Optimize Number of Database Buffers ..................................................................................... Use Indirect Database Buffers..................................................................................................... Optimize Number of Redo Buffers ............................................................................................ Optimize the Shared Pool Size.................................................................................................... iv 1-14 1-14 1-16 1-16 1-17 1-17 1-18 1-20 1-21 1-21 1-21 1-22 1-22 1-24 1-24 1-26 1-27 1-28 1-29 2-2 2-2 2-2 2-3 2-4 2-4 2-4 2-5 2-5 2-5 2-6 2-7 2-7 2-7 Verify Data Dictionary Cache Effectiveness............................................................................. Allocate Adequate Library Cache Space................................................................................... Lock Large PL/SQL Blocks into the Shared Pool .................................................................... Tuning Disk I/O ............................................................................................................................... Tune the Database Writer to Increase Write Bandwidth ..................................................... Use Logical Volumes.................................................................................................................. Choose the Appropriate File System Type ............................................................................ Monitoring Disk Performance ...................................................................................................... Disk Performance Issues ........................................................................................................... Tuning CPU Usage ........................................................................................................................... Keep All Oracle Users and Processes at the Same Priority .................................................. Use Processor Affinity and Binding on Multi-Processor Systems ...................................... Tuning Oracle Resource Contention ............................................................................................. Tuning UNIX Kernel Parameters ............................................................................................. Using V$ Tables to Isolate Contention .................................................................................... Isolating the Segment Causing Contention ............................................................................ Reducing Latch Free Contention.............................................................................................. Reducing Rollback Segment Contention................................................................................. Reducing Redo Log Buffer Latch Contention ........................................................................ Reducing Parallel Query/Parallel DML Contention ............................................................ Tuning Spin Count ..................................................................................................................... Tuning Block Size and File Size .................................................................................................... Specifying Oracle Block Size..................................................................................................... Tuning the Buffer Cache Size ........................................................................................................ Tuning Resource Contention for Oracle Parallel Server........................................................... Avoid Index Contention ............................................................................................................ Avoid Free List Contention....................................................................................................... Avoid Lock Contention ............................................................................................................. Localize Disk I/O ....................................................................................................................... Monitor Contention.................................................................................................................... Using Trace and Alert Files ............................................................................................................ Trace File Names ....................................................................................................................... Alert Files .................................................................................................................................... 2-8 2-8 2-9 2-10 2-10 2-12 2-12 2-13 2-14 2-14 2-14 2-14 2-15 2-15 2-15 2-16 2-17 2-18 2-18 2-19 2-20 2-21 2-21 2-21 2-22 2-22 2-23 2-23 2-23 2-24 2-24 2-24 2-24 v Raw Devices and Volumes .............................................................................................................. Disadvantages of Raw Devices and Volumes ....................................................................... Guidelines for Using Raw Devices and Volumes ................................................................. Raw Device Setup ....................................................................................................................... 3 Administering SQL*Plus Administering SQL*Plus................................................................................................................... Setup Files ..................................................................................................................................... The Site Profile .............................................................................................................................. The User Profile............................................................................................................................. The PRODUCT_USER_PROFILE Table ................................................................................... Demonstration Tables ................................................................................................................. Help Facility ................................................................................................................................. Using SQL*Plus ............................................................................................................................... ... Using a System Editor from SQL*Plus ..................................................................................... Running Operating System Commands from SQL*Plus........................................................ Interrupting SQL*Plus ................................................................................................................ Using the SPOOL Command ..................................................................................................... Restrictions ............................................................................................................................... ........... Resizing Windows ....................................................................................................................... Return Codes ................................................................................................................................ 4 3-2 3-2 3-2 3-2 3-3 3-3 3-4 3-5 3-5 3-6 3-6 3-6 3-7 3-7 3-7 Using Oracle Precompilers and the Oracle Call Interface Overview of Oracle Precompilers.................................................................................................... Relinking Precompiler Executables ........................................................................................... Precompiler Configuration Files ............................................................................................... Issues Common to All Precompilers.......................................................................................... Additional Documentation ......................................................................................................... Pro*C/C++ ............................................................................................................................................ Administering Pro*C/C++ ......................................................................................................... Using Pro*C/C++ ......................................................................................................................... Pro*COBOL.......................................................................................................................................... Administering Pro*COBOL ........................................................................................................ Environment Variables ............................................................................................................... Using Pro*COBOL ........................................................................................................................ vi 2-25 2-25 2-26 2-27 4-2 4-2 4-3 4-3 4-4 4-4 4-4 4-5 4-7 4-8 4-8 4-9 Oracle Call Interface ........................................................................................................................ Demonstration Programs ......................................................................................................... User Programs ............................................................................................................................ Oracle Precompiler and Oracle Call Interface Linking and Makefiles ................................ Custom Makefiles ...................................................................................................................... Undefined Symbols ................................................................................................................... Thread Support ................................................................................................................................ Static and Dynamic Linking with Oracle Libraries .................................................................. Oracle Shared Library ............................................................................................................... Using Signal Handlers .................................................................................................................... Signals .......................................................................................................................................... XA Functionality .............................................................................................................................. 5 4-12 4-12 4-13 4-14 4-14 4-15 4-15 4-16 4-16 4-17 4-17 4-20 Configuring Net8 Supplementary Documentation....................................................................................................... Supplementary Information in README Files ...................................................................... Core Net8 Products and Features..................................................................................................... Net8 Files and Utilities................................................................................................................. Net8 Configuration Assistant ..................................................................................................... Net8 Protocol Support ....................................................................................................................... ADDRESS Specification............................................................................................................... BEQ Protocol ....................................................................................................................................... Specifying a BEQ ADDRESS ...................................................................................................... IPC Protocol ........................................................................................................................................ Specifying an IPC ADDRESS ..................................................................................................... RAW Protocol....................................................................................................................................... TCP/IP Protocol Adapter ................................................................................................................... Specifying a TCP/IP ADDRESS .............................................................................................. SPX/IPX Protocol .............................................................................................................................. The ntisbsdm Broadcast Daemon ............................................................................................ The ntspxctl Utility .................................................................................................................... SPX/IPX Protocol Command Summary ................................................................................ The getname Command ........................................................................................................... Specifying the SPX/IPX ADDRESS ........................................................................................ Net8 Naming Support ..................................................................................................................... 5-2 5-2 5-2 5-2 5-4 5-4 5-5 5-6 5-6 5-7 5-8 5-9 5-9 5-10 5-10 5-11 5-11 5-12 5-13 5-15 5-15 vii Configuring Oracle Intelligent Agent for Oracle SNMP .......................................................... Configure Master Agent ........................................................................................................... Configure the Encapsulator ...................................................................................................... Verify start_peer Script ............................................................................................................. Start the SNMP Components .................................................................................................... Oracle Advanced Security ............................................................................................................... .bak Files ...................................................................................................................................... Security and Single Sign-On ..................................................................................................... 6 Running Oracle Data Option Demos Additional Documentation ............................................................................................................... Oracle8i interMedia............................................................................................................................ Text.................................................................................................................................................. Audio, Video, and Image............................................................................................................. Locator............................................................................................................................................ Web Agent and Clipboard........................................................................................................... Oracle8i Time Series Demos............................................................................................................. Oracle8i Visual Information Retrieval ......................................................................................... Oracle8i Spatial ................................................................................................................................. A 5-16 5-16 5-16 5-17 5-17 5-18 5-18 5-18 6-2 6-2 6-2 6-3 6-7 6-9 6-9 6-10 6-12 Optimal Flexible Architecture Optimal Flexible Architecture (OFA).............................................................................................. A-2 Characteristics of OFA-Compliant Database............................................................................ A-2 OFA Implemented on UNIX ............................................................................................................. A-4 Mount Points ................................................................................................................................. A-5 Naming Directories ...................................................................................................................... A-6 Naming Files.................................................................................................................................. A-7 Naming Tablespaces .................................................................................................................... A-9 Exploiting OFA Structure for Oracle Files .............................................................................. A-10 OFA File Mapping ...................................................................................................................... A-11 Raw Device Sizes ........................................................................................................................ A-12 Directory Structure ..................................................................................................................... A-14 Index viii Send Us Your Comments Oracle8i Administrator’s Reference Release 2 (8.1.6) for IBM DYNIX/ptx Part No. A85265-01 Oracle Corporation welcomes your comments and suggestions on the quality and usefulness of this publication. Your input is an important part of the information used for revision. ■ ■ ■ ■ ■ Did you find any errors? Is the information clearly presented? Do you need more information? If so, where? Are the examples correct? Do you need more examples? What features did you like most about this manual? If you find any errors or have any other suggestions for improvement, please indicate the chapter, section, and page number (if available). You can send comments to us in the following ways: ■ ■ ■ Email - [email protected] FAX - 650-506-7304 Attn: Thomas Leah-Martin Postal service: Thomas Leah-Martin Oracle Corporation 500 Oracle Parkway, Mailstop 1op5 Redwood Shores, CA 94065 USA If you would like a reply, please provide your name, address, and telephone number. If you have problems with the software, please contact your local Oracle Support Services Center. ix x Preface This reference supplements the generic server administration information found in the Oracle8i Tuning Guide. This preface contains the following sections: ■ Purpose ■ Audience ■ Typographic Conventions ■ Command Syntax ■ Accessing Online Documentation ■ Related Documentation ■ Oracle Services and Support xi Purpose This guide, with the Oracle8i Release Notes for DYNIX/ptx and the Oracle8i Installation Guide for DYNIX/ptx, describes how to install, configure, and administer Oracle8i Release 2 (8.1.6) on DYNIX/ptx. For additional product information, see the Oracle8i Generic Documentation Set. Audience This guide is intended for anyone administering and tuning Oracle8i Release 2 (8.1.6) on a DYNIX/ptx system. Typographic Conventions The following typographic conventions are used in this guide: monospace Monospace type indicates UNIX commands, directory names, user names, path names, file names, and text quoted from screen output. brackets [ ] Words enclosed in brackets indicate key names (for example, Press [Return]). Note that brackets have a different meaning when used in command syntax. italics Italic type indicates variables, including variable portions of file names. It is also used for emphasis. UPPERCASE Uppercase letters indicate Structured Query Language (SQL) reserved words, initialization parameters, and environment variables. Because UNIX is case-sensitive, conventions in this guide may differ from those used in other Oracle product documentation. xii Command Syntax All examples that show commands or file contents appear in monospace font and assume the use of the Bourne shell. The dollar prompt ($) at the beginning of the UNIX command examples is the default UNIX command prompt. Do not enter it in the examples. backslash \ A backslash indicates a command that is too long to fit on a single line. Enter the line as printed (with a backslash) or enter it as a single line without a backslash: dd if=/dev/rdsk/c0t1d0s6 of=/dev/rst0 bs=10b \ count=10000 braces { } Braces indicate required items: .DEFINE {macro1} brackets [ ] Brackets indicate optional items: cvtcrt termname [outfile] Note that brackets have a different meaning when used in regular text. ellipses ... Ellipses indicate an arbitrary number of similar items: CHKVAL fieldname value1 value2 ... valueN italics Italic type indicates variables. Substitute a value for the variable: library_name vertical line | A vertical line indicates a choice within braces or brackets: SIZE filesize [K|M] Accessing Online Documentation Online documentation is stored on both the Oracle8i for IBM DYNIX/ptx CD-ROM and the Oracle8i Generic Documentation CD-ROM. Oracle8i for IBM DYNIX/ptx Documentation Oracle8i for IBM DYNIX/ptx documentation includes this guide, the Oracle8i Installation Guide for IBM DYNIX/ptx, and the Oracle8i Release Notes for IBM DYNIX/ptx. To access the documentation in HTML and PDF formats, use a UNIX browser to open the index.htm file at the top level of the Oracle8i CD-ROM. This file contains links to product and DYNIX/ptx specific documentation. xiii Oracle Product Documentation Oracle8i product documentation is on the Oracle8i Generic Documentation CD-ROM. Instructions for accessing and installing the documents on the CD-ROM are found in the README file on the top level directory of the CD-ROM. Related Documentation If you are unfamiliar with the concepts or terminology associated with relational database management systems, read Chapter 1 in Oracle8i Concepts before beginning your installation. For information about administering and tuning a production database system, see the following documents: ■ Oracle8i Release Notes for IBM DYNIX/ptx part no. A85267-01 ■ Oracle8i Installation Guide for IBM DYNIX/ptx part no. A85266-01 ■ Net8 Administrator’s Guide ■ Oracle8i Designing and Tuning for Performance ■ Information about migrating or upgrading from a previous release of the Oracle Server is provided in Oracle8i Migration. Oracle Services and Support A wide range of information about Oracle products and global services is available on the Internet, from: http://www.oracle.com The following sections provide URLs for selected Oracle services. Oracle Support Services Contact information for Technical Support in all countries is listed at: http://www.oracle.com/support This site provides templates to help you prepare information about your problem before you call. You also need your CSI number (if applicable) or complete contact details, including any special project information relating to the problem. xiv Products and Documentation Customers in the U.S. can contact the Oracle Store at: http://oraclestore.oracle.com Links to stores in other countries are provided from this site. You can find product documentation at: http://technet.oracle.com Customer Service Global Customer Service contacts are listed at: http://www.oracle.com/support/ Education and Training Training information and worldwide schedules are available at: http://education.oracle.com Oracle Technology Network Register with the Oracle Technology Network (OTN) at: http://technet.oracle.com OTN delivers technical papers, code samples, product documentation, self-service developer support, and Oracle key developer products to enable rapid development and deployment of applications built on Oracle technology. xv xvi 1 Administering Oracle8i The information in this chapter describes tasks specific to administering Oracle8i on DYNIX/ptx. It contains the following sections: ■ Setting the Environment ■ Environment Variables for Oracle8i ■ Initialization Parameters ■ Database Limits ■ Managing Special Accounts and Groups ■ Managing Security ■ Estimating Oracle8i Memory Usage ■ Server Resource Limits ■ Controlling the System Global Area ■ Building and Running Demonstrations ■ Relinking Executables Administering Oracle8i 1-1 Setting the Environment Setting the Environment This section describes how to establish a common environment for your Oracle8i system. Displaying Environment Variables To display the current value of an environment variable, use the env command. For example, to display the value of the ORACLE_SID environment variable, enter: $ env | grep ORACLE_SID Note: The env command shows the values of the environment variables that have been exported. You can set environment variables in the Bourne shell and Korn shell without exporting them. Setting and Exporting the Value of a Variable in a Current Session The following examples show how to set and export variable values in the current session. For the Bourne or Korn shell, enter: $ ORACLE_SID=test $ export ORACLE_SID For the C shell, enter: % setenv ORACLE_SID test In both examples, test is the value of the ORACLE_SID variable. 1-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Setting the Environment Setting a Common Environment Oracle8i enables a DBA to set a common environment for all users. A common environment makes it easier for system administrators and database administrators to make changes to the physical Oracle8i system. The oraenv Command File The oraenv (coraenv for the C shell) command file is created during installation. It contains values for Oracle environment variables and provides: ■ A central means of updating all user accounts with database changes ■ A mechanism for switching back and forth between Oracle8i databases For example, you might find yourself frequently adding and removing databases from your development system or your users might be switching between several different Oracle databases installed on the same system. With oraenv (or coraenv), each user shell startup file calls the oraenv (or coraenv) command file. Local bin Directory Place oraenv (or coraenv) and dbhome scripts in a local bin directory, separate from the Oracle software home directory, to ensure that these files are accessible to all users. This also ensures that the oraenv (or coraenv) script continues to work even if you change the ORACLE_HOME environment variable path to point to a different $ORACLE_HOME directory. The local bin directory is specified by the root.sh script, which you run after the installation. The default location for the local bin directory on DYNIX/ptx is /usr/local/bin. Switching Between Databases To switch from one database or database instance to another, call the oraenv routine. Reply to the prompt with the value of the ORACLE_SID environment variable of the database to which you are switching. Always provide the full path of the oraenv (or coraenv) command file. For example: $ . /usr/local/bin/oraenv ORACLE_SID= [default]? sid Administering Oracle8i 1-3 Setting the Environment Database Examples In the following examples, it is assumed that your local bin directory is /usr/local/bin and that your production database is named PROD. If you prefer not to be prompted for the value of the ORACLE_SID environment variable at startup, set the ORAENV_ASK environment variable to no. ORAENV_ ASK is reset to the default, yes, after oraenv is executed. This ensures that the system prompts you for a different ORACLE_SID value the next time that it executes the oraenv file. If you have created a database manually instead of using Oracle Database Configuration Assistant, you must ensure that the system configuration is reflected in the /etc/oratab file. Add an entry for each server instance in the following format: ORACLE_SID:ORACLE_HOME:{Y|N} The values Y or N indicate whether or not you want to activate the dbstart and dbshut scripts. The Oracle Database Configuration Assistant automatically adds an entry for each database it creates. Single Instance Example For the Bourne or Korn shell, add or replace the following line in the .profile file: . local_bin_directory/oraenv with the following lines: PATH=${PATH}:/usr/local/bin ORACLE_SID=PROD export PATH ORACLE_SID ORAENV_ASK=NO export ORAENV_ASK . oraenv ORAENV_ASK= unset ORAENV_ASK 1-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Setting the Environment For the C shell, add or replace the following line in the .cshrc file: source local_bin_directory/coraenv with the following lines: setenv PATH ${PATH}:/usr/local/bin setenv ORACLE_SID PROD setenv ORAENV_ASK NO source /usr/local/bin/coraenv unset ORAENV_ASK Multiple Instances Example For multiple database instances, define the sid at startup. For the Bourne or Korn shell: #!/usr/bin/sh echo "The SIDs on this system are:" cat /etc/oratab | awk -F: ’{print $1}’ | grep -v "#" ORAENV_ASK="YES" . /usr/local/bin/oraenv For the C shell: #!/usr/bin/csh echo "The SIDs on this system are:" cat /ect/oratab | awk -F: ’{print $1}’ | grep -v "#" set ORAENV_ASK="YES" source /usr/local/bin/coraenv Administering Oracle8i 1-5 Environment Variables for Oracle8i Environment Variables for Oracle8i This section describes the most commonly-used Oracle8i and UNIX environment variables. Oracle Environment Variables on UNIX You must define some of these variables before you install Oracle8i. These are listed in the Oracle8i Installation Guide for DYNIX/ptx. Table 1–1 provides the syntax and examples for Oracle8i variables. Table 1–1 Oracle8i Environment Variables on UNIX Variable Detail Definition NLS_LANG Function Specifies the language and character set used for output. See the Oracle8i Installation Guide for IBM DYNIX/ptx for a list of values. Syntax language_territory.characterset Example french_france.we8dec Function Points to the directory where languages and character sets are stored. Set to $ORACLE_HOME/ocommon/nls/admin/data Function Specifies the base of the Oracle directory structure for OFA-compliant databases. Syntax directory_path Example /u01/app/oracle Function Specifies the directory containing the Oracle software. Syntax directory_path Example $ORACLE_BASE/app/oracle/product/8.1.6 Function Specifies the search pathname for files used by Oracle applications, such as SQL*Plus. If not specified, the application reads from and writes to the current directory. Syntax colon-separated list of directories directory:directory:directory Example /u01/oracle/adhoc/816/bin:. ORA_NLS33 ORACLE_BASE ORACLE_HOME ORACLE_PATH Note: The period adds the current working directory to the search path. 1-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Environment Variables for Oracle8i Table 1–1 Oracle8i Environment Variables on UNIX (Cont.) Variable Detail Definition ORACLE_SID Function Specifies the Oracle System Identifier. Syntax The string of numbers and characters that must begin with a letter. A maximum of four characters is recommended. For more information, see the Oracle8i Installation Guide for IBM DYNIX/ptx. Example SAL1 Function Turns on tracing of Bourne shell scripts during install. If set to T, many Oracle shell scripts run with set -x flag on. Range of Values T or anything else. Function Controls whether (c)oraenv prompts for ORACLE_SID or ORACLE_HOME. If set to NO (c)oraenv does not prompt and, if set to anything else, it does. Syntax string Range of Values NO or anything else. Function Sets the directory containing the Net8 configuration files. Syntax directory_path ORACLE_TRACE ORAENV_ASK TNS_ADMIN Range of Values Any directory; for more information, see the Oracle8i Installation Guide for IBM DYNIX/ptx. TWO_TASK Example $ORACLE_HOME/network/admin Function Sets the default Net8 connect string descriptor alias defined in the tnsnames.ora file. Syntax Available network alias. Range of Values Any valid Net8 alias defined in the tnsnames.ora file. Example PRODDB_TCP Note: Do not define environment variables with names identical to names of Oracle Server processes, for example: arch, pmon, and dbwr. Administering Oracle8i 1-7 Environment Variables for Oracle8i Abbreviations for ORACLE_HOME and ORACLE_SID In Oracle8i files and programs, a question mark (?) represents the value of the ORACLE_HOME environment variable. For example, Oracle8i expands the question mark in the following SQL statement to the full path name of the ORACLE_HOME environment variable: ALTER TABLESPACE TEMP ADD DATAFILE ’?/dbs/dbs2.dbf’ SIZE 2M The @ sign represents the value of the ORACLE_SID environment variable. For example, to indicate a file belonging to the current instance, enter: ALTER TABLESPACE TABLESPACE_NAME ADD DATAFILE ’[email protected] UNIX Environment Variables Used with Oracle8i Table 1–2 provides the syntax and examples for UNIX environment variables used with Oracle8i. Table 1–2 UNIX Environment Variables Used with Oracle8i Variable Detail Definition ADA_PATH Function Specifies the directory containing the Ada compiler. CLASSPATH Function Used for Java Functionality. This variable differs for various Java applications. Refer to the product documentation for your Java application for more information. Syntax directory_path Example There is no default setting. CLASSPATH must include the following: JRE_Location, $ORACLE_HOME/product/jlib, $ORACLE_ HOME/product/jlib. Note: JRE_Location is defined as $ORACLE_HOME/JRE DISPLAY HOME 1-8 Function Specifies the display device used by X-based tools for input and output. See vendor’s X Windows documentation for details. Syntax hostname:display The hostname is your computer name (either IP address or alias); display is the monitor number. If you have a single monitor, the number is 0. Example 135.287.222.12:0 bambi:0 Function Specifies the user’s home directory. Oracle8i Administrator’s Reference for IBM DYNIX/ptx Environment Variables for Oracle8i Table 1–2 UNIX Environment Variables Used with Oracle8i (Cont.) Variable Detail Definition Syntax directory_path Example home/jsmith LANG or LANGUAGE Function Specifies the language and character set used by the operating system for messages and other output. See the operating system documentation and your Oracle8i Installation Guide for DYNIX/ptx. LPDEST Function Specifies the user’s default printer for DYNIX/ptx systems. Syntax printer_name Example docqms LDPATH Function Default directories used by the linker to find shared object libraries. See man pages on ld for details. LD_LIBRARY_PATH Function Used by the shared library loader (ld.so.1) at run time to find shared object libraries. See man pages on ld.so.1 for details. Syntax Colon-separated list of directories directory:directory:directory Example /usr/dt/lib: $ORACLE_HOME/lib:$ORACLE_ HOME/javavm/admin Function Used by the shell to locate executable programs; must include $ORACLE_HOME/bin. Syntax Colon-separated list of directories directory:directory:directory Example /bin:/usr/bin:/usr/local/bin: /usr/bin/X11:$ORACLE_HOME/bin:$HOME/bin:. PATH Note: The period adds the current working directory to the search path. PRINTER SHELL Function Selects the default printer for DYNIX/ptx systems. Syntax printer_name Example docqms Function Specifies the command interpreter used during a host command. Syntax Shell pathname. Range of Values /sbin/sh or /sbin/csh or /sbin/ksh or any other command interpreter supplied with DYNIX/ptx. Example /sbin/sh Administering Oracle8i 1-9 Environment Variables for Oracle8i Table 1–2 UNIX Environment Variables Used with Oracle8i (Cont.) Variable Detail Definition TMPDIR Function Specifies the default directory for temporary disk files; if set, tools that create temporary files do so in this directory. Syntax directory_path Example /u02/oracle/tmp Function Specifies a file containing X Windows system resource definitions. See your X Windows documentation for more information. XENVIRONMENT Setting the System Time The TZ variable sets your time zone. It enables you to adjust the clock for daylight saving time changes or different time zones. The adjusted time is used to time-stamp files, produce the output of the date command, and obtain the current SYSDATE. Caution: Oracle Corporation recommends that you do not change your personal TZ value. Using different values of TZ such as GMT+24 might change the day that a transaction is recorded. This affects Oracle applications that use SYSDATE, such as Oracle Financials. Use sequence numbers to order a table instead of date columns to avoid this problem. 1-10 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Initialization Parameters Initialization Parameters Initialization parameters enable you to configure and tune your Oracle8i instance. This section describes: ■ ■ Customizing initialization parameters in the initsid.ora file for the Oracle8i instance Pre-set default initialization parameters Optional initialization parameters are described in the Oracle8i Administrator’s Guide and Oracle8i Tuning. For information on Asynchronous I/O and I/O Slaves, see Chapter 2, "Tuning Oracle8i". Customizing the initsid.ora File This section describes the default initsid.ora file provided with the Oracle8i software. The Oracle Universal Installer creates it in the $ORACLE_ BASE/admin/sid/pfile directory. You can modify it to customize your Oracle8i installation. Sample initsid.ora File For a sample initsid.ora file, look in the $ORACLE_HOME/dbs directory. This file is provided by Oracle Corporation to assist in customizing your Oracle8i installation. Administering Oracle8i 1-11 Initialization Parameters Default Initialization Parameter Values Table 1–3 lists default initialization parameter values on DYNIX/ptx. All Oracle8i instances assume these values if you do not specify different values for them in the initsid.ora file. Oracle Corporation recommends that you include in the initsid.ora file only those parameters that differ from the default initialization parameter values. To display the current values of these parameters on the system, use SQL*Plus to execute the statement SHOW PARAMETERS. See Also: For more information, see the Oracle8i Server Reference. Table 1–3 Initialization Parameters 1-12 Parameter Default Value Value Range BACKGROUND_DUMP_DEST ?/rdbms/log Valid directory names BITMAP_MERGE_AREA_SIZE 1048576 65536 to unlimited COMMIT_POINT_STRENGTH 1 0 to 255 CONTROL_FILES ?/dbs/cntrloracle_sid.dbf Valid file names CREATE_BITMAP_AREA_SIZE 8388608 65536 to unlimited DB_BLOCK_BUFFERS 48 MB of buffers 48 MB to unlimited DB_BLOCK_SIZE 4096 2 KB to 16 KB DB_FILES 200 1 to 2000000 DB_FILE_DIRECT_IO_COUNT 64 (maximum of 1048576) 0 to 1048576/block size DB_FILE_MULTIBLOCK_READ_ COUNT 8 1 to min(DB_BLOCK_ BUFFERS/4, 1048576/DB_ BLOCK_SIZE) DISTRIBUTED_TRANSACTIONS 1/4 Transactions 0 to unlimited HASH_AREA_SIZE 2*SORT_AREA_SIZE 0 to unlimited HASH_MULTIBLOCK_IO_ COUNT 0 (self-tuned) 0 to min(127, DB_BLOCK_ BUFFERS/4, 1048576/DB_ BLOCK_SIZE) JAVA_POOL_SIZE 20000000 1000000 to 1000000000 LOG_ARCHIVE_BUFFERS 4 0 to 128 LOG_ARCHIVE_DEST null Valid directory names LOG_ARCHIVE_FORMAT "%t_%s.dbf" Valid file names LOG_BUFFER max (512 KB, 128 KB*CPU_COUNT) 66560 - unlimited Oracle8i Administrator’s Reference for IBM DYNIX/ptx Initialization Parameters Table 1–3 Initialization Parameters (Cont.) Parameter Default Value Value Range LOG_CHECKPOINT_INTERVAL 0 0 - unlimited MTS_MAX_DISPATCHERS 5 Between MTS_ DISPATCHERS and PROCESSES MTS_MAX_SERVERS 2*MTS_SERVERS, if MTS_SERVERS > 20, else 20 Between MTS_SERVERS and PROCESSES MTS_SERVERS 1, if MTS_DISPATCHERS is specified, else 0 Between 1 and PROCESSES MTS_LISTENER_ADDRESS ADDRESS=address Hostname or IP address NLS_LANGUAGE AMERICAN Valid language names NLS_TERRITORY AMERICA Valid territory names OBJECT_CACHE_MAX_SIZE_ PERCENT 10 0 - unlimited OBJECT_CACHE_OPTIMAL_SIZE 100 KB 10 KB - unlimited OPEN_CURSORS 50 1 - unlimited OS_AUTHENT_PREFIX ops$ Arbitrary string PROCESSES 30, if not PARALLEL_AUTOMATIC_ 6 - unlimited TUNING SHARED_POOL_SIZE 64 MB on 64-bit, 8 MB on 32-bit 300000 - unlimited SORT_AREA_SIZE 65536 0 - unlimited USER_DUMP_DEST $ORACLE_ BASE/admin/sid/udump Valid directory name Administering Oracle8i 1-13 Database Limits Database Limits Table 1–4 lists the maximum and default values for parameters in a CREATE DATABASE or CREATE CONTROLFILE statement. Note: Interdependencies between these parameters can affect allowable values. Table 1–4 Determining the Size of Control Files Parameter Default Value Maximum Value MAXDATAFILES 30 65534 MAXINSTANCES 1 63 MAXLOGFILES 16 255 MAXLOGMEMBERS 2 5 MAXLOGHISTORY 100 65534 For information on Oracle-specific file size limits, see Chapter 1 of Oracle8i Installation Guide for DYNIX/ptx. Managing Special Accounts and Groups The DBA should be familiar with the special accounts required by the Oracle server and should make sure these accounts belong to the appropriate groups. 1-14 ■ Table 1–5 describes UNIX accounts. ■ Table 1–6 describes Oracle server accounts. ■ Table 1–7 describes special UNIX groups. Oracle8i Administrator’s Reference for IBM DYNIX/ptx Managing Special Accounts and Groups Table 1–5 UNIX Accounts Account Name Description oracle The oracle software owner represents the account that owns the Oracle8i software. This maintenance account requires DBA privileges in order to run the CREATE, STARTUP, SHUTDOWN, and CONNECT as INTERNAL commands. The oracle software owner must never be the superuser. root The root user is a special UNIX account with maximum privileges (called superuser privileges). Use the root account to configure the UNIX kernel, configure and install networking software, and create user accounts and groups. Only the root user should be a member of the root group. Table 1–6 Oracle Server Accounts Account Name Description SYS This is a standard Oracle8i account with DBA privileges automatically created during installation. The SYS account owns all the base tables for the data dictionary. This account is used by the DBA. SYSTEM This account is also a standard Oracle8i account, with DBA privileges automatically created during installation. Additional tables or views can be created by the SYSTEM user. DBAs can log in as SYSTEM to monitor or maintain databases. Table 1–7 Special UNIX Group Accounts Account Name Description dba The oracle software owner is the only required member of the dba group. You can add any other UNIX user to the dba group. Members of this group have access to SQL*Plus specially privileged functions. If your account is not a member of the dba group, you must enter a password in order to connect as INTERNAL or gain access to the other administrative functions of SQL*Plus. The default OSDBA group is dba. Administering Oracle8i 1-15 Managing Security Table 1–7 Special UNIX Group Accounts (Cont.) Account Name Description oinstall All users installing Oracle8i in any $ORACLE_HOME directory must belong to the same UNIX group. All Oracle8i $ORACLE_ HOME directories on one computer share the same Oracle Universal Installer oraInventory directory. Members of the installation group can write to the oraInventory directory. Oracle recommends installing with oinstall as the primary group. oper Members of this optional UNIX group have database OPERATOR privileges, which are a restricted set of DBA privileges. Managing Security Oracle8i uses several features of the UNIX operating system to provide a secure environment for users. These features include file ownership, group accounts, and the ability of a program to change its user ID upon execution. The two-task architecture of Oracle8i improves security by dividing work (and address space) between the user program and the oracle program. All database access is achieved through the shadow process and special authorizations on the oracle program. See Also: For more information on security issues, see the Oracle8i Administrator’s Reference. Groups and Security To ensure greater security for an Oracle8i database, create user groups at the operating system level. Groups are controlled by the UNIX /etc/group file. Oracle programs are divided into two sets for security purposes: those executable by all (other, in UNIX terms), and those executable by DBAs only. A recommended approach to security is: ■ ■ 1-16 Before installing Oracle8i, create a database administrators’ UNIX group that has special database privileges. You can name the group anything, but this guide refers to it as the dba group. The oracle account must have the dba group as a secondary group. The primary group for the oracle account should be the oinstall group. Create a group named oinstall. This is the group that owns the Oracle Universal Installer oraInventory. It is responsible for installing and Oracle8i Administrator’s Reference for IBM DYNIX/ptx Managing Security upgrading the Oracle8i system. You can name the group anything, but this guide refers to it as the oinstall group. All oracle accounts must have the oinstall group as their primary group. ■ Although any user account which requires DBA privileges can belong to the dba group, the only user account which should belong to the oinstall group is the oracle account. Note: Even though both the oracle user and root user should belong to the dba group, Oracle Corporation recommends that the oracle user is not a member of the root group. The root user should be the only member of the root group. Security for Server Manager Commands If you do not install SQL*Plus, you can use Server Manager to make SQL queries. However, be careful how you assign access to Server Manager. Only the oracle user and the dba group users have access to the following system-privileged statements, as they grant special operating system privileges: ■ STARTUP ■ SHUTDOWN ■ CONNECT INTERNAL Caution: System-privileged statements can damage your database if used incorrectly. Note that non-dba group users can connect as INTERNAL if they have the necessary password. Security for Database Files The user ID used to install Oracle8i should own the database files. The default user ID is the oracle software owner. Set the authorizations on the database files to 0600 which permits read/write (rw) by owner only, with no write authorizations for group or other users. The oracle software owner should own the directories containing the database files. For added security, revoke read permission from group and other users. To access the protected database files, the oracle program must have its set user ID (setuid) bit on. Administering Oracle8i 1-17 Managing Security The Oracle Universal Installer automatically sets the permissions of the oracle executable to: -rwsr-s--x The s in the user execute field means that when you execute the oracle program, it has an effective user ID of oracle, regardless of the actual user ID of the person invoking it. If you need to set the permissions on the oracle executable manually, enter: $ chmod 6751 $ORACLE_HOME/bin/oracle Security and Remote Passwords You can administer a database from a remote computer without operating system accounts, such as a personal computer. User validation is accomplished by using an Oracle8i password file, created and managed by the orapwd utility. You can also use password file validation on systems that support operating system accounts. Local password files are located in the $ORACLE_HOME/dbs directory and contain the user name and password information for a single database. If there are multiple $ORACLE_HOME directories on a system, each has a separate password file. To enable the database to use the password file, set the initsid.ora parameter REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE. Running orapwd The orapwd utility exists in $ORACLE_HOME/bin and is run by the oracle software owner. Start orapwd by entering: $ orapwd file=filename password=password entries=max_users This syntax is described as follows: 1-18 filename is the name of the file where password information is written. The name of the file must be orapwsid, and you must supply the full path name. Its contents are encrypted and not user-readable. This parameter is mandatory. password is the initial password you selected for INTERNAL and SYS. You can change this password after you create the database using an ALTER USER statement. This parameter is mandatory. Oracle8i Administrator’s Reference for IBM DYNIX/ptx Managing Security max_users is the maximum number of users able to connect to the database as SYSDBA or SYSOPER. This parameter is mandatory only if you want this password file to be EXCLUSIVE. Set max_users to a higher number than you expect to require because if you need to exceed this value, you must create a new password file. orapwd Example $ orapwd file=/u01/app/oracle/product/8.1.6/dbs/orapwV816 password=V816pw entries=30 Access to a Database from a Remote PC When there is an Oracle8i password file, networked PC users with DBA privileges can access this database as INTERNAL. Privileged users, who want to perform DBA functions on the database, can enter the appropriate SQL*Plus command from their PC, adding the dba user password. For example: SQL> CONNECT INTERNAL/DBA_PASSWORD@ALIAS AS {SYSDBA|SYSOPER} Remote Authentication Table 1–8 shows the initsid.ora parameters that control the behavior of remote connections through non-secure protocols. Table 1–8 Parameters for Controlling Remote Connections Parameter Description REMOTE_OS_AUTHENT Enables or disables OPS$ connection OS_AUTHENT_PREFIX Used by OPS$ accounts REMOTE_OS_ROLES Enables or disables roles through remote connections Administering Oracle8i 1-19 Estimating Oracle8i Memory Usage Estimating Oracle8i Memory Usage You need to know the Oracle8i memory usage requirements before starting the Installer. Knowing these requirements helps you determine the number of users you can have on your system, and helps you determine your physical memory and swap space requirement. To calculate the memory requirements, use the following formula: size of the oracle executable text + size of the SGA + number of background processes * (size of tool executables private data section + size of oracle executables uninitialized data section + 8192 bytes for the stack + 2048 bytes for the processes user area) To determine the SGA size, see "Calculating the Size of the SGA" on page 1-22. For each Oracle client/server connection, use the following formula to estimate virtual memory requirements: size of oracle executable data section + size of oracle executables uninitialized data section + 8192 bytes for the stack + 2048 bytes for the processes user area + cursor area needed for the application Use the size command to estimate an executable’s text size, private data section size, and uninitialized data section size. Program text is counted only once, no matter how many times the program is run because all oracle executable text is always shared. To calculate actual Oracle physical memory usage while the database is running and users are connecting to it, use the ps -elfF command. For each entry, total the RSS columns. See Also: See your operating system man pages or documentation for a list of available switches for the ps command. The RSS column displays the real memory (resident set) size of the process. Finally, add the text size for the oracle executable and every other Oracle tool executable running on the system to that subtotal. Remember to count executable sizes only once, regardless of how many times the executable is run. 1-20 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Controlling the System Global Area Server Resource Limits DYNIX/ptx inherits resource limits from the parent process (see getrlimit(2) in your operating system documentation). These limits apply to the Oracle8i shadow process that executes for user processes. The DYNIX/ptx default resource limits are high enough for any Oracle8i shadow or background process. However, if these limits are lowered, the Oracle8i system could be affected. Discuss this with your DYNIX/ptx system manager. Disk quotas established for the oracle user ID can hinder the operation of the Oracle8i system. Confer with your Oracle8i database administrator and the DYNIX/ptx system manager before establishing disk quotas. Controlling the System Global Area The System Global Area (SGA) is the Oracle structure that is stored in shared memory. It contains static data structures, locks, and data buffers. Sufficient shared memory must be available to each oracle process to address the entire SGA. Size Limits of the SGA The maximum size of a single shared memory segment is specified by the SHMMAX parameter. Oracle8i uses shared memory segments for the SGA. If the size of the SGA exceeds the maximum size of a shared memory segment (SHMMAX), Oracle8i attempts to attach more contiguous segments to fulfill the requested SGA size. SHMSEG is the maximum number of segments that can be attached by a process. Note: Using Intimate Shared Memory (ISM) can cause problems when SHMMAX is smaller than the database SGA size. Administering Oracle8i 1-21 Controlling the System Global Area Set the following initialization parameters to control the size of the SGA: ■ DB_BLOCK_BUFFERS ■ DB_BLOCK_SIZE ■ LARGE_POOL_SIZE ■ SORT_AREA_SIZE ■ SHARED_POOL_SIZE ■ JAVA_POOL_SIZE Be careful when setting values for these parameters. When values are set too high, performance is adversely affected because too much of the computer’s physical memory is devoted to shared memory. Calculating the Size of the SGA You can determine the SGA size in one of the following ways: ■ You can calculate the approximate size of an instance’s SGA using the following formula: (DB_BLOCK_BUFFERS * DB_BLOCK_SIZE) + SORT_AREA_SIZE + SHARED_POOL_SIZE + LOG_BUFFER + LARGE_POOL_SIZE + JAVA_POOL_SIZE ■ ■ To display the size of the SGA for a running database, in bytes, use the SQL*Plus SHOW SGA command. You can also find the size of the SGA when you start the database system. The SGA size is displayed next to the heading Total System Global Area. Relocating the SGA The address at which the SGA is attached affects the amount of virtual address space available for such things as database buffers in the SGA and cursors in the user’s application data area. To relocate the SGA, perform the following steps: 1. 1-22 To determine the valid virtual address range for attaching shared memory segments, use the tstshm executable included in this release of Oracle8i. Oracle8i Administrator’s Reference for IBM DYNIX/ptx Controlling the System Global Area 2. Enter the tstshm executable at the command prompt: $ tstshm In the output from tstshm, the lines "Lowest shared memory address" and "Highest shared memory address" indicate the valid address range. 3. Check the "Segment boundaries" output of the tstshm command to determine the valid virtual address boundaries at which a shared memory segment can be attached. 4. Move to the $ORACLE_HOME/rdbms/lib directory and make a backup copy of the libserver8.a file: $ cd $ORACLE_HOME/lib $ cp libserve8.a libserver8.a orig 5. Move to the $ORACLE_HOME/rdbms/lib directory, and run the genksms command to generate the ksms.s file: $ cd $ORACLE_HOME/rdbms/lib $ $ORACLE_HOME/bin/genksms -b sgabeg > ksms.s In this example, sgabeg is the starting address of the SGA (which defaults to 0x80000000) and should fall within the range determined in step 2. Never set sgabeg below 0x01000000. On most systems, this leaves about 7Mb for data segments. This amount must allow enough memory for such things as SORT_ AREA_SIZE. With a start address of 0x1000000 you can achieve an overall SGA size of about 3.5GB. You may receive the following error messages if you reduced the value of sgabeg: ORA-4030: out of process memory when trying to allocate %s bytes (%s,%s) or ORA-7324: smpall: malloc error while allocating pga. If this is the case, then you probably lowered the start address into an area which the PGA needs to extend into. Raise sgabeg, and try again. Shut down the existing Oracle instance. Administering Oracle8i 1-23 Building and Running Demonstrations 6. Create the ksms.o file and archive it into the libserver8.a file. $ cd $ORACLE_HOME/rdbms/lib $ make -f ins_rdbms.mk ksms.o $ ar r $ORACLE_HOME/lib/libserver8.a ksms.o 7. Rebuild the oracle executable in the $ORACLE_HOME/rdbms/lib directory: $ make -f ins_rdbms.mk ioracle Using the ioracle command: ■ Backs up the old executable (oracle0) ■ Assigns the correct privileges to the new oracle executable ■ Moves the new executable into the $ORACLE_HOME/bin directory The result is a new Oracle kernel that loads the SGA at the address specified by sgabeg. See Also: For more information about how the use of Java in the database affects SGA calculations, see the README file in the $ORACLE_HOME/javavm/doc directory. Building and Running Demonstrations This section describes how to build and run the SQL*Loader and PL/SQL demonstration programs installed with Oracle8i. SQL*Loader Demonstrations SQL*Loader demonstrations require that: ■ The user SCOTT/TIGER has CONNECT and RESOURCE privileges ■ The EMP and DEPT tables exist and are empty To create and run a demonstration: 1. Run the ulcasen.sql script corresponding to the demonstration that you want to run. As SCOTT/TIGER, start SQL*Plus from the command line: $ sqlplus SCOTT/TIGER @ulcasen.sql This step creates the objects used by this demonstration. 1-24 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Building and Running Demonstrations 2. As SCOTT/TIGER, start the demonstration from the command line: $ sqlldr SCOTT/TIGER ulcasen.ctl This step loads the demonstration data into the objects created in step 1, but does not run the demonstration. 3. As SCOTT/TIGER, run the SQL*Loader demonstrations in the following order: ■ ■ ■ ulcase1: Follow steps 1 - 2. ulcase2: Follow step 2 to start the demonstration (you do not have to run the ulcase2.sql script). ■ ulcase3: Follow steps 1 - 2. ■ ulcase4: Follow steps 1 - 2. ■ ulcase5: Follow steps 1 - 2. ulcase6: Run the ulcase6.sql script as SCOTT/TIGER, then enter the following at the command line: $ sqlldr SCOTT/TIGER ulcase6 DIRECT=true ■ ulcase7: Run the ulcase7s.sql script as SCOTT/TIGER, then enter the following at the command line: $ sqlldr SCOTT/TIGER ulcase7 4. After running the example, run the ulcase7e.sql file to drop the insert trigger and global variable package. Administering Oracle8i 1-25 Building and Running Demonstrations Administering SQL*Loader This section describes SQL*Loader file processing options and newline characters in fixed length records. File Processing Option The SQL*Loader release 1.1 control file includes the following additional file processing option strings: ["STR" | "FIX n" | "VAR n" ] where: STR (default) Specifies a string of records where each record is terminated by a newline character FIX Indicates that the file consists of fixed-length records, each of which is n bytes long, where n is an integer value VAR Indicates that the file consists of variable-length records, each of which is n bytes long, where n is an integer value specified by the first five characters of the record If you do not select a file processing option, the information is processed by default as a stream of records (STR). You might find that FIX mode yields faster performance than the default STR mode because it does not need to scan for record terminators. Newline Characters in Fixed Length Records When using the FIX option to read a file containing fixed-length records, where each record is terminated by a newline character, include the length of the newline character (one character) when specifying the record length to SQL*Loader. For example, to read the following file specify FIX 4 instead of FIX 3 to account for the additional newline character: AAA newline BBB newline CCC newline If you do not terminate the last record in a file of fixed records with a newline character, do not terminate the other records with a newline character either. Similarly, if you terminate the last record with a newline character, terminate all records with a newline character. 1-26 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Building and Running Demonstrations Caution: Certain text editors, such as vi, automatically terminate the last record of a file with a newline character. This leads to inconsistencies if the other records in the file are not terminated with newline characters. Removing Newline Characters Use the POSITION(x:y)function in the control file to discard the newline characters from fixed length records rather than loading them. To do this, enter the following in your control file: LOAD DATA INFILE xyz.dat "FIX 4" INTO TABLE abc ( DEPT POSITION(01:03) CHAR ) When this is done, newline characters are discarded because they are in the fourth position in each fixed-length record. Loading PL/SQL Demonstrations PL/SQL includes a number of sample programs that you can load. Demonstration and message files are in the demo directory. To load PL/SQL demonstrations, perform the following steps with the Oracle8i database open and mounted: 1. Run SQL*Plus and connect with the user/password SCOTT/TIGER: $ cd $ORACLE_HOME/plsql/demo $ sqlplus SCOTT/TIGER 2. To load the demonstrations, run exampbld.sql from SQL*Plus: SQL > @exampbld Note: Use any Oracle account with sufficient permissions to build the demonstrations. Run the demonstrations under the same account you used to build them. Administering Oracle8i 1-27 Building and Running Demonstrations Running PL/SQL Demonstrations The following PL/SQL demonstrations are available: examp1.sql examp5.sql examp11.sql sample1.sql examp2.sql examp6.sql examp12.sql sample2.sql examp3.sql examp7.sql examp13.sql sample3.sql examp4.sql examp8.sql examp14.sql sample4.sql extproc.sql The precompiler demonstrations are as follows: examp9.pc examp10.pc sample5.pc sample6.pc To run the PL/SQL demonstrations, run SQL*Plus to connect to the database, using the same user/password you used to create the demonstrations. Start the demonstration by typing an "at" sign (@) or the word START before the demonstration name. For example, to start the examp1 demonstration, enter: $ sqlplus SCOTT/TIGER SQL > @examp1 To build the precompiler PL/SQL demonstrations, enter: $ cd $ORACLE_HOME/plsql/demo $ make -f demo_plsql.mk demos If you want to run a single demonstration, enter its name as the argument in the make command. For example, to make the examp9.pc executable, enter: $ make -f demo_plsql.mk examp9 To run the examp9 demonstration from your current shell, enter: $ ./examp9 To run the extproc demonstration: 1. Add the following line to the tnsnames.ora file: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=plsff))(CONNECT_ DATA=(SID=extproc))) 1-28 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Relinking Executables 2. Add the following line to the listener.ora file: SC=(SID_NAME=extproc)(ORACLE_HOME=your_oracle_home)(PROGRAM=extproc)) 3. From the SQL*Plus session, enter: SQL> CONNECT SYSTEM/MANAGER Connected. SQL> GRANT CREATE LIBRARY TO SCOTT; Grant succeeded. SQL> CONNECT SCOTT/TIGER Connected. SQL> CREATE LIBRARY DEMOLIB AS ’$ORACLE_HOME/plsql/demo/extproc.so’; Library created. 4. Finally, to run the demonstrations: SQL> CONNECT SCOTT/TIGER Connected. SQL> @extproc Relinking Executables You can manually relink your product executables using a relink shell script located in the $ORACLE_HOME/bin directory. Relinking is necessary after applying any operating system patches or after an operating system upgrade. The relink script performs manual relinking of Oracle product executables based on what has been installed in the $ORACLE_HOME directory. Administering Oracle8i 1-29 Relinking Executables To relink, enter the following, where parameter is one of the parameters in Table 1–9: $ relink parameter Table 1–9 Relink Script Parameters Parameter Value all Everything that has been installed oracle Oracle database executable only network net_client, net_server, nau, cman, cnames client net_client, otrace, plsql, client_sharedlib interMedia ctx, ordimg, ordaud, ordvir, md precomp All precompilers which have been installed utilities Utilities oemagent oemagent, odg Note: Shut down all databases, Oracle Intelligent Agent, Oracle WebDB Listener, and other Oracle programs under this ORACLE_ HOME when relinking executables. 1-30 Oracle8i Administrator’s Reference for IBM DYNIX/ptx 2 Tuning Oracle8i The more your Oracle8i applications increase in complexity, the more you need to tune the system to optimize performance and prevent data bottlenecks. This chapter describes how to configure your Oracle8i installation to optimize its performance. It contains the following sections: ■ Importance of Tuning ■ DYNIX/ptx Tools ■ SQL Scripts ■ Tuning Memory Management ■ Tuning Disk I/O ■ Monitoring Disk Performance ■ Tuning CPU Usage ■ Tuning Oracle Resource Contention ■ Tuning Block Size and File Size ■ Tuning the Buffer Cache Size ■ Tuning Resource Contention for Oracle Parallel Server ■ Using Trace and Alert Files ■ Raw Devices and Volumes Tuning Oracle8i 2-1 Importance of Tuning Importance of Tuning Oracle8i is a highly optimizable software product. Frequent tuning optimizes system performance and prevents data bottlenecks. Although this chapter is written from the perspective of single-processor systems, most of the performance tuning tips provided here are also valid when using the parallel options and features available with Oracle8i. Before tuning the system, observe its normal behavior using the tools described in in the next section. . See Also: For more information on parallel options, see Oracle8i Parallel Server Concepts and Administration and Oracle8i Designing and Tuning for Performance. DYNIX/ptx Tools DYNIX/ptx provides performance monitoring tools that you can use to assess database performance and determine database requirements. In addition to providing statistics for Oracle processes, these tools provide statistics for CPU usage, interrupts, swapping, paging, and context switching for the entire system. See Also: For more information on tuning, see Oracle8i Tuning. DYNIX/ptx tools are described in the operating system documentation. sar Use the sar command to monitor swapping, paging, disk, and CPU activity, depending on the switches that you supply with the command. The following statement displays a summary of paging activity ten times, at 10 second intervals: $ sar -p 10 10 2-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx DYNIX/ptx Tools The following example shows output from the sar -p command: 00:00:01 vflt/s pflt/s pgfil/s rclm/s 01:00:00 28.91 0.00 0.00 0.00 02:00:00 25.84 0.00 0.00 0.00 03:00:00 26.89 0.00 0.00 0.00 04:00:00 26.71 0.00 0.00 0.00 05:00:00 25.52 0.00 0.01 0.00 06:00:01 25.40 0.00 0.00 0.00 07:00:01 27.31 0.00 0.00 0.00 08:00:00 26.02 0.00 0.00 0.00 08:20:00 35.65 0.00 0.00 0.00 08:40:00 22.26 0.00 0.00 0.00 09:00:01 22.51 0.00 0.00 0.00 09:20:00 34.92 0.00 0.00 0.00 09:40:00 21.67 0.00 0.00 0.00 10:00:01 28.86 0.00 0.07 0.00 10:20:00 38.95 0.00 0.00 0.00 10:40:00 23.24 0.00 0.00 0.00 11:00:01 29.21 0.00 0.00 0.00 11:20:00 41.64 0.00 0.01 0.00 11:40:00 41.94 0.00 0.00 0.00 12:00:00 1968.86 0.00 0.06 0.00 12:20:00 49.47 0.00 1.87 0.00 Average 80.99 0.00 0.06 0.00 swap The swap -l command reports information about swap space usage. A shortage of swap space can cause slow response times or even cause the system to stop responding. The following example shows output from the swap -l command. path /dev/vx/dsk/SWAPVOL dev 121,1 swaplo 0 blocks 530688 Tuning Oracle8i 2-3 SQL Scripts SQL Scripts Oracle8i includes a set of packages for database tuning called STATPACKS. For more information on STATPACKS, see Oracle8i Designing and Tuning Performance. The utlbstat.sql and utlestat.sql scripts are used to monitor Oracle database performance and tune the System Global Area (SGA) data structures. For information regarding these scripts, see Oracle8i Designing and Tuning for Performance. On DYNIX/ptx, the scripts are located in the following directory: $ORACLE_HOME/rdbms/admin Tuning Memory Management Start the memory tuning process by measuring paging and swapping space to determine how much memory is available. The Oracle buffer manager ensures that the more frequently accessed data is cached for longer periods. Monitoring the buffer manager and tuning the buffer cache can have a significant influence on Oracle performance. The optimal Oracle buffer size for your system depends on the overall system load and the relative priority of Oracle over other applications. Allocate Sufficient Swap Space Try to minimize swapping because it causes significant UNIX overhead. Use the sar -w command to check for swapping. If your system is swapping and you must conserve memory: ■ Avoid running unnecessary system daemon processes or application processes ■ Decrease the number of database buffers to free some memory ■ Decrease the number of UNIX file buffers, especially if you are using raw devices Use swap -l to determine how much swap space is in use. Start with a swap space two to four times the size of your system’s random access memory (RAM). Use a higher value if you plan to use Oracle Developer or Oracle Applications. Monitor the use of swap space and increase it as necessary. 2-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Memory Management Control Paging Paging might not present as serious a problem as swapping because an entire program does not have to be stored in memory to run. A small number of page-outs might not noticeably affect the performance of your system. To detect excessive paging, run measurements during periods of fast response or idle time to compare against measurements from periods of slow response. Use vmstat or sar -p to monitor paging. The following columns from sar -p output are important: vflt/s indicates the number of address translation page faults. Address translation faults occur when a process references a valid page that is not in memory. rclm/s indicates the number of valid pages that have been reclaimed and added to the free list by page-out activity. This value should be zero. If your system consistently has excessive page-out activity, consider the following solutions: ■ Install more memory ■ Move some of the work to another system ■ Configure your kernel to use less memory Hold the SGA in a Single Shared Memory Segment You cannot start the database without sufficient shared memory. Reconfigure the UNIX kernel to increase shared memory. For more information, see Controlling the System Global Area in Chapter 1. See Also: For more information on shared memory, see Chapter 2 of the Oracle8i Installation Guide for IBM DYNIX/ptx. Lock the SGA in Physical Memory You can now lock the SGA into physical memory. The potential performance benefit of locking the SGA in physical memory is up to 20 percent. Locking the SGA improves performance in two ways: ■ Hard-locking removes the overhead of paging PGA buffers in and out of memory. Tuning Oracle8i 2-5 Tuning Memory Management ■ Each process no longer needs its own page tablespace for the SGA. This is significant because thousands of users attaching to a large SGA previously required page space on the order of a gigabyte. A disadvantage of hard-locking the SGA is that the locked SGA memory cannot be used by any other processes, even in an emergency. However, the overall memory use reduction and performance benefits outweigh this disadvantage. Carefully consider the size of the SGA, total machine resources, and anticipated usage to determine whether it is safe to lock the SGA into memory. The default is to lock SGA if the operating system is configured to allow it. To configure the operating system to use this feature: ■ ■ ■ Recompile the DYNIX/ptx kernel with the special tuning parameters which can be set by using the DYNIX/ptx configuration utility, menu. Set SHM_LOCK_OK = 1 to enable hard-locking. Set SHM_LOCK_UID = -1 to allow all users to use the hard-lock feature, or set SHM_LOCK_UID to the oracle software owner user ID to restrict the usage. Optimize Number of Database Buffers The DB_BLOCK_SIZE parameter also determines the size of the database buffers in the SGA. The DB_BLOCK_BUFFERS parameter is the memory parameter with the most direct effect on system performance. By altering this parameter value, you can increase performance up to 200 percent. The hit ratio for the buffer cache is defined as: Hit Ratio = Logical Reads - Physical Reads Logical Reads where Logical Reads = db block gets + consistent gets If your hit ratio is less than 60 or 70 percent, increase the number of buffers in the cache by raising DB_BLOCK_BUFFERS. See Also: For information on using the X$KCBRBH table as an alternate method for estimating the number of buffers based on statistics gathered from a running system, see the Oracle8 Server Tuning guide. 2-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Memory Management Use Indirect Database Buffers Note: Indirect Database Buffers cannot be used in Oracle Parallel Server (OPS) installations. The maximum SGA size supported by DYNIX/ptx is 3 GB if you use direct database buffers, but you can increase this size to take advantage of large memory systems by using indirect buffers. DYNIX/ptx provides the ability to indirectly map blocks of memory, which can enable the database block buffer section of the SGA to grow up to a theoretical maximum of 31 GB. Since enabling indirect database buffers involves a slight overhead of mapping and unmapping buffers as they are needed, this feature is disabled by default, and is only recommended when SGA sizes of 3 GB or greater are required for a higher buffer cache hit ratio. To enable indirect database buffers, set the USE_INDIRECT_DATA_BUFFERS initsid.ora parameter: USE_INDIRECT_DATA_BUFFERS = true You must lock the SGA into physical memory in order to use this feature. Optimize Number of Redo Buffers The redo log space statistic is the number of times a user process waits for space in the redo buffer. The size of the redo log buffer is determined by the initsid.ora LOG_BUFFER parameter. The value of this parameter is expressed in bytes. Optimize the Shared Pool Size The initsid.ora SHARED_POOL_SIZE parameter sets the size of the shared pool in bytes. A modified least-recently-used algorithm gives precedence to data dictionary cache entries. This means that tuning the library cache also ensures that enough memory is available for the data dictionary. Tuning Oracle8i 2-7 Tuning Memory Management Use the V$SGASTAT table to monitor the shared pool, checking the free space in particular. The following is a sample V$SGASTAT query: SELECT * FROM v$sgastat ORDER BY bytes desc NAME BYTES -------------------------- ---------sql area 1370876 free memory 867036 library cache 785224 db_block_buffers 409600 dictionary cache 275740 ... The shared pool is often set too large. If the free memory area is as large as the preceding example, reduce the size of the shared pool. Execute repeated queries to see if any of the values are increasing. Verify Data Dictionary Cache Effectiveness For optimal performance when parsing SQL statements, the data dictionary cache must be large enough to hold the most frequently accessed data. Data dictionary cache misses generate recursive calls and degrade database performance. Note: If your dictionary cache seems too small, query the V$ROWCACHE table to check cache activity. Allocate Adequate Library Cache Space The library cache contains shared SQL and PL/SQL areas. Even if SQL can be reused, it will not be reused if the library cache is too small. To find out if library cache misses are affecting performance, query the V$LIBRARYCACHE table. Monitor the statistics in the V$LIBRARYCACHE over a period of time with the following query: SELECT SUM(pins) ”Executions”, SUM(reloads) ”Cache Misses while Executing” FROM V$LIBRARYCACHE; The query returns output similar to the following: Executions Cache Misses while Executing ---------- ---------------------------320871 549 2-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Memory Management The sum of the PINS (first column) indicates that SQL statements, PL/SQL blocks, and object definitions were accessed for execution a total of 320,871 times. The sum of the RELOADS (last column) indicates that 549 of those executions resulted in library cache misses. Total reloads should be near zero, and the ratio should be below 1 percent. If the ratio of RELOADS to PINS is greater than 1 percent, allocate additional memory to the library cache by increasing the initsid.ora parameter SHARED_ POOL_SIZE. Alter the library cache space for a potential performance benefit of up to 50 percent. Lock Large PL/SQL Blocks into the Shared Pool Occasionally, seldom-used shared objects should be locked into the shared pool. This often helps when the library cache latch is a bottleneck. Use the dbms_ shared_pool utility package to determine the size of objects in the shared pool. See the documentation in the comments of the PL/SQL dbmspool.sql script, installed in the $ORACLE_HOME/rdbms/admin directory. Use the following procedure to install PL/SQL, enable the server output buffer, and run the sizes() procedure: 1. Navigate to the $ORACLE_HOME/rdbms/admin directory. 2. Start SQL*Plus and execute the following sequence of commands: @dbmspool @prvtpool set serveroutput on size xxx begin sys.dbms_shared_pool.sizes (minsize); end; / A setting of 20000 is sufficient for xxx, and 20 for minsize. After you identify the frequently used shared objects, you can run the procedure (keeping VARCHAR2, flag CHAR DEFAULT ‘P’) as often as necessary to lock objects into the shared pool; dbms_shared_pool.sizes gives a list of objects in the shared pool larger than minsize. For example, keep (obj_name, ”P”) pins obj_name in the shared pool. Tuning Oracle8i 2-9 Tuning Disk I/O The unkeep procedure unlocks objects. Note: Oracle recommends that you build a SQL*Plus script to do this as part of database startup. Tuning Disk I/O I/O bottlenecks are the easiest performance problems to identify. Balance I/O evenly across all available disks to reduce disk access times. For smaller databases and those not using the Parallel Query option, ensure that different data files and tablespaces are distributed across the available disks. Tune the Database Writer to Increase Write Bandwidth Oracle offers asynchronous I/O and I/O slaves as solutions to prevent database writer (DBWR) activity from becoming a bottleneck. Asynchronous I/O Asynchronous I/O allows processes to proceed with the next operation without having to wait after issuing a write and therefore improves system performance by minimizing idle time. DYNIX/ptx supports Asynchronous I/O to both raw and filesystem datafiles. I/O Slaves I/O slaves are specialized processes whose only function is to perform I/O. They replace the Oracle7 feature Multiple DBWRs. In fact, they are a generalization of Multiple DBWRs and can be deployed by other processes as well. They can operate whether or not asynchronous I/O is available. They are allocated memory from LARGE_POOL_SIZE, if set, otherwise they are allocated memory from shared memory buffers. I/O slaves include a set of initialization parameters that allow a degree of control over the way they operate. 2-10 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Disk I/O Table 2–1 lists the initialization parameters that control the operation of asynchronous I/O and I/O slaves. Table 2–1 Initialization Parameters for Asynchronous I/O and I/O Slaves Parameter Range of Values Default Value DISK_ASYNCH_IO TRUE/FALSE TRUE TAPE_ASYNCH_IO TRUE/FALSE TRUE BACKUP_DISK_IO_SLAVES TRUE/FALSE FALSE DBWR_IO_SLAVES 0 - 999 0 DB_WRITER_PROCESSES 1-10 1 There might be times when the use of asynchronous I/O is not desirable or not possible. The first two parameters in Table 2–1, DISK_ASYNCH_IO and TAPE_ ASYNCH_IO, allow asynchronous I/O to be switched off respectively for disk and tape devices. Because the number of I/O slaves for each process type defaults to zero, no I/O slaves are deployed unless set. Set the DBWR_IO_SLAVES parameter to greater than 0 if DISK_ASYNCH_IO or TAPE_ASYNCH_IO is disabled, otherwise DBWR becomes a bottleneck. In this case, the optimal value on DYNIX/ptx for DBWR_IO_SLAVES is 4. DB_WRITER_PROCESSES replaces the Oracle7 parameter DB_WRITERS and specifies the initial number of database writer processes for an instance. If you use DBWR_IO_SLAVES, only one database writer process is used, regardless of the setting for DB_WRITER_PROCESSES. See Chapter 1, "Administering Oracle8i" for information on other initialization parameters. Tuning Oracle8i 2-11 Tuning Disk I/O Use Logical Volumes You can use a Logical Volume Manager (LVM) to stripe data across multiple disk drives. The potential performance benefit of using a LVM is up to 50 percent. While an LVM is preferable, Oracle8 allows data to be striped without an LVM. This is done with the DATAFILE keyword of the CREATE TABLE command. Performance is usually better with an LVM, which uses a smaller stripe size and tends to distribute I/O randomly and automatically. Note: On DYNIX/ptx, Sequent Volume Manager (SVM) is the Logical Volume Manager. Choose the Appropriate File System Type DYNIX/ptx allows a choice of file systems. File systems have different characteristics, and the techniques they use to access data can have a substantial impact on database performance. Typical file system choices are: ■ The UNIX File System (UFS) ■ The Enhanced File System (EFS), derived from Veritas ■ ■ The Clustered File System (CFS), an extension to the EFS to support clustered systems Data access through raw device drivers Note: Oracle Corporation discourages the use of the EFS file system. The EFS file system might not be supported in future versions of Oracle software. Using raw partitions or an EFS/CFS instead of a UFS can improve performance because database file I/O bypasses the UNIX buffer cache and eliminates file system overhead, resulting in fewer instructions per I/O. Raw devices, CFS, and EFS also allow use of asynchronous I/O, so they are usually the best choice for high performance requirements. If ease of administration or use of Veritas features such as caching are the primary considerations, then EFS would be the best choice. 2-12 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Monitoring Disk Performance Oracle Parallel Server requires either raw devices or CFS. Using UFS limits the maximum file size to less than 2 GB and does not provide any performance benefits. Monitoring Disk Performance To monitor disk performance, use sar -b and sar -u. Table 2–2 lists important sar -b columns for disk performance. Table 2–2 Output of sar-b Significant for Monitoring Disk Performance Field Value Shown Database Type bread/s Blocks read File system bwrit/s Blocks written File system pread/s Partition reads Raw device pwrit/s Partition writes Raw device An important sar -u column for disk performance is %wio, the percentage of CPU time waiting on blocked I/O. Key indicators are: ■ ■ ■ The sum of bread, bwrit, pread, and pwrit indicates the state of the disk I/O subsystem. The higher the sum, the greater the potential for disk I/O bottlenecks. This is influenced by the number of physical drives. The larger the number of physical drives, the higher the sum threshold number can be. A good default value is no more than 40 for two drives and no more than 60 for four to eight drives. The %rcache should be greater than 90 and %wcache should be greater than 60. Otherwise, the system can be disk I/O bound. If %wio is consistently greater than 20, the system is I/O bound. Tuning Oracle8i 2-13 Tuning CPU Usage Disk Performance Issues Oracle block sizes should either match disk block sizes or be a multiple of disk block sizes. If possible, perform a file system check on the partition before using it for database files, then make a new file system to ensure that it is clean and unfragmented. Distribute disk I/O as evenly as possible, and separate log files from database files. Tuning CPU Usage The following sections describe how to tune CPU usage. Keep All Oracle Users and Processes at the Same Priority Oracle applications are designed to operate with all users and background processes operating at the same priority level. Changing priorities causes unexpected effects on contention and response times. For example, if the log writer process (LGWR) gets a low priority, it is not executed frequently enough and LGWR becomes a bottleneck. On the other hand, if LGWR has a high priority, user processes can suffer poor response time. Use Processor Affinity and Binding on Multi-Processor Systems In a multi-processor environment, use processor affinity and binding if it is available on your system. Processor binding prevents a process from migrating from one CPU to another, allowing the information in the CPU cache to be better utilized. You can bind a server shadow process to make use of the cache as it is always active, and let background processes flow between CPUs. 2-14 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Oracle Resource Contention Tuning Oracle Resource Contention This section describes: ■ Tuning UNIX Kernel Parameters ■ Using V$ Tables to Isolate Contention ■ Isolating the Segment Causing Contention ■ Reducing Latch Free Contention ■ Reducing Rollback Segment Contention ■ Reducing Redo Log Buffer Latch Contention ■ Reducing Parallel Query/Parallel DML Contention ■ Tuning Spin Count Tuning UNIX Kernel Parameters You can improve performance by keeping the UNIX kernel as small as possible. The UNIX kernel typically pre-allocates physical RAM, leaving less memory available for other processes such as oracle. Traditionally, kernel parameters such as NBUF, NFILE, and NOFILES were used to adjust kernel size. However, most UNIX implementations dynamically adjust those parameters at run time, even though they are present in the UNIX configuration file. Look for memory-mapped video drivers, networking drivers, and disk drivers. They can often be de-installed, freeing more memory for other processes. Caution: Remember to make a backup copy of your UNIX kernel. See your IBM DYNIX/ptx documentation for additional information. Using V$ Tables to Isolate Contention Use the V$SYSTEM_EVENT table for a snapshot of database activity. The statistics in V$SYSTEM_EVENT table indicate how the Oracle server is using its time, and allows you to identify potential problems. Query the table with the following SQL statement: SELECT * FROM V$SYSTEM_EVENT ORDER BY TIME_WAITED; Tuning Oracle8i 2-15 Tuning Oracle Resource Contention A well-tuned database experiences waits, and the presence or absence of an event in this table does not necessarily indicate a problem. It is normal to see events such as client message, pmon timer, smon timer, rdbms ipc message, and rdbms ipc reply. The number of rows in this table changes dynamically. If there is no information to report on an event, the event will not appear in the table. V$SYSTEM_EVENT is a cumulative table; it is also useful to look at a table measuring events as they occur. Use the V$SESSION_WAIT table by entering: SELECT sid, event, p1text, p1, p2text, p2 FROM V$SESSION_WAIT; This query provides a snapshot of the sequence of events. Observing how an event frequency changes with the load on the database provides insight into both the Oracle operation and the nature of the SQL statement being executed. The sample output from querying V$SESSION_WAIT is: SID 1 2 10 ... EVENT pmon timer buffer busy waits latch free P1TEXT file# address P1 P2TEXT 0 7 block# 8.05E08 number P2 0 792 8 Isolating the Segment Causing Contention If you determine that Oracle resource contention is a problem, isolate the segment causing contention. You might decide that the number of buffer busy waits are a problem. Use the block number and file number to determine the type of contention by entering: SELECT segment_name, segment_type, block_id, blocks FROM dba_extents HERE file_id=7 AND (792 between block_id and block_id+blocks); The sample output is: SEGMENT_NAME SEGMENT_TYPE BLOCK_ID BLOCKS --------------- --------------- -------- -------C0T1 TABLE 752 50 1 row selected. 2-16 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Oracle Resource Contention The output indicates that the contention is occurring in a table segment, rather than an index, cluster, or rollback segment. Because you have the file number and block number, you can obtain additional information from the X$BH table by entering: SELECT class FROM X$BH WHERE dbafile=7 AND dbablk=792; This query provides the class number of the block, which can be interpreted using the following table: Table 2-3 Block Type and Class Class Block Type 0 System rollback segment 1 Data block 2 Sort block 3 Save Undo block 4 Segment header block 5 Save Undo segment header block 6 Free List block 7 Extent map block 8 Bitmap block 9 Bitmap Index block 10 + (n*2) Undo segment header block 11 + ((n*2) +1) Undo segment block Reducing Latch Free Contention If the output from the V$SYSTEM_EVENT table indicates that the value of latch free is causing contention, use the output from the V$SESSION_WAIT table to determine the source of the contention. The latch number is given in the P2 field, and can be identified by entering: SELECT latch#, name FROM V$LATCH WHERE latch#=8; Tuning Oracle8i 2-17 Tuning Oracle Resource Contention Sample output is: LATCH# NAME -------- ------------------------8 cache buffers chains 1 row selected. The cache buffer chains latch often experiences contention, as do the cache buffer lru chain latch and the cache buffer handles latch. These latches typically indicate that raising the number of SGA buffers is necessary. Reducing Rollback Segment Contention Database data files have segments allocated for rollback information. Because the database blocks that make up rollback segments are accessed frequently, rollback segments might be subject to contention. Use this SQL statement to determine how often requests for space in a rollback segment cause delays. SELECT name, gets, waits, ((gets-waits)*100)/gets hits FROM v$rollstat s, v$rollname n WHERE s.usn = n.usn; A common symptom of insufficient rollback space is the error message: Snapshot too old The hit rate should be more than 95 percent. To improve the hit rate: ■ ■ When there are too few rollback segments, add more. When users are not properly assigned, assign users who run large transactions to large rollback segments. Reducing Redo Log Buffer Latch Contention Heavy access to the redo log buffer can cause contention for the redo log buffer latches. Examine the activity of the redo log buffer latches through the Server Manager Latch Display. 2-18 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Oracle Resource Contention If the ratio of misses to gets for a particular latch exceeds 10 percent, contention for that latch might affect performance. Each Sleep indicates a delay for the process requesting the latch. Note: Systems with multiple CPUs might be able to tolerate more contention without performance reduction. You can reduce contention for the redo allocation latch. Minimize the time that any single process holds the latch by decreasing the value of the initsid.ora LOG_SMALL_ENTRY_MAX_SIZE parameter. To reduce contention for redo copy latches in multi-processor environments: ■ ■ Add more latches by increasing the value of LOG_SIMULTANEOUS_COPIES Use twice as many redo copy latches as CPUs available to your Oracle8i instance Reducing Parallel Query/Parallel DML Contention Tune parallel queries to avoid excessive CPU usage and prevent exhausting the supply of available query servers. Use the V$Q_SYSSTAT view to determine the number of active query servers by entering: SELECT * FROM V$PQ_SYSSTAT WHERE statistic = ”Servers Busy”:STATISTIC The sample output is: VALUE --------------------- ----------Servers Busy 70 If the value of Servers Busy reaches the value set for the PARALLEL_MAX_ SERVERS parameters, the cause may be that some parallel queries are being processed sequentially. Tuning Oracle8i 2-19 Tuning Oracle Resource Contention Run the sar -u command along with the previous query to observe CPU loading. Observe these measurements over a significant period of time. The following table summarizes tuning actions based on the ratio of servers busy to the value of the PARALLEL_MAX_SERVERS parameter compared to CPU utilization. Busy/Max CPU use heavy Servers (95 - 100%) CPU use OK (60 - 80%) CPU use light (0 - 30%) 1.0 often Aggressively decrease parallelism in tables and queries; tune system Decrease parallelism in tables and queries Increase MAX servers; tune system 1.0 rarely Identify queries when maximized; tune system Increase MAX Servers watch; decrease parallelism in tables and queries Increase MAX servers .3 - .7 If Query Servers using Tuned >40% CPU, decrease MAX servers; tune system Increase parallelism in tables and queries; increase MAX servers 0 - .2 Tune system; consider adding processors Increase parallelism in tables and queries Consider lowering MAX servers Tuning Spin Count In multi-processor environments, you can improve performance by tuning the SPIN_COUNT initialization parameter. A process continues to request a latch until it obtains one. When the number of requests reaches the value of the $SPIN_COUNT parameter, the process fails to acquire the latch, sleeps, then tries to acquire the latch again. Because a latch is a low-level lock, a process does not hold it long. It is less expensive to use CPU time by spinning a process than it is to make a process sleep. To check the contention level of the latch, monitor the miss rate and sleep rate from the utlbstat and utlestat scripts. Try reducing the sleep rate by tuning the spin count. If the contention level is high, increase the spin count to allow processes to spin more before acquiring latches. However, since increasing the spin count increases CPU usage, system throughput may decline at some point. 2-20 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning the Buffer Cache Size Tuning Block Size and File Size This section describes how you can improve the performance of Oracle8i by optimizing the size of Oracle blocks for the files in your database. Note: To change block size, you must re-create the existing database or create a new database. To determine the most efficient configuration, experiment with block size before transferring your data to the new database. Specifying Oracle Block Size On DYNIX/ptx, the default Oracle block size is 4 KB and the maximum block size is 16 KB. You can set the actual block size to any multiple of 4 KB up to 16 KB. The optimal block size is typically the default, but varies with the applications. To create a database with a different Oracle block size, add the following line to the initsid.ora file before creating the database: DB_BLOCK_SIZE=new_block_size Tuning the Buffer Cache Size To take full advantage of raw devices, adjust the size of the Oracle8i buffer cache and, if memory is limited, the DYNIX/ptx buffer cache. The DYNIX/ptx buffer cache is provided by the operating system. It holds blocks of data in memory while they are being transferred between memory and disk. The Oracle8i buffer cache is the area in memory that stores the Oracle database buffers. Since Oracle8i can use raw devices, it does not need to use the DYNIX/ptx buffer cache. If you decide to change to raw devices, you must increase the size of the Oracle8i buffer cache. If the amount of memory on the system is limited, reduce the size of the DYNIX/ptx buffer cache correspondingly. It is possible to increase or decrease the Oracle8i Buffer Cache by modifying the DB_BLOCK_BUFFERS parameter in the initsid.ora file and restarting the instance. Tuning Oracle8i 2-21 Tuning Resource Contention for Oracle Parallel Server Use the sar command to determine which buffer caches you need to increase or decrease. The options of the sar command are shown in Table 2–4. Table 2–4 Useful sar Command options Option Description -b Reports the DYNIX/ptx buffer cache activity -w Reports the DYNIX/ptx swapping activity -u Reports CPU utilization -r Reports memory utilization -p Reports the DYNIX/ptx paging activity Increase the Oracle8i buffer cache size until the increase causes the cache hit ratio to increase. If swapping or paging activity becomes very high, decrease the Oracle8i buffer cache size. Tuning Resource Contention for Oracle Parallel Server This section describes optimization techniques designed to minimize Distributed Lock Manager (DLM) bottlenecks. Database concurrence in an Oracle Parallel Server (OPS) system is maintained across the processors using a DLM. Managing resources using the DLM is less efficient than using the shared memory model within a single database instance. Avoid Index Contention Index tables are used extensively and may be a source of contention in your database if a sequence generator is used to create primary keys for database records. The sequence numbers are typically consecutive and, when used as keys to add data, cause entries in the same index blocks. This can result in contention for the index blocks. Solve this problem by pre-pending a value to the sequence. Select a value to distribute indexes to different blocks. Note: Index contention can be a problem for Oracle8i running on a Symmetric Multi-Processor (SMP), but is more likely to become a bottleneck on Oracle Parallel Server. 2-22 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Tuning Resource Contention for Oracle Parallel Server Avoid Free List Contention Blocks available for insert operations are kept on a list in the table header. Insert-intensive applications experience contention for the table header block. Solve this problem by creating multiple free lists and multiple free list groups. Free list headers are kept in different blocks. Avoid Lock Contention An application will not scale well if there is excessive lock contention. Lock contention can be measured by fields from the V$SYSSTAT table (CLASS=32). CLASS is a column in the V$SYSSTAT table, and the’32’ identifies global locks. Lock Conversion Ratio = Consistent Gets - Async Lock Converts Consistent Gets The lock conversion ratio should be 95 percent or higher for the application to scale well. If there is excessive lock contention, the application must be re-evaluated and possibly re-designed for OPS. Although the application being executed by oracle is the most common source of lock contention, sometimes insufficient locks have been allocated, or were poorly allocated. For example, an OLTP application requires more locks than a decision support application. Allocate locks appropriately with the initsid.ora parameters. Localize Disk I/O Keep the rollback segments and redo logs for an instance on the disks connected to that node. This should be part of your overall strategy of partitioning data so each node uses data without contention. Tuning Oracle8i 2-23 Using Trace and Alert Files Monitor Contention Many statistics can indicate OPS contention. Examine the following tables to determine OPS contention: ■ V$SESSION_WAIT ■ V$SESSION_EVENT ■ V$SYSTEM_EVENT ■ V$SQL_AREA ■ V$CACHE ■ V$PING Generally, lock conversions are the most important factor. Lock conversions imply disk I/O and delays while the lock is acquired and converted. Proper application partitioning is the only way to avoid lock conversions. Using Trace and Alert Files This section describes the trace (or dump) and alert files Oracle8i creates to diagnose and resolve operating problems. Trace File Names The file name format of a trace file is processname_sid_unixpid.trc, where: processname is a three- or four-character process name showing which Oracle8i process the trace file is from (for example, pmon, dbwr, ora, or reco) sid is the instance system identifier unixpid is the UNIX process ID number A sample trace file name is dbwr_TEST_1237.trc. The default directory is $ORACLE_HOME/rdbms/log. Alert Files The alert_sid.log file is associated with a database and is located in the directory specified by the initsid.ora parameter BACKGROUND_DUMP_ DEST. The default directory is $ORACLE_HOME/rdbms/log. 2-24 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Raw Devices and Volumes Raw Devices and Volumes This section describes the use of raw devices on Oracle8i. Disadvantages of Raw Devices and Volumes Raw devices and volumes have the following disadvantages when used on DYNIX/ptx: ■ ■ ■ ■ ■ ■ They might not solve problems with ULIMIT that can arise when exporting tables larger than 1 MB (such as another disk partition). When raw devices and operating system files are mixed within an Oracle8i database, the operating system files must still be within the value of the ULIMIT parameter. They might not solve problems with ULIMIT that can arise when reading the contents of the Oracle distribution media onto the disk. Small client systems usually cannot use sufficiently large raw device and volume partitions. Disk partitions usually come in odd sizes that do not lend themselves to good database architecture. If a particular disk drive has intense I/O activity and performance would benefit from movement of an Oracle data file to another drive, it is likely that no acceptably sized section exists on a drive with less I/O activity. Moving data files around, a common advantage of UNIX, might not be possible with raw devices and volumes. Adding space to a tablespace can be a difficult process in a raw device and volume environment. Occasionally, all raw partitions are assigned data files at initial configuration time, leaving no raw storage to accommodate normal tablespace growth. Tuning Oracle8i 2-25 Raw Devices and Volumes Guidelines for Using Raw Devices and Volumes In addition to the disadvantages described in the preceding section, "Disadvantages of Raw Devices and Volumes", you should consider the following issues when deciding whether to use raw devices and volumes: ■ Oracle8i Parallel Server Installation ■ Raw Disk Partition Availability ■ Logical Volume Manager ■ Dynamic Performance Tuning ■ Mirroring and Online Disk Replacement Oracle8i Parallel Server Installation Each instance of Oracle Parallel Server (OPS) has individual log files. Therefore, in addition to the partitions required for the tablespaces and control files, each instance requires a minimum of three partitions for the log files. All of the files must be on disks that can be shared by all nodes of a DYNIX/ptx cluster. IBM DYNIX/ptx clusters provide access to shared file system between all nodes of a cluster. However, to improve performance, all files associated with a database must be built on raw devices/volumes. Raw Disk Partition Availability Use raw devices and volumes for Oracle files only if your site has at least as many raw disk partitions as Oracle files, including data files, log files, and control files. If the raw disk partitions are already formatted, match data file size to partition size as closely as possible to avoid wasting space. Logical Volume Manager With logical volumes, you can create logical disks based on raw partition availability. Because logical disks can be moved to more than one disk, the disk drives do not have to be reformatted to obtain logical disk sizes. Dynamic Performance Tuning Disk performance can be optimized when the database is online by moving hot spots to cooler drives. Some hardware vendors who provide the logical disk facility also provide a graphical user interface that can be used for tuning. 2-26 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Raw Devices and Volumes Mirroring and Online Disk Replacement You can mirror logical volumes to protect against loss of data. If one copy of a mirror fails, dynamic re-synchronization is possible. Some vendors also provide the ability to replace drives online in conjunction with the mirroring facility. For Oracle Parallel Server, you can use logical volumes for drives associated with a single UNIX machine, as well as those that can be shared with more than one machine of a UNIX cluster. The latter allows for all files associated with the Oracle Parallel Server to be placed on these shared logical volumes. Raw Device Setup Keep in mind the following items when creating raw devices: ■ ■ When creating the volumes, ensure that the owner and group are oracle and oinstall, respectively. The size of an Oracle data file created in a raw partition must be at least two Oracle block sizes smaller than the size of the raw partition. Tuning Oracle8i 2-27 Raw Devices and Volumes 2-28 Oracle8i Administrator’s Reference for IBM DYNIX/ptx 3 Administering SQL*Plus ■ Administering SQL*Plus ■ Using SQL*Plus ■ Restrictions Administering SQL*Plus 3-1 Administering SQL*Plus Administering SQL*Plus Setup Files The setup files for SQL*Plus are glogin.sql, the global setup file that defines the site profile, and login.sql, which defines the user profile. The glogin.sql and login.sql files contain SQL*Plus commands that you choose to execute at the beginning of each SQL*Plus session. When you invoke SQL*Plus, glogin.sql is read first, followed by login.sql. The Site Profile The Site Profile file is $ORACLE_HOME/sqlplus/admin/glogin.sql. SQL*Plus runs this command file when any user starts SQL*Plus. The default Site Profile is placed in $ORACLE_HOME/sqlplus/admin when SQL*Plus is installed. If a Site Profile already exists, it will be overwritten. An existing Site Profile is deleted when SQL*Plus is de-installed. The User Profile The User Profile file is login.sql. SQL*Plus runs this command file, after the Site Profile file has run, when any user starts SQL*Plus. SQL*Plus always searches the current directory first for the User Profile. The environment variable SQLPATH may be set to a colon-separated list of directories that SQL*Plus will search for a login.sql file. For example, if the current directory is /u02/oracle and SQLPATH is set as follows: /home:/home/oracle:/u01/oracle SQL*Plus first looks for login.sql in the current directory /u02/oracle. If it is not found there, SQL*Plus will then look in /home, /home/oracle, and /u01/oracle, respectively. SQL*Plus runs only the first login.sql file found. Since login.sql is run last, options set in login.sql override those set in glogin.sql. 3-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Administering SQL*Plus See Also: Chapter 3 in the SQL*Plus User’s Guide and Reference. The PRODUCT_USER_PROFILE Table During a [Typical] installation, the PRODUCT_USER_PROFILE table (PUP) is created automatically. The PUP table is used to disable certain SQL and SQL*Plus commands. If you need to recreate this table, run the $ORACLE_HOME/sqlplus/admin/pupbld.sql script in the SYSTEM schema. For example: $ sqlplus system/manager SQL> @?/sqlplus/admin/pupbld.sql SQL*Plus will use the value of $ORACLE_HOME wherever "?" appears. Demonstration Tables SQL*Plus is shipped with demonstration tables that may be used for testing. Typical Install During a [Typical] installation, the user SCOTT and the demonstration tables are created automatically. Creating Demonstration Tables Manually Use the SQL script $ORACLE_HOME/sqlplus/demo/demobld.sql to create the demonstration tables. The file demobld.sql, may be run in SQL*Plus as any user to create the demonstration tables in that schema. For example: $ sqlplus scott/tiger SQL> @?/sqlplus/demo/demobld.sql $ORACLE_HOME/sqlplus/demo/demobld.sql may also be run using the shell script $ORACLE_HOME/bin/demobld as follows: $ demobld scott tiger Administering SQL*Plus 3-3 Administering SQL*Plus Deleting Demonstration Tables The SQL script $ORACLE_HOME/sqlplus/demo/demodrop.sql is used to drop the demonstration tables. The file demodrop.sql may be run in SQL*Plus as any user to drop the demonstration tables from that user’s schema. For example: $ sqlplus scott/tiger SQL> @?/sqlplus/demo/demodrop.sql $ORACLE_HOME/sqlplus/demo/demodrop.sql may also be run using the shell script $ORACLE_HOME/bin/demodrop as follows: $ demodrop scott tiger Note: Both SQL scripts demobld.sql and demodrop.sql drop the tables EMP, DEPT, BONUS, SALGRADE, and DUMMY. Make sure that no table with any of these names exists in the desired schema prior to running either script, or the table data will be lost. Help Facility Typical Install When you copy a starter database with pre-built datafiles as part of the Typical installation or as an option in Oracle Database Configuration Assistant, the Help Facility is installed automatically. Database Configuration Assistant Oracle Database Configuration Assistant gives you the option to create help tables when creating a database. Installing the Help Facility Manually The Help Facility may be installed manually using the shell script $ORACLE_HOME/bin/helpins. Before you run the script, the SYSTEM_PASS environment variable should be set to the SYSTEM schema name and password. For example: $ setenv SYSTEM_PASS SYSTEM/MANAGER $ helpins If the SYSTEM_PASS variable is not set, helpins prompts you for the SYSTEM password and loads the help data into the SYSTEM schema. You can also run 3-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Using SQL*Plus $ORACLE_HOME/sqlplus/help/helpbld.sql helpus.sql to install the Help Facility. The system user can run the file helpbld.sql and its argument, helpus.sql, in SQL*Plus to create Help Facility Tables. For example: $ sqlplus system/manager SQL> @?/sqlplus/admin/help/helpbld.sql helpus.sql Note: Both the shell script, helpins, and the SQL*Plus script, helpbld.sql, drop any existing Help Facility tables before creating new tables. You can also run $ORACLE_HOME/sqlplus/help/helpdrop.sql in SQL*Plus to manually drop the Help Facility tables in that schema. For example: $ sqlplus system/manager SQL> @?/sqlplus/admin/help/helpdrop.sql See Also: Refer to the SQL*Plus User’s Guide and Reference. Using SQL*Plus Using a System Editor from SQL*Plus An edit command entered at the SQL*Plus prompt invokes an operating system editor, such as ed, emacs, ned, or vi. Your PATH variable must include the directory of the editor. When you invoke the editor the current SQL buffer is placed in the editor. When you exit the editor, the changed SQL buffer is returned to SQL*Plus. You can specify which editor will be invoked by defining the SQL*Plus _editor variable. This variable can be set in glogin.sql, login.sql or entered during a SQL*Plus session. For example, to set the default editor to vi, enter: define_editor=vi If you do not set the _editor variable, then the value of either the EDITOR or VISUAL environment variables is used. If both are set, the EDITOR variable value is used. When _editor, EDITOR and VISUAL are not specified, the default editor is ed. Administering SQL*Plus 3-5 Using SQL*Plus When you invoke the editor, SQL*Plus uses a temporary file called afiedt.buf to pass text to the editor. You can rename this file, using the SET EDITFILE command. For example: SQL>SET EDITFILE/tmp/myfile.sql SQL*Plus does not delete the temporary file. Running Operating System Commands from SQL*Plus The HOST command or an exclamation point (!) as the first character after the SQL*Plus prompt indicates subsequent characters are passed to a sub-shell. The SHELL environment variable sets the shell used to execute operating system commands. The default shell is /bin/sh(sh). If the shell cannot be executed, an error message is displayed. You can perform operating system commands without leaving SQL*Plus by entering the HOST or (!) commands. For example, to enter one command, enter: SQL>! command where command represents the operating system command you wish to execute. Once the command has executed, control is returned to SQL*Plus. To execute more than one operating system command, press [Enter] after the [!] or HOST command. Interrupting SQL*Plus While running SQL*Plus you can stop the scrolling record display and terminate a SQL statement by pressing [Ctrl]+[c] on IBM DYNIX/ptx machines. Using the SPOOL Command The default filename extension for files generated by the SPOOL command is .lst. To change the extension, specify a spool file containing a period (.). For example: SQL> SPOOL query.lis 3-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Restrictions Restrictions Resizing Windows The default value for SQL*Plus LINESIZE and for PAGESIZE do not automatically adjust for window size. Return Codes UNIX return codes use only one byte, which is not enough space to return an Oracle error code. The range for a return code is 0 to 255. Administering SQL*Plus 3-7 Restrictions 3-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx 4 Using Oracle Precompilers and the Oracle Call Interface This chapter describes the administration tasks that you must perform to enable users to run Oracle Precompilers on DYNIX/ptx. It contains the following sections: ■ Overview of Oracle Precompilers ■ Pro*C/C++ ■ Pro*COBOL ■ Oracle Call Interface ■ Oracle Precompiler and Oracle Call Interface Linking and Makefiles ■ Thread Support ■ Static and Dynamic Linking with Oracle Libraries ■ Using Signal Handlers ■ XA Functionality Using Oracle Precompilers and the Oracle Call Interface 4-1 Overview of Oracle Precompilers Overview of Oracle Precompilers Oracle precompilers are application design tools used to combine SQL statements from an Oracle database with programs written in a high-level language. Oracle precompilers are compatible with ANSI SQL and are used to develop open, customized applications that run with Oracle8i or any other ANSI SQL DBMS. Relinking Precompiler Executables All precompiler executables are relinked using the following makefile: $ORACLE_HOME/precomp/lib/ins_precomp.mk The make command uses the following convention: $ make -f ins_precomp.mk relink EXENAME=executable This command creates the new executable in the $ORACLE_HOME/precomp/lib directory, and then moves it to the $ORACLE_HOME/bin directory. In order to create the new executable without it being moved to $ORACLE_HOME/bin, use the following command: $ make -f ins_precomp.mk executable In the preceding example, use Table 4–1 to determine the value of executable for the product you are using. Table 4–1 Products and Their Corresponding Executable Names Product Executable Pro*C/C++ 8.1.6 proc Pro*COBOL 1.8.50 procob18, or rtsora Pro*COBOL 8.1.6 procob, or rtsora Object Type Translator 8.1.6 ott For example, to relink the Pro*C/C++ executable, use the following command: $ cd $ORACLE_HOME/precomp/lib $ make -f ins_precomp.mk relink EXENAME=proc 4-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Overview of Oracle Precompilers Precompiler Configuration Files Table 4–2 lists the .cfg precompiler configuration files for each precompiler. These files are located in the $ORACLE_HOME/precomp/admin directory. Table 4–2 System Configuration Files Product Configuration File Pro*C/C++ 8.1.6 pcscfg.cfg Pro*COBOL 1.8.50 pcccob.cfg Pro*COBOL 8.1.6 pcbcfg.cfg Object Type Translator 8.1.6 ottcfg.cfg Issues Common to All Precompilers The following restrictions are common to all precompilers. Note: To run Oracle Precompiler demonstrations, Oracle8i must already be installed. Uppercase to Lowercase Conversion In languages other than C, the compiler converts an uppercase function or subprogram name to lowercase. This can cause “No such user exit” errors. In this case, verify that the function or subprogram name in your option file matches the case in the iapxtb table. Vendor Debugger Programs Precompilers and vendor-supplied debuggers can be incompatible. Oracle Corporation does not guarantee that a program with a debugger will run the same way on an operating system. Value of ireclen and oreclen The ireclen and oreclen parameters do not have maximum values. Using Oracle Precompilers and the Oracle Call Interface 4-3 Pro*C/C++ Additional Documentation For information on precompiler and interface features, see the following: ■ Programmer’s Guide to the Pro*C/C++ Precompiler ■ Programmer’s Guide to the Pro*COBOL Precompiler ■ Programmer’s Guide to the Oracle Call Interface ■ Oracle8i Server Application Developer’s Guide Pro*C/C++ For additional information regarding Pro*C/C++ 8.1.6, see the $ORACLE_HOME/precomp/doc/proc2/readme.doc file. Administering Pro*C/C++ The following is the system configuration file for Pro*C/C++: $ORACLE_HOME/precomp/admin/pcscfg.cfg. See Also: For more information, see the Programmer’s Guide to the Pro*C/C++ Precompiler. 4-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Pro*C/C++ Using Pro*C/C++ Before using Pro*C/C++, make sure that the correct version of the operating system compiler is properly installed. The required version is documented in the Oracle8i Installation Guide for IBM DYNIX/ptx. Demonstration Programs Demonstration programs are provided to show the varied functionality of the Pro*C/C++ precompiler. There are three types of demonstration programs: C, C++, and Object programs. The latter demonstrate the new Oracle8i Object features. All of the demonstration programs are located in the $ORACLE_HOME/precomp/demo/proc directory and all of them assume that the demonstration tables created by $ORACLE_HOME/sqlplus/demo/demobld.sql script are in the SCOTT schema with the password TIGER. See "Demonstration Tables" on page 3-3 for more information on building the demonstration programs using SQL*Plus. See Also: For more information on using demonstration programs, see the Programmer’s Guide to the Pro*C/C++ Precompiler. Use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk makefile to create the demonstration programs. For example, to precompile, compile, and link the sample1 demonstration program, enter the following command: $ make -f demo_proc.mk sample1 Alternatively, use the following command, which achieves the same result with more explicit syntax: $ make -f demo_proc.mk build OBJS=sample1.o EXE=sample1 By default, all programs are dynamically linked with the client shared library, $ORACLE_HOME/lib/libclntsh.so. To create all C demonstration programs for Pro*C/C++, enter this command: $ make -f demo_proc.mk samples Using Oracle Precompilers and the Oracle Call Interface 4-5 Pro*C/C++ To create all C++ demonstration programs for Pro*C/C++, enter this command: $ make -f demo_proc.mk cppsamples To create all Object demonstration programs for Pro*C/C++, enter this command: $ make -f demo_proc.mk object_samples Some demonstration programs require you to run a SQL script from the following directory: $ORACLE_HOME/precomp/demo/sql To build a demonstration program and run the corresponding SQL script, include the make macro argument, RUNSQL=run, on the command line. For example, to create the calldemo demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/calldemo.sql script, use the following command syntax: $ make -f demo_proc.mk calldemo RUNSQL=run To create all Object demonstration programs and run all corresponding required SQL scripts, enter the following command: $ make -f demo_proc.mk object_samples RUNSQL=run You can also run the SQL scripts manually. User Programs You can use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk makefile to create user programs. The general syntax for linking a user program with demo_ proc.mk is as follows: $ make -f demo_proc.mk target OBJS="objfile1 objfile2 ..." \ EXE=exename 4-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Pro*COBOL For example, to create the program, myprog, from the Pro*C/C++ source myprog.pc, use one of the following commands, depending on the source and type of executable that you want to create. ■ For C source, dynamically linked with client shared library: $ make -f demo_proc.mk build OBJS=myprog.o EXE=myprog ■ For C source, statically linked: $ make -f demo_proc.mk build_static OBJS=myprog.o EXE=myprog ■ For C++ source, dynamically linked with client shared library: $ make -f demo_proc.mk cppbuild OBJS=myprog.o EXE=myprog ■ For C++ source, statically linked: $ make -f demo_proc.mk cppbuild_static OBJS=myprog.o EXE=myprog Pro*COBOL There are two versions of Pro*COBOL included with this release: Pro*COBOL 8.1.6 and Pro*COBOL 1.8.50. Table 4–3 shows the executable, demonstration directory, and makefile for each version. Table 4–3 Pro*COBOL Naming Differences Version Executable Demonstration Directory Makefile 1.8.50 procob18 procob demo_procob18.mk 8.1.6 procob procob2 demo_procob.mk Pro*COBOL supports statically linked, dynamically linked, or dynamically loadable programs. Dynamically linked programs use the Oracle client shared library, $ORACLE_HOME/lib/libclntsh.so. Dynamically loadable programs use the rtsora executable. For more information on Pro*COBOL 8.1.6, see the following file: $ORACLE_HOME/precomp/doc/procob2/readme.doc For more information on Pro*COBOL 1.8.50, see the $ORACLE_ HOME/precomp/doc/pro1x/readme.txt file. Using Oracle Precompilers and the Oracle Call Interface 4-7 Pro*COBOL Administering Pro*COBOL The following table lists the system configuration file locations for the different versions of Pro*Cobol supported in this release: Pro*Cobol Version System Configuration File Location Pro*COBOL 8.1.6 $ORACLE_HOME/precomp/admin/pcbcfg.cfg Pro*COBOL 1.8.50 $ORACLE_HOME/precomp/admin/pcccob.cfg See Also: For more information, see the Programmer’s Guide to the Pro*COBOL Precompiler. Environment Variables The following sections describes environment variable settings for the MicroFocus COBOL compiler. MicroFocus COBOL Compiler The MicroFocus COBOL Compiler requires the COBDIR and LD_LIBRARY_PATH environment variables. The COBDIR variable must be set to the directory where the compiler is installed. For example: $ COBDIR=/opt/cobol $ export COBDIR The LD_LIBRARY_PATH variable must include the $COBDIR/coblib directory. For example: $ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$COBDIR/coblib $ export COBDIR If the LD_LIBRARY_PATH variable does not contain the $COBDIR/coblib directory, you will receive the following error when compiling a program: dynamic linker: procob: open libwtc8.so: No such file or directory procob: 19882 Killed cob: environment variable LD_LIBRARY_PATH not set 4-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Pro*COBOL Using Pro*COBOL Before you use Pro*COBOL, verify that the correct version of the COBOL compiler is properly installed. The required version for your operating system is specified in the Oracle8i Installation Guide for DYNIX/ptx. The Oracle Runtime System Oracle provides its own complete runtime system, called rtsora. To run dynamically loadable Pro*COBOL programs, use the rtsora runtime system in place of the MicroFocus provided cobrun runtime system. If you attempt to run a Pro*COBOL program with cobrun, you receive the following error: $ cobrun sample1.gnt Load error : file ’SQLADR’ error code: 173, pc=0, call=1, seg=0 173 Called program file not found in drive/directory Demonstration Programs Demonstration programs are provided to show the varied functionality of the Pro*COBOL precompiler. All programs are located in either the $ORACLE_ HOME/precomp/demo/procob or $ORACLE_HOME/precomp/demo/procob2 directories, depending on the Pro*COBOL version. All programs assume that the demonstration tables created by demobld.sql script are in the SCOTT schema with the password TIGER. See "Demonstration Tables" on page 3-3 for more information on building the demonstration programs using SQL*Plus. See Also: For more information on the demonstration programs, see the Programmer’s Guide to the Pro*COBOL Precompiler. Use the demonstration makefile to create the sample programs. The demonstration makefile for Pro*COBOL 8.1.6 is $ORACLE_HOME/precomp/demo/procob2/demo_procob.mk. Using Oracle Precompilers and the Oracle Call Interface 4-9 Pro*COBOL The demonstration makefile for Pro*COBOL 1.8.50 is $ORACLE_HOME/precomp/demo/procob/demo_procob18.mk. For example, to precompile, compile, and link the sample1 demonstration program for Pro*COBOL 8.1.6, use the following commands: $ cd $ORACLE_HOME/precomp/demo/procob2 $ make -f demo_procob.mk sample1 Alternatively, you can use the following command, which achieves the same result with more explicit syntax. $ make -f demo_procob.mk build COBS=sample1.cob EXE=sample1 By default, all programs are dynamically linked with the client shared library, $ORACLE_HOME/lib/libclntsh.so. To create all Pro*COBOL demonstration programs, enter the following command: $ make -f demo_procob.mk samples To create a dynamically loadable sample1.gnt program to be used with rtsora, and then use rtsora to run the program, enter the following commands: $ make -f demo_procob.mk sample1.gnt $ rtsora sample1.gnt To run some demonstration programs, you must run a SQL script found in the $ORACLE_HOME/precomp/demo/sql directory. To build such a demonstration program and run the corresponding SQL script, include the make macro argument, RUNSQL=run, on the command line. For example, to create the sample9 demonstration program and run the required $ORACLE_HOME/precomp/demo/sql/calldemo.sql script, use the following command syntax: $ make -f demo_procob.mk sample9 RUNSQL=run You can also run the SQL scripts manually. 4-10 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Pro*COBOL User Programs You can use the $ORACLE_HOME/precomp/demo/proc/demo_proc.mk makefile to create user programs. Make sure that you use the appropriate makefile depending on the Pro*COBOL version and COBOL compiler. The general syntax for linking a user program with demo_proc.mk is as follows: $ make -f demo_procob.mk target COBS="cobfile1 cobfile2 ..." \ EXE=exename For example, to create the program, myprog, from the Pro*COBOL source myprog.pco, use one of the following commands, depending on the type of executable and use of shared library resources that you are using. ■ For Pro*COBOL, dynamically linked with client shared library: $ make -f demo_procob.mk build COBS=myprog.cob EXE=myprog ■ For Pro*COBOL, statically linked: $ make -f demo_procob.mk build_static COBS=myprog.cob EXE=myprog ■ For Pro*COBOL, dynamically loadable, usable with rtsora: $ make -f demo_procob.mk myprog.gnt FORMAT Precompiler Option The FORMAT precompiler option specifies the format of input lines for COBOL. If you specify FORMAT=ANSI, the default, columns 1 to 6 contain an optional sequence number, column 7 indicates comments or continuation lines, paragraph names begin in columns 8 to 11, and statements begin in columns 12 to 72. If you specify FORMAT=TERMINAL, columns 1 to 6 are dropped, making column 7 the leftmost column. Using Oracle Precompilers and the Oracle Call Interface 4-11 Oracle Call Interface Oracle Call Interface Before you use the Oracle Call Interface (OCI), verify that the correct version of the Pro*C/C++ compiler is properly installed. The required version for your operating system is specified in the Oracle8i Installation Guide for DYNIX/ptx. Demonstration Programs Demonstration programs are provided that show the varied functionality of the OCI. There are two types of demonstration programs: C and C++. All of the demonstration programs are located in the $ORACLE_HOME/rdbms/demo directory. Many of the demonstration programs assume that the demonstration tables created by the $ORACLE_HOME/sqlplus/demo/demobld.sql SQL script are in the SCOTT schema with the password TIGER. See "Demonstration Tables" on page 3-3 for more information on building the demonstration programs using SQL*Plus. See Also: For more information on the demonstration programs, see the Programmer’s Guide to the Oracle Call Interface and the program source for details of each program. Use the $ORACLE_HOME/rdbms/demo/demo_rdbms.mk makefile to create the demonstration programs. For example, to compile and link the cdemo1 demonstration program, enter the following command: $ make -f demo_rdbms.mk cdemo1 Alternatively, you can use the following command which achieves the same result with more explicit syntax: $ make -f demo_rdbms.mk build OBJS=cdemo1.o EXE=cdemo1 By default, all programs are dynamically linked with the client shared library, $ORACLE_HOME/lib/libclntsh.so. To create all OCI C demonstration programs, enter this command: $ make -f demo_rdbms.mk demos To create all OCI C++ demonstration programs, enter this command: $ make -f demo_rdbms.mk c++demos instruction programs require you to run a SQL script manually before you execute the program. All the scripts are in the $ORACLE_HOME/rubdowns/demo directory. In most cases, the SQL script name is the same as the program name with a.sql extension. For example, the SQL script for the program oci02 is oci02.sql. 4-12 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle Call Interface Read the comments at the beginning of the program to determine the required SQL script, if any. User Programs You can use the $ORACLE_HOME/rdbms/demo/demo_rdbms.mk makefile to create user programs. The general syntax for linking a user program with the demo_rdbms.mk file is: $ make -f demo_rdbms.mk target OBJS="objfile1 objfile2 ..." \ EXE=exename For example, to create the program myprog from the C source myprog.c, use one of the following commands, depending on the type of executable you want: ■ For C source, dynamically linked with client shared library: $ make -f demo_rdbms.mk build OBJS=myprog.o EXE=myprog ■ For C source, statically linked: $ make -f demo_rdbms.mk build_static OBJS=myprog.o EXE=myprog To create the program myprog from the C++ source myprog.cc: ■ For C++ source, dynamically linked with client shared library: $ make -f demo_rdbms.mk buildc++ OBJS=myprog.o EXE=myprog ■ For C++ source, statically linked: $ make -f demo_rdbms.mk buildc++_static OBJS=myprog.o EXE=myprog Using Oracle Precompilers and the Oracle Call Interface 4-13 Oracle Precompiler and Oracle Call Interface Linking and Makefiles Oracle Precompiler and Oracle Call Interface Linking and Makefiles The following sections describe Oracle Precompiler and Oracle Interface linking and makefiles. Custom Makefiles Oracle Corporation recommends that you use the demo_product.mk makefiles provided to link user programs as described in the specific product sections of this chapter. You must modify the provided makefile. If you choose to use a custom written makefile, note the following: ■ ■ ■ ■ 4-14 Do not modify the order of the Oracle libraries. Oracle libraries are included on the link line more than once so that all symbols are resolved during linking. There are two reasons for this: – Oracle libraries are mutually referential, meaning that functions in library A call functions in library B, and functions in library B call functions in library A. – The DYNIX/ptx linker is a one-pass linker, meaning that the linker searches a library exactly once at the point it is encountered in the link line. If you add your own library to the link line, add it to the beginning or to the end. Do not place user libraries between the Oracle libraries. If you choose to use a make utility such as nmake or GNU make, you should be aware of how macro and suffix processing differs from the make utility provided with DYNIX/ptx. Oracle makefiles are tested and are supported with the DYNIX/ptx make utility. Oracle library names and the contents of those libraries are subject to change between releases. Always use the demo_product.mk makefile that ships with the current release as a guide to determine which libraries are necessary. Oracle8i Administrator’s Reference for IBM DYNIX/ptx Thread Support Undefined Symbols Undefined symbol error messages, similar to the following, are common when linking a program: $ make -f demo_proc.mk sample1 Undefined first referenced symbol in file sqlcex sample1.o sqlglm sample1.o ld: fatal: Symbol referencing errors. No output written to sample1 This error occurs when the linker cannot find a definition for a referenced symbol. Generally, the solution for this type of problem is to ensure that the library or object file containing the definition exists on the link line and that the linker is searching the correct directories for the file. Oracle provides a utility called symfind to assist in locating a library or object file where a symbol is defined. The following output example shows symfind locating the symbol sqlcex: $ symfind sqlcex SymFind - Find Symbol <sqlcex> in <**>.a, .o, .so -----------------------------------------------------Command: /u01/app/oracle/product/8.1.6/bin/symfind sqlcex Local Directory: /u01/app/oracle/product/8.1.6 Output File: (none) Note: I do not traverse symbolic links Use ’-v’ option to show any symbolic links Locating Archive and Object files ... [11645] | 467572| 44|FUNC |GLOB |0 |8 |sqlcex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libclntsh.so [35] | 0| 44|FUNC |GLOB |0 |5 |sqlcex ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ./lib/libsql.a Thread Support The Oracle libraries provided with this release are not thread safe, and do not support multi-threaded applications. Using Oracle Precompilers and the Oracle Call Interface 4-15 Static and Dynamic Linking with Oracle Libraries Static and Dynamic Linking with Oracle Libraries You can statically or dynamically link precompiler and OCI applications with Oracle libraries. With static linking, the libraries and objects of the whole application are linked together into a single executable program. As a result, application executables can become very large. With dynamic linking, the executing code is partly stored in the executable program and also is stored in libraries that are linked dynamically by the application at runtime. Libraries that are linked at runtime are called dynamic or shared libraries. There are two primary benefits of dynamic linking: smaller disk requirements and smaller main memory requirements. Smaller disk requirements Different applications, or different invocations of the same application, can use the same shared or dynamic library. As a result, the overall disk requirements are reduced. Smaller main memory requirements The same shared or dynamic library image (for example, the in-memory copy), can be shared by different applications. This means that a library needs to be loaded only once into the main memory and then multiple applications can use the same library. As a result, main memory requirements are reduced. Oracle Shared Library The Oracle shared library is $ORACLE_HOME/lib/libclntsh.so. If you use the Oracle provided demo_product.mk makefile to link an application, the Oracle shared library is used by default. You might need to set the LD_LIBRARY_PATH environment variable so the runtime loader can find the Oracle shared library at process startup. If you receive the following error when starting an executable, you must set the LD_LIBRARY_PATH environment variable to the directory where the Oracle shared library exists: % sample1 dynamic linker: sample1: open libclntsh.so.1.0: No such file or directory Killed 4-16 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Using Signal Handlers Set LD_LIBRARY_PATH as follows: $ LD_LIBRARY_PATH=$ORACLE_HOME/lib export LD_LIBRARY_PATH % setenv LD_LIBRARY_PATH $ORACLE_HOME/lib The Oracle shared library is created automatically during installation. If you need to re-create the Oracle shared library, exit all client applications using the Oracle shared library, including all Oracle client applications such as SQL*Plus and Recovery Manager, and run the following command logged in as the oracle user: % cd $ORACLE_HOME/rdbms/lib % make -f ins_rdbms.mk libclntsh.so Using Signal Handlers This section describes the signals that Oracle8i uses for two-task communication. It also explains how to set up your own signal handlers. Signals Signals are installed in a user process when you connect to the database and are de-installed when you disconnect. Table 4–4 describes the signals that Oracle8i uses for two-task communications. Table 4–4 Signals for Two-Task Communications Signal Description SIGCONT Used by the pipe two-task driver to send out-of-band breaks from the user process to the oracle process. SIGINT Used by all two-task drivers to detect user interrupt requests. SIGINT is not caught by oracle; it is caught by the user process. SIGPIPE Used by the pipe driver to detect end-of-file on the communications channel. When writing to the pipe, if no reading process exists, a SIGPIPE signal is sent to the writing process. SIGPIPE is caught by both the oracle process and the user process. SIGCLD Used by the pipe driver. SIGCLD is similar to SIGPIPE, but only applies to user processes, not oracle processes. When an oracle process dies, the UNIX kernel sends a SIGCLD to the user process (wait() is used in the signal handler to see if the server process died). SIGCLD is not caught by oracle; it is caught by the user process. Using Oracle Precompilers and the Oracle Call Interface 4-17 Using Signal Handlers Table 4–4 Signals for Two-Task Communications (Cont.) Signal Description SIGCONT Used by the pipe two-task driver to send out-of-band breaks from the user process to the oracle process. SIGTERM Used by the pipe driver to signal interrupts from the user side to the oracle process. This occurs when the user presses the interrupt key [Ctrl]+[c]. SIGTERM is not caught by the user process; it is caught by the oracle process. SIGIO Used by Net8 protocol methods to indicate incoming networking events. SIGURG Used by the Net8 TCP/IP drivers to send out-of-band breaks from the user process to the oracle process. The listed signals affect precompiler applications. You can install one signal handler for SIGCLD (or SIGCHLD) and SIGPIPE when connected to the oracle process. You can have multiple signal handlers for SIGINT as long as the osnsui() routine is called to set this up. You can install as many signal handlers as you want for other signals. If you are not connected to the oracle process, you can have multiple signal handlers. Sample Signal Routine The following example shows how you can set up your own signal routine and the catching routine. For SIGINT, use osnsui() and osncui() to register and delete signal-catching routines. /* user side interrupt set */ word osnsui( /*_ word *handlp, void (*astp), char * ctx, _*/) /* ** osnsui: Operating System dependent Network Set User-side Interrupt. Add an interrupt handling procedure astp. Whenever a user interrupt(such as a ^C) occurs,call astp with argument ctx. Put in *handlp handle for this handler so that it may be cleared with osncui. ** Note that there may be many handlers; each should be cleared using osncui. An error code is returned if an error occurs. */ /* user side interrupt clear */ word osncui( /*_ word handle _*/ ); /* ** osncui: Operating System dependent Clear User-side Interrupt. ** Clear the specified handler. The argument is the handle obtained from osnsui. 4-18 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Using Signal Handlers An error code is ** returned if an error occurs. */ The following is a template for using osnsui() and osncui() in an application program: /* ** My own user interrupt handler. */ void sig_handler() { ... } main(argc, argv) int arc; char **argv; { int handle, err; ... /* set up my user interrupt handler */ if (err = osnsui(&handle, sig_handler, (char *) 0)) { /* if the return value is non-zero, an error has occurred Do something appropriate here. */ ... } ... /* clear my interrupt handler */ if (err = osncui(handle)) { /* if the return value is non-zero, an error has occurred Do something appropriate here. */ ... } ... } Using Oracle Precompilers and the Oracle Call Interface 4-19 XA Functionality XA Functionality When building a TP-monitor XA application, ensure that the TP-monitor libraries (that define the symbols ax_reg and ax_unreg) are placed in the link line before Oracle client shared library. This link restriction is required only when using XA dynamic registration (Oracle XA switch xaoswd). Oracle8i does not support Oracle7 release 7.1.6 XA calls (although it does support release 7.3 XA calls). Therefore TP-monitor XA applications using release 7.1.6 XA calls must be relinked with the Oracle8i XA library. The Oracle8i XA calls are defined in both the $ORACLE_HOME/lib/libclntsh.so shared library and the $ORACLE_HOME/lib/libclient8.a static library 4-20 Oracle8i Administrator’s Reference for IBM DYNIX/ptx 5 Configuring Net8 This chapter describes how to configure Oracle Net8 after you have installed it. For information about installing Oracle Net8, see Chapter 3 of the Oracle8i Installation Guide for DYNIX/ptx. This chapter contains the following sections: ■ Supplementary Documentation ■ Core Net8 Products and Features ■ Net8 Protocol Support ■ BEQ Protocol ■ IPC Protocol ■ RAW Protocol ■ TCP/IP Protocol Adapter ■ SPX/IPX Protocol ■ Net8 Naming Support ■ Configuring Oracle Intelligent Agent for Oracle SNMP ■ Oracle Advanced Security Configuring Net8 5-1 Supplementary Documentation Supplementary Documentation The following documents fully describe Net8 features: ■ Net8 Administrator’s Guide ■ Oracle Advanced Security Administrator’s Guide Supplementary Information in README Files Table 5–1 shows the location of readme files for various bundled products. The readme files describe changes since the last release. Table 5–1 Location of README Files for Oracle Products Product README File Net8 $ORACLE_HOME/network/doc/README.Net8 Advanced Security Option $ORACLE_HOME/network/doc/README.ASO Oracle Intelligent Agent $ORACLE_HOME/network/doc/README.oemagent Core Net8 Products and Features The following sections describe core Net8 products and features. Table 5–2 lists sources of information on additional Net8 products: Table 5–2 Additional Net8 Product Information Product Documentation Sample Net8 configuration files Net8 Administrator’s Guide Oracle Connection Manager Net8 Administrator’s Guide Multi-Threaded Server Net8 Administrator’s Guide and Oracle8i Administrator's Guide Oracle Names Net8 Administrator’s Guide Net8 Files and Utilities This section describes the files and utilities that you can use to configure Oracle Net8 products. 5-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Core Net8 Products and Features Location of Net8 Configuration Files The default directory for Net8 configuration files on DYNIX/ptx systems is /etc/oracle. Oracle Net8 searches the following locations for global files in the following order: 1. The directory specified by the $TNS_ADMIN environment variable 2. The /etc directory 3. The $ORACLE_HOME/network/admin directory (to search for the sqlnet.ora file) If your files are not in the default directory, use the TNS_ADMIN environment variable in the startup files of all network users to specify a different location: For the C shell, enter: % setenv TNS_ADMIN directory_path For Bourne or Korn shell, enter: $ TNS_ADMIN=directory_path $ export TNS_ADMIN For each system level configuration file, users might have a corresponding local configuration file (stored in the user’s home directory). The settings in the local file override the settings in the system level file. The local configuration file for sqlnet.ora is $HOME/.sqlnet.ora. The local configuration file for tnsnames.ora is $HOME/.tnsnames.ora. Syntax for these files is identical to that of the corresponding system files. Sample Configuration Files Examples of the cman.ora, listner.ora, names.ora, sqlnet.ora, and tnsnames.ora configuration files are located in the $ORACLE_ HOME/network/admin/samples directory. The Adapters Utility Net8 provides support for various network protocols and naming methods. They are linked into particular executables and provide the interface between network protocols and Net8. To display installed Net8 protocol adapters, enter: $ adapters Configuring Net8 5-3 Net8 Protocol Support To display protocol adapters linked with a specific executable, enter: $ adapters executable For example, the following command displays the Net8 protocols linked with the oracle executable: $ adapters oracle Net8 Protocol Adapters linked with oracle are: BEQ Protocol Adapter IPC Protocol Adapter TCP/IP Protocol Adapter RAW Protocol Adapter SPX/IPX Protocol Adapter Net8 Naming Adapters linked with oracle are: Oracle TNS Naming Adapter Oracle Naming Adapter Net8 Configuration Assistant Oracle Java Runtime Environment is installed with Net8 Assistant ($ORACLE_HOME/bin/netasst). When you run the Net8 Assistant command script, the java command script supplied with JRE 1.1.6 is called explicitly, regardless of other Java installations on the system. See Also: For information on the Net8 Configuration Assistant, see the Net8 Administrator’s Guide. Net8 Protocol Support Oracle8i for DYNIX/ptx includes the following protocol adapters for Net8 version 8.1.6: 5-4 ■ BEQ Protocol ■ IPC Protocol ■ RAW Protocol ■ TCP/IP Protocol ■ SPX/IPX Protocol Oracle8i Administrator’s Reference for IBM DYNIX/ptx Net8 Protocol Support Before you install a protocol adapter, make sure that the protocol is installed and configured. See the Oracle8i Installation Guide for DYNIX/ptx for requirements. ADDRESS Specification The IPC, TCP/IP, and SPX/IPX Net8 protocol adapters each have a protocol-specific ADDRESS specification that is used for Net8 configuration files and for the MTS_ LISTENER_ADDRESS database initialization parameter (initsid.ora). See the ADDRESS specification heading under each protocol section in this chapter for details. Table 5–3 shows a summary of ADDRESS specifications for each protocol adapter. Table 5–3 Address Specifications for Each Protocol Adapter Protocol Adapter ADDRESS Specification BEQ (ADDRESS = (PROTOCOL = BEQ) (PROGRAM = ORACLE_HOME/bin/oracle) (ARGV0 = oracleORACLE_SID) (ARGS = ’(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))’) (ENVS = ’ORACLE_HOME=ORACLE_HOME,ORACLE_ SID=ORACLE_SID’) ) IPC (ADDRESS = (PROTOCOL=IPC) (KEY=key) ) RAW N/A TCP/IP (ADDRESS = (PROTOCOL=TCP) (HOST=hostname) (PORT=port_id) ) SPX/IPX (ADDRESS = (PROTOCOL=SPX) (SERVICE=servicename) ) Configuring Net8 5-5 BEQ Protocol See Also: For more information about configuring Oracle Net8, see the Oracle Net8 Administrator’s Guide. BEQ Protocol The BEQ protocol adapter is both a communications mechanism and a process-spawning mechanism. It requires that the client and server be on the same system. The BEQ protocol is used unless a service name is specified by the user directly through the command line or login window, or indirectly through an environment variable such as TWO_TASK. The BEQ protocol always uses a dedicated server. The multi-threaded server is never used. This dedicated server is started automatically by the BEQ protocol, which waits for the server process to start and attach to an existing System Global Area (SGA). If the startup of the server process is successful, the BEQ protocol then provides inter-process communication through UNIX pipes. An important feature of the BEQ protocol is that no listener is required for its operation. The protocol is linked into the client tools and directly starts its own server process without outside interaction. However, the BEQ protocol can be used only when the client program and Oracle8i are installed on the same computer. The BEQ protocol is always installed and always linked to all client tools and to the Oracle8i server. Specifying a BEQ ADDRESS The BEQ protocol connection parameters are part of the ADDRESS keyword-value pair. You can enter the following parameters in any order: (ADDRESS = (PROTOCOL = BEQ) (PROGRAM = ORACLE_HOME/bin/oracle) (ARGV0 = oracleORACLE_SID) (ARGS = ’(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))’) (ENVS = ’ORACLE_HOME=ORACLE_HOME,ORACLE_SID=ORACLE_SID’) ) 5-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx IPC Protocol Table 5–4 describes the syntax for the BEQ protocol connection parameters. Table 5–4 Syntax for BEQ Protocol Connection Parameters Parameter Description PROTOCOL The protocol adapter to be used. The value is BEQ. It is not case sensitive. PROGRAM The full path to the oracle executable. ARGV0 The name of the process as it appears in a ps listing. The recommended value is oracleORACLE_SID. ARGS ’(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))’ ENVS Environment specification where ORACLE_HOME is the full path to the $ORACLE_HOME directory of the database to connect, and ORACLE_SID is the system identifier of the database to connect. Example 5–1 shows a sample BEQ ADDRESS. Example 5–1 BEQ ADDRESS Specifying a Client (ADDRESS = (PROTOCOL = BEQ) (PROGRAM = /u01/app/oracle/product/Release 2 (8.1.6)/bin/oracle) (ARGV0 = oracleV816) (ARGS = ’(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=BEQ)))’) (ENVS = ’ORACLE_HOME=/u01/app/oracle/product/Release 2 (8.1.6),ORACLE_SID=V816’) ) The ADDRESS is commonly part of a larger construct such as a connect descriptor or configuration file. IPC Protocol The IPC protocol is similar to the BEQ protocol in that it can only be used when the client program and the Oracle8i server are installed on the same system. The IPC protocol differs from the BEQ protocol in that it can be used with dedicated server and multi-threaded server configurations. The IPC protocol requires a listener for its operation. The IPC protocol is always installed and always linked to all client tools and to Oracle8i. For the IPC protocol, the location of the UNIX Domain Socket (IPC) file on UNIX systems changed after Oracle7 release 7.1. If you have Oracle7 release 7.1 installed on the same computer as Oracle8i and you attempt to make an IPC connection Configuring Net8 5-7 IPC Protocol between the two instances, the connection might fail. To solve this problem, make a symbolic link from the previous location of the IPC file directory (/var/tmp/o) to its current directory location (/var/tmp/.oracle). Specifying an IPC ADDRESS The IPC protocol connection parameters are part of the ADDRESS keyword-value pair. You can enter the following parameters in any order: (ADDRESS= (PROTOCOL=IPC) (KEY=key) ) Table 5–5 describes the syntax for IPC protocol connections parameters. Table 5–5 Syntax for IPC Protocol Connection Parameters Parameter Description PROTOCOL IPC protocol adapter to be used. The value is IPC. It is not case sensitive KEY Service name of database or database identifier (ORACLE_SID). Example 5–2 shows a sample IPC ADDRESS. Example 5–2 IPC ADDRESS Specifying a Client (ADDRESS= (PROTOCOL=IPC) (KEY=PROD) ) The ADDRESS is commonly part of a larger construct such as a connect descriptor or configuration file. 5-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx TCP/IP Protocol Adapter RAW Protocol When data is transferred between a client and a server, Net8 adds its own header information to every packet (a block of information sent over the network). Through the Raw Transport feature, Net8 can now minimize header information on each packet going over the network. After the connection is established, two types of information flow over the network: data and break handling. The connection packets need the Net8 header information to establish the connection correctly. However, after the connection is established, all data packets are stripped of their Net8 header information and passed directly to the operating system, bypassing Net8 network and protocol layers. The performance of the connection is increased because of fewer protocol stack layers for the data to flow through and fewer bytes that are transmitted over the network. This feature is transparently enabled when it is required. If no existing features require that header information be transmitted, the headers are stripped. For example, Raw Transport would not be enabled when you use encryption and authentication, which require certain information to be sent with each packet of information. This feature requires no configuration. Net8 determines whether the conditions are met and then transparently switches to Raw Transport mode if required. TCP/IP Protocol Adapter Oracle Corporation recommends that you reserve a port for your listener in the /etc/services file of each Net8 node on the network. The default port is 1521. For example, the entry lists the listener name and the port number: listener 1521/tcp In this example listener is the name of the listener, as defined in the listener.ora file. Reserve more than one port to start more than one listener. Configuring Net8 5-9 SPX/IPX Protocol Specifying a TCP/IP ADDRESS The TCP/IP protocol connection parameters are part of the ADDRESS keyword-value pair. You can enter the parameters in any order: (ADDRESS= (PROTOCOL=TCP) (HOST=hostname) (PORT=port_id) ) Table 5–6 describes the syntax for the TCP/IP protocol connection parameters. Example 5–3 shows a sample TCP/IP ADDRESS. Table 5–6 Syntax for TCP/IP Protocol Connection Parameters Parameter Description PROTOCOL The protocol adapter to be used. The value is TCP. It is not case sensitive. HOST The host name or the host IP address. PORT The TCP/IP port. Either a number or the name specified in the /etc/services file. Oracle Corporation recommends a value of 1521. Example 5–3 TCP/IP ADDRESS Specifying a Client The following is an example of a TCP/IP ADDRESS: (ADDRESS= (PROTOCOL=TCP) (HOST=MADRID) (PORT=1521) ) The last field could be specified by name, for example, (PORT=listener). The ADDRESS is commonly part of a larger construct such as a connect descriptor or configuration file. SPX/IPX Protocol Oracle SPX/IPX protocol adapter provides a transparent, two-task communications interface between Oracle8i and client applications running on DOS, UNIX, OS/2, or Novell Netware OS. 5-10 Oracle8i Administrator’s Reference for IBM DYNIX/ptx SPX/IPX Protocol The ntisbsdm Broadcast Daemon A client uses a name and translates the name into an SPX address to identify a server and communicate with it. The netware bindery is a directory service that provides the translation mechanism. When a server is registered with the bindery, it periodically notifies the bindery of its address. This is done using the Server Advertising Protocol (SAP). The server broadcasts a SAP packet in an IPX datagram every 60 seconds. This SAP packet contains all relevant addressing information. Any client can then query its nearest server for the address of the required server. The Oracle SPX/IPX protocol broadcasts using the ntisbsdm broadcast daemon in the $ORACLE_HOME/bin directory. The ntspxctl utility starts and stops the ntisbsdm daemon. The ntspxctl Utility The ntspxctl utility contains functions to register and remove names, and to query a bindery. It can also be used to stop and start the broadcast daemon. (The listener automatically uses the daemon to register service names in use.) Example 5–4 demonstrates several uses of the ntspxctl utility. Example 5–4 Using the ntspxctl Utility The ntspxctl utility reads commands from the command line. If parameters are missing, it prompts for them. To start ntspxctl, enter: $ ntspxctl Output similar to the following is displayed: ntspxctl: Version 2.0.12.1 - on Fri Jul 3 11:43:50 2000 To start the broadcast daemon, enter: ntspxctl> startup Output similar to the following is displayed: ntisbsdm started at Fri Jul 3 11:43:47 2000 A system message is displayed if the daemon has already been started. Configuring Net8 5-11 SPX/IPX Protocol You should automate broadcast daemon startup, so that it is always started when the computer is started. Automate daemon startup by adding an entry to the /etc/inittab file. For example, to start the ntisbsdm on system startup add the following line to the /etc/inittab directory: ntspxctl:2:once:/u/oracle/bin/ntisbsdm & In the preceding example, /u/oracle is the full path to the $ORACLE_HOME directory. To register a name for testing, enter register and the server name. For example: ntspxctl> register YYY This creates a socket owned by the ntisbsdm daemon and registers it. A message similar to the following is displayed: Name YYY successfully registered YYY address 00eee045:000000000001:4454 To check the status of the ntisbsdm daemon, enter: ntspxctl> status or ntspxctl> summary A message similar to the following is displayed: ntisbsdm started at Fri Jul 3 11:43:47 1998 Tracing is off Pid: 14784 YYY SPX/IPX Protocol Command Summary Table 5–7 shows the help command summary for the SPX/IPX protocol. Table 5–7 help Command Summary 5-12 Register Name Register Entry remove name Remove entry shutdown [force] Shut down ntisbsdm startup Get status summary traceon Activate trace Oracle8i Administrator’s Reference for IBM DYNIX/ptx SPX/IPX Protocol Table 5–7 help Command Summary Register Name Register Entry traceoff Deactivate trace status Get full status getname name | hex_number Query name services exit Exit program help [command] Print command information ! Shell escape The getname Command The getname command asks the Novell system for names. It does not involve the broadcast daemon. Enter: getname name servicetype A message similar to the following is displayed: getname name servicetype (address number_of_hops) The syntax for the getname command is explained in the following table. Table 5–8 Syntax for the getname Command Variable Description name The name you entered. servicetype A number assigned by Novell. Oracle has the number 103. address The address of the name you entered. number_of_hops The number of hops to the destination, displayed in hexadecimal. The value 10 means the name is deregistered. If SAP queries are not supported, the value is 0000. To see all possible names, enter: getname * * Example 5–5 shows names obtained using the getname command. Configuring Net8 5-13 SPX/IPX Protocol Example 5–5 Using the getname Command ntspxctl> getname YYY * YYY servertype x0103 address 4465 hops 0000 ntspxctl> getname * 103 LSNR servertype x0103 address 502c hops 0000 IBM6 servertype x0103 address 507f hops 0000 DESK servertype x0004 address 5451 hops 0000 DESK servertype x0107 address 5104 hops 0000 CXY4 servertype x009e address 5063 hops 0000 IBM2 servertype x0004 address 5451 hops 0000 00eee045:000000000001: 00eee053:000000000001: 00eee058:000000000001: 00eee055:000000000001: 00eee055:000000000001: 00eee055:000000000001: 00eee057:000000000001: To stop ntisbsdm, enter: ntspxctl> shutdown The daemon is not stopped if names are still registered. A message similar to the following is displayed: 1 names are registered ntisbsdm not stopped To remove a name, enter remove and the name. Following is an example for the name YYY: ntspxctl> remove YYY A message similar to the following is displayed: Name xxx removed. ntspxctl> shutdown ntisbsdm stopped To force a stop, enter: ntspxctl> shutdown force A message similar to the following is displayed: ntisbsdm stopped 5-14 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Net8 Naming Support Specifying the SPX/IPX ADDRESS After the SPX/IPX protocol and Oracle SPX/IPX protocol adapter are installed on your system, you can use the SPX/IPX parameters with the TNS connect descriptors to identify SPX/IPX community nodes. The SPX/IPX protocol parameters are part of the ADDRESS keyword-value pairs. (ADDRESS= (PROTOCOL=SPX) (SERVICE=servicename) ) Table 5–9 explains the syntax for the SPX/IPX protocol connection. Table 5–9 Syntax for SPX/IPX Protocol Connection Keyword Description PROTOCOL Specifies the protocol name. For SPX/IPX, the value is spx. SERVICE A unique name (up to 30 characters) identifying an application on the network. The service is named during startup and is available to the entire network. Client references to the service are made using lookup in the bindery, a network directory. Example 5–6 shows an SPX/IPX ADDRESS specifying service MAILDB1 on a remote server. Example 5–6 SPX/IPX Protocol Connection (ADDRESS= (PROTOCOL=SPX) (SERVICE=MAILDB1) ) This ADDRESS is commonly part of a larger construct such as a connect descriptor or configuration file. Net8 Naming Support For information on configuring the NIS Naming Support, see the Net8 Administrator’s Guide. Configuring Net8 5-15 Configuring Oracle Intelligent Agent for Oracle SNMP Configuring Oracle Intelligent Agent for Oracle SNMP Although Oracle Intelligent Agent does not require Simple Network Management Protocol (SNMP) to work, you can configure Oracle SNMP support before starting the Intelligent Agent. Note that all of the configuration files for the following steps are located in the $ORACLE_HOME/network/snmp/peer directory. Configure Master Agent In the CONFIG.master file, make the following change: 1. Search for the line beginning with MANAGER. 2. Change the ipaddr field, coded as 130.35.10.210, to the IP address or hostname of the system where you want SNMP trap messages sent. You can also make other changes to the CONFIG.master file as documented within the file. Configure the Encapsulator To configure the encapsulator, perform the following steps: 1. Add the following line to the snmpd.conf file, where hostname_or_IP_address represents the local systems IP address: trap hostname_or_IP_address 2. In the CONFIG.encap file, you can modify the port number. The default is 1161. If you modify the port number, you must also modify the port number for NEW_SNMPD_PORT in the start_peer script. NEW_SNMPD_PORT is the port on which the snmpd agent (the native DYNIX/ptx SNMP agent) listens. Make sure this is the same port as specified in the CONFIG.encap file. NEW_TRAPD_PORT is the PEER encapsulator port to which the snmpd agent sends traps. NEW_SNMPD_PORT and NEW_TRAPD_PORT in the start_peer script must have different port numbers. You can also modify the NEW_TRAPD_ PORT port number. 5-16 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Configuring Oracle Intelligent Agent for Oracle SNMP Verify start_peer Script The start_peer script contains a line similar to the following: SNMPD = snmpd_executable_path If the snmpd executable on your system is not in the location indicated by the start_peer script, correct the location of the snmpd executable in the snmpd_ executable_path. Start the SNMP Components Perform the following steps to start the SNMP components: 1. Verify that the SNMP components (master_peer, encap_peer, and snmpd) are not running: $ ps -aef | grep peer $ ps -aef | grep snmp If any of the components are running, log in as the root user and use the kill command to terminate the processes before proceeding. 2. As the root user, run the start_peer script to start the PEER master agent, PEER encapsulator, and native DYNIX/ptx SNMP agent: Note: If you do not have the native DYNIX/ptx SNMP agent on your system, you must not use the PEER encapsulator. To start the master agent only, run start_peer -m. # cd $ORACLE_HOME/network/snmp/peer # ./start_peer -a 3. Verify that the SNMP components are running: # ps -aef | grep peer # ps -aef | grep snmp Configure and Start the Database Subagent Configuration and startup of the database subagent (the Oracle Intelligent Agent) is described in the Oracle Enterprise Manager Configuration Guide. Configuring Net8 5-17 Oracle Advanced Security Oracle Advanced Security The following section describes the Oracle Advanced Security Option. .bak Files When you install Oracle Advanced Security, three.bak files are created: naeet.o.bak, naect.o.bak, and naedhs.o.bak. They are located in the $ORACLE_HOME/lib directory. These files are required for relinking during the de-installation of Oracle Advanced Security. Do not delete them. Security and Single Sign-On For more information about configuring Security and Single Sign-On, see the Oracle Advanced Security Administrator’s Guide. 5-18 Oracle8i Administrator’s Reference for IBM DYNIX/ptx 6 Running Oracle Data Option Demos ■ Additional Documentation ■ Oracle8i interMedia ■ Oracle8i Time Series Demos ■ Oracle8i Visual Information Retrieval ■ Oracle8i Spatial Running Oracle Data Option Demos 6-1 Additional Documentation Additional Documentation The following documents provide in-depth information about the Oracle options available in Oracle8i Release 2 (8.1.6): ■ Oracle8i interMedia Audio, Image, and Video User’s Guide and Reference ■ Oracle8i interMedia Audio, Image, and Video Java Client User’s Guide and Reference ■ Using Oracle8i interMedia with the Web ■ Oracle8i interMedia Locator User’s Guide and Reference ■ Oracle8i interMedia Text Reference ■ Oracle8i ConText to interMedia Text Migration ■ Oracle8i Visual Information Retrieval User’s Guide ■ Oracle8i Visual Information Retrieval Java Client User’s Guide ■ Oracle8i Time Series User’s Guide ■ Oracle8i Spatial User’s Guide and Reference Oracle8i interMedia Oracle8i interMedia includes the following components: ■ Text ■ Audio, Video, and Image ■ Locator ■ Web Agent and Clipboard Text See Also: Oracle8i interMedia Text Reference, and Oracle8i ConText interMedia Text Migration. There are no demos for Text in Oracle8i. However, interMedia Text now includes code samples. Point your browser at the following URL: $ORACLE_HOME/ctx/sample/api/index.html 6-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle8i interMedia Audio, Video, and Image See Also: Oracle8i interMedia Audio, Image, and Video User’s Guide and Reference and Oracle8i interMedia Audio, Image, and Video Java Client User’s Guide and Reference. Oracle8i interMedia includes a number of scripts and sample programs in the following directories: $ORACLE_HOME/ord/aud/demo/ $ORACLE_HOME/ord/img/demo/ $ORACLE_HOME/ord/vid/demo/ Sample Audio Scripts The audio scripts consist of the following files: ■ ■ ■ auddemo.sql - audio demonstration that shows features of the audio object including: – checking interMedia objects – creating a sample table with audio in it – inserting NULL rows into the audio table – checking the rows out – checking all the audio attributes directly – checking all the audio attributes by calling methods – installing your own format plug-in using the two files, fplugins.sql and fpluginb.sql described in the next two list items and in Oracle8i interMedia Audio, Image, and Video User’s Guide and Reference on how to extend interMedia Audio to support a new audio data format fplugins.sql - demo format plug-in specification that you can use as a guideline to write any format plug-in you want to support. fpluginb.sql - demo format plug-in body that you can use as a guideline to write any format plug-in you want to support. See the README.txt file in the $ORACLE_HOME/ord/aud/demo directory for requirements and instructions on running this SQL demo. Running Oracle Data Option Demos 6-3 Oracle8i interMedia Sample Program for Modifying Images or Testing the Image Installation Once you have installed Oracle8i interMedia Image, you can run the Oracle8i interMedia Image demonstration program. This program can also be used as a test to confirm successful installation. This section contains the steps required to build and run the interMedia image demo. The interMedia Image demo files are located in $ORACLE_HOME/ord/img/demo, where $ORACLE_HOME is the ORACLE_HOME directory. Demonstration (Demo) Installation Steps 1. The Oracle8i interMedia Image demo uses the SCOTT/TIGER database user. If this user does not exist, you must create it: % svrmgrl SVRMGRL> connect internal; SVRMGRL> create user SCOTT identified by tiger; SVRMGRL> grant connect,resource to SCOTT; 2. Create the image demo directory where $ORACLE_HOME is the $ORACLE_HOME directory. % svrmgrl SVRMGRL> connect internal; SVRMGRL> create or replace directory imgdemodir as ‘$ORACLE_HOME/ord/img/ demo’; 3. Grant privileges on the directory to PUBLIC: SVRMGRL> grant read on directory imgdemodir to public with grant option; 4. If needed, make the imgdemo program. % cd $ORACLE_HOME/ord/img/demo % make -f demo_ordimg.mk imgdemo Running the Demo The imgdemo file is a sample program that shows how Oracle8i interMedia Image can be used from within a program. The demo is written in C and uses OCI (Oracle Call Interface) to access the database and exercise Oracle8i interMedia Image. The program operates on imgdemo.dat, which is a bitmap (BMP) image in the demo directory. Optionally, you can supply an image file name on the command 6-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle8i interMedia line, provided the file resides in the same directory as the demo. In either case, once the image has been manipulated by Oracle8i interMedia Image, the resulting image is written to the file imgdemo.out and can then be viewed with common rendering tools that you supply. When the demo is run, it deletes and re-creates a table named IMGDEMOTAB in the SCOTT/TIGER schema of the default database. This table is used to hold the demo data. Once the table is created, a reference to the image file is inserted into the table. The data is then loaded into the table and converted to JFIF using the processCopy( ) method of ORDImage. The image properties are extracted within the database using the setProperties( ) method. An UPDATE command is issued after the setProperties( ) invocation. This is required because the setProperties( ) invocation has only updated a local copy of the type attributes. Next, the Oracle8i interMedia Image process( ) method is used to cut and scale the image within the database. This is followed by an update that commits the change. The program cuts a portion of the image 100 pixels wide by 100 pixels high starting from pixel location (100,100). This sub-image is scaled to twice its original size and the resulting image is written to a file named imgdemo.out in the current directory. Example 6–1 Execute the Demo from the Command Line Execute the demo by typing imgdemo on the command line. Optionally, you can use a different image in the demo by first copying the file to the directory in which the demo resides and then specifying its file name on the command line as an argument to imgdemo. Use the following command: $ imgdemo optional-image-filename Running Oracle Data Option Demos 6-5 Oracle8i interMedia The demo displays a number of messages describing its progress, along with any errors encountered if something was not set up correctly. Expect to see the following messages: Dropping table IMGDEMOTAB... Creating and populating table IMGDEMOTAB... Loading data into cartridge... Modifying image characteristics... Writing image to file imgdemo.out... Disconnecting from database... Logged off and detached from server. Demo completed successfully. If the program encounters any errors, it is likely that either Oracle8i interMedia software has not been installed correctly or the database has not been started. If the program completes successfully, the original image and the resultant image, which has undergone the cutting and scaling described earlier, can be viewed with common image rendering tools. Sample Video Scripts The Video scripts consist of the following files: ■ ■ ■ 6-6 viddemo.sql - video demo that shows features of the video object including: – checking interMedia objects – creating a sample table with video in it – inserting NULL rows into the video table – checking the rows out – checking all the video attributes directly – checking all the video attributes by calling methods – installing your own format plug-in using the two files, fplugins.sql and fpluginb.sql described in the next two list items and in Oracle8i interMedia Audio, Image, and Video User’s Guide and Reference on how to extend interMedia Video to support a new video data format fplugins.sql - demo format plug-in specification that you can use as a guideline to write any format plug-in you want to support fpluginb.sql - demo format plug-in body that you can use as a guideline to write any format plug-in you want to support Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle8i interMedia See the README.txt file in the $ORACLE_HOME/ord/vid/demo directory for requirements and instructions on how to run this SQL demo. Java Demo A Java demo has been provided to help you learn to use both the audio and video client-side Java classes so you can build your own applications. In these two demos, the audio and video object is instantiated at the client side and a number of accessor methods are invoked. The audio Java demo files are located in the ORACLE_HOME/ord/aud/demo directory and the video Java demo files are located in the $ORACLE_HOME/ord/vid/demo directory. See the README.txt file in each directory for requirements and instructions on how to run each respective Java demo. MediaAnnotator The MediaAnnotator program is not contained on the Oracle8i interMedia CD. It (along with other free Oracle software) can be found at the following URL: http://www.oracle.com/products/free_software/ Locator Oracle8i interMedia Locator includes a number of scripts that you can modify and run. See Also: Oracle8i interMedia Locator User’s Guide and Reference. Sample Scripts Sample Oracle8i interMedia Locator scripts are available in the following directory after you install this product: $ORACLE_HOME/md/demo/geocoder These scripts consist of the following files: ■ geohttp.sql This file contains two parts. One part is for running a geocode function in interactive mode and the other is for running the geocode function in batch mode. Running Oracle Data Option Demos 6-7 Oracle8i interMedia – Interactive mode. See Example 1 in "GEOCODE1 Function (with lastline field)" in the Oracle8i interMedia Locator User’s Guide and Reference for a listing of this part of the file. – Batch mode. You must update the setup tables in the nh_cs.sql file before you run the geohttp.sql in batch mode. See the Oracle8i interMedia Locator User’s Guide and Reference for Example 2 in "GEOCODE1 Function (with lastline field)" or Example 3 in "GEOCODE1 Function (with lastline field)" for a listing of this part of the file. ■ geoindex.sql This file contains: ■ – A function named ESTIMATE_LEVEL to better estimate the index level for use with the spatial locator index for within-distance queries that use a radius distance greater than 100 miles. For a listing of this file, see the example in "ESTIMATE_LEVEL" in the Oracle8i interMedia Locator User’s Guide and Reference. – A procedure statement named SETUP_LOCATOR_INDEX that builds a setup spatial locator index on the location column that contains the spatial information within the cust_table table where the spatial information is stored. For a listing of this file, see the example in "SETUP_LOCATOR_INDEX" , Chapter 2 in Oracle8i interMedia Locator User’s Guide and Reference. geolocate.sql This file contains a routine that dynamically creates a geometry of interest and then queries against the NH_COMPUTER_STORES table to find out how many stores are within a 10-mile radius of the office. For a listing of this file, see Example 2 in "LOCATOR_WITHIN_DISTANCE" the Oracle8i interMedia Locator User’s Guide and Reference. 6-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle8i Time Series Demos Web Agent and Clipboard See Also: Using Oracle8i interMedia with the Web For this release, two components of Oracle8i interMedia, the Clipboard and Web Agent, are not available on the Oracle8i media. You can download the components from the Oracle Technology Network web site: http://technet.oracle.com Choose products, then go to interMedia to find the interMedia free software downloads. The documentation, which includes README files and the manual Using Oracle8i interMedia with the Web, is included in the download. Oracle8i Time Series Demos See Also: Oracle8i Time Series User’s Guide Table 6–1 shows the demos included with Oracle8i Time Series. This table includes a description of each demo and the default directory in which its files are installed. The demo directory can be found at $ORACLE_HOME/ord/ts. Table 6–1 Oracle8i Time Series Demos Description Directory Quick-start demo: quick and easy start using Oracle8i Time Series (See Chapter 1 in Oracle8i Time Series User’s Guide.) demo/tsquick Usage demo for end users and product developers who want to use existing Oracle8i Time Series features (See Chapter 1 in Oracle8i Time Series User’s Guide.) demo/usage Electric utility application demonstrating how to compute peak and off-peak summaries of 15-minute data demo/usageutl Java-based retrieval of time series data, using the prototype Oracle8i Time Series Java API and designed to run in a Web browser (See Chapter 1 in Oracle8i Time Series User’s Guide.) demo/applet Simple Java code segments that perform time series operations and print the results (See Chapter 1 in Oracle8i Time Series User’s Guide.) demo/java Running Oracle Data Option Demos 6-9 Oracle8i Visual Information Retrieval Table 6–1 Oracle8i Time Series Demos (Cont.) Description Directory Demo showing the use of administrative tools procedures to "retrofit" existing time series detail tables; also, how to support time series queries for multiple qualifier columns in the time series detail table. demo/retrofit Advanced-developer demo for those who want to extend Oracle8i demo/extend Time Series features OCI demo showing how to call Oracle8i Time Series functions using the Oracle Call Interface demo/oci PRO*C/C++ demo showing how to call Oracle8i Time Series functions in applications created using the Oracle Pro*C/C++ Precompiler demo/proc Oracle Developer demo showing how to call Oracle8i Time Series functions in an Oracle Forms application demo/dev2k The README.txt file in the demo directory introduces the demos. Also, the directory for each demo contains a README.txt file with a more detailed description of that demo. Oracle8i Visual Information Retrieval See Also: Oracle8i Visual Information Retrieval User’s Guide and Reference and Oracle8i Visual Information Retrieval Java Client User’s Guide and Reference A sample program is included with Visual Information Retrieval. The sample program demonstrates how to load two images into the database, generate their signatures, and then compare their signatures using a weighted similarity function. This program uses two data files, virdemo1.dat and virdemo2.dat, as its input. No other input or parameters are required. 6-10 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Oracle8i Visual Information Retrieval Environment The following assumptions are made: ■ ■ ■ ■ Visual Information Retrieval has been installed and PUBLIC has EXECUTE privilege on it. The install script has been run. VIRDEMODIR directory has been created and granted PUBLIC READ access in order that the image data file can be read into the database. virdemo1.dat and virdemo2.dat are valid image files that reside in the VIRDEMODIR directory and the user has read/write access to the directory. User SCOTT has the default "TIGER" password. You may need to increase the tablespace allocated to SCOTT in order to successfully run this sample program. Running the Sample Program There are two ways to run the sample program: using the included sample images, or using your own images. Example 6–2 runs the sample program using the included image files. The images are compared using equal attribute weights: ■ Globalcolor = 1.0 ■ Localcolor = 1.0 ■ Texture = 1.0 ■ Structure = 1.0 Example 6–2 Run the Sample Program with Included Images % virdemo Image 1 and 2 have a similarity score of 0.0 Example 6–3 shows how to specify your own images on the command line. The images must reside in the $ORACLE_HOME/ord/vir/demo directory. Example 6–3 Run the Sample Program with Your Own Images % virdemo image1 image2 global_color local_color texture structure You must specify all six parameters, the 2 file names and 4 attribute weights (ranging from 0.0 to 1.0) in this sample program. Note that when using the Running Oracle Data Option Demos 6-11 Oracle8i Spatial VIRScore( ) operator in your own applications, it is only necessary to provide at least one attribute weight. The VIRDEMODIR directory provides several other sample image files to demonstrate the effects of emphasizing the different visual attributes. You can use an image viewer (such as xv) to display the images, and then compare them using the sample program, experimenting with different weights. See Also: Appendix B in the Oracle8i Visual Information Retrieval User’s Guide and Reference for more information. Oracle8i Spatial See Also: Oracle8i Spatial User’s Guide and Reference The reader should refer to $ORACLE_HOME/md/demo/readme.txt to find more information. 6-12 Oracle8i Administrator’s Reference for IBM DYNIX/ptx A Optimal Flexible Architecture This appendix contains information on Optimal Flexible Architecture. It contains the following sections: ■ Optimal Flexible Architecture (OFA) ■ OFA Implemented on UNIX Optimal Flexible Architecture A-1 Optimal Flexible Architecture (OFA) Optimal Flexible Architecture (OFA) Oracle Corporation recommends the Optimal Flexible Architecture (OFA) standard for Oracle8i. The OFA standard is a set of configuration guidelines for fast and reliable Oracle databases that require little maintenance. OFA is designed to: ■ ■ Organize large amounts of complicated software and data on disk to avoid device bottlenecks and poor performance Facilitate routine administrative tasks such as software and data backup functions, easing recovery in the event of a problem ■ Alleviate switching among multiple Oracle databases ■ Manage and administer database growth adequately ■ Help eliminate fragmentation of free space in the data dictionary, isolate other fragmentation, and minimize resource contention Characteristics of OFA-Compliant Database An OFA-compliant database provides the following benefits. File System Organization The file system is organized to enable easy administration and accommodate scalability for: ■ Adding data into existing databases ■ Adding users ■ Creating databases ■ Adding hardware Distributed I/O Loads I/O loads are distributed across enough disk drives to prevent performance bottlenecks. Hardware Support Hardware costs are minimized only when they do not conflict with operational considerations. A-2 Oracle8i Administrator’s Reference for IBM DYNIX/ptx Optimal Flexible Architecture (OFA) Safeguards Against Drive Failures By spreading applications across more than one drive, drive failures impact as few applications as possible. Distribution of Home Directories The following items can be distributed across more than one disk drive: ■ The collection of home directories ■ The contents of an individual home directory Integrity of Login Home Directories It is possible to add, move, or delete login home directories without having to revise programs that refer to them. Independence of UNIX Directory Subtrees Categories of files are separated into independent UNIX directory subtrees so that files in one category are minimally affected by operations on files in other categories. Supports Concurrent Execution of Application Software You can execute multiple versions of application software simultaneously, enabling the user to test and use a new release of an application before abandoning the previous version. Transferring to a new version after an upgrade is simple for the administrator and transparent for the user. Distinguishes Administrative Information for Each Database The ability to separate administrative information about one database from that of another ensures a reasonable structure for the organization and storage of administrative data. Optimal Flexible Architecture A-3 OFA Implemented on UNIX Uses Consistent Database File Naming Database files are named so that: ■ Database files are easily distinguishable from all other files ■ Files of one database are easily distinguishable from files of another database ■ Control files, redo log files, and data files are identifiable as such ■ The association of data file to tablespace is clearly indicated Separation of Tablespace Contents Tablespace contents are separated to: ■ Minimize tablespace free space fragmentation ■ Minimize I/O request contention ■ Maximize administrative flexibility I/O Loads Tuning Across All Drives I/O loads are tuned across all drives, including drives storing Oracle data in raw devices. OFA Implemented on UNIX A careful naming strategy for database files eliminates data administration problems. The OFA rules provided here correspond to the original OFA recommendations published in The OFA Standard: Oracle8i for Open Systems. A-4 Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX Mount Points The following section describes the naming conventions for mount points. Create Mount Points An installation of Oracle8i requires at least two mount points: one for the software and at least one for the database files. If implementing the recommended Optimal Flexible Architecture (OFA), at least four mount points are required: one for the software and at least three for database files. Mount Point Syntax Name all mount points using the syntax /pm, where p is a string constant and m is a unique fixed-length key (typically a two-digit number) used to distinguish each mount point. For example: /u01 and /u02, or /disk01 and /disk02. Naming Mount Points for Very Large Databases (VLDBs) If each disk drive contains database files from one application and there are enough drives for each database to ensure no I/O bottleneck, then use the syntax /q/dm for naming mount points, as explained in Table A–1. Table A–1 Syntax for Naming Mount Points Variable Description q A string denoting that Oracle data is stored here dm The value of the initialization parameter DB_NAME (synonymous with the instance sid for single-instance databases) For example, mount points named /u01/oradata/test and /u02/oradata/test allocate two drives for the Oracle test database. Optimal Flexible Architecture A-5 OFA Implemented on UNIX Naming Directories The following section describes the naming conventions for OFA compliant directories. Home Directory Syntax Name home directories using the syntax /pm/h/u, as explained in Table A–2. Table A–2 Syntax for Naming Home Directories Variable Description pm A mount point name h A standard directory name u The name of the owner of the directory For example, /u01/app/oracle is the Oracle Server software owner home directory (also referred to as ORACLE_BASE and defaulted by the Installer) and /u01/app/applmgr is an Oracle applications software owner home directory. Placing home directories at the same level in the UNIX file system is beneficial because it enables the collection of applications owner login home directories on different mount points to be referred to with the single pattern matching string, /*/app/*. Referring to Pathnames Refer to explicit path names only in files designed specifically to store them, such as /etc/passwd and the Oracle oratab file. Refer to group memberships only in the /etc/group file. Software Directories To help fulfill the OFA requirement that it be possible to execute multiple versions of application software simultaneously, store each version of the Oracle8i Server software in a directory matching the pattern /pm/h/product/v, as explained in Table A–3. Table A–3 Syntax for Naming Oracle8i Server Software Directories Variable Description h A standard directory name v The version of the software A-6 Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX For example: /u01/app/oracle/product/8.1.6 indicates the start of the directory structure where the Oracle8i Server files are located. Set the ORACLE_ HOME environment variable to this directory. Naming Files The following section describes the naming conventions for OFA compliant files. Administration Files To facilitate the organization of administrative data, Oracle Corporation recommends that you store database-specific administration files in subdirectories matching the pattern h/admin/d/a/, where h is the Oracle user’s home directory, d is the database name (DB_NAME), and a is a subdirectory for each of the database administration files described in Table A–4: Table A–4 Subdirectories for Database Administration Files Sub Directory Description adhoc Ad hoc SQL scripts for a given database arch Archived redo log files adump Audit files (Set AUDIT_FILE_DEST in configdb_name.ora to point here. Clean out this subdirectory periodically.) bdump Background process trace files cdump Core dump files create Programs used to create the database exp Database export files logbook Files recording the status and history of the database pfile Instance parameter files udump User SQL trace files As an example, the subdirectory adhoc would have the following path name, /u01/app/oracle/admin/sab/adhoc/ if it were part of the database named sab. Optimal Flexible Architecture A-7 OFA Implemented on UNIX Database Files The following naming convention for database files ensures that they are easily identifiable: ■ For control files, use /pm/q/d/control.ctl ■ For redo log files, use /pm/q/d/redon.log ■ For data files, use /pm/q/d/tn.dbf This syntax is explained in Table A–5. Table A–5 Syntax for Naming Database Files Variable Description pm A mount point name described earlier in this chapter q A string distinguishing Oracle data from all other files (usually named ORACLE or oradata) d The DB_NAME of the database t An Oracle tablespace name n A two-digit string Note: Do not store files other than a control, redo log, or data file associated with database d in the path /pm/q/d. Following this convention, you could produce, for example, a data file with the name /u03/oradata/sab/system01.dbf, making it easy to see to which database the file belongs. A-8 Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX Separate Segments with Different Requirements Separate groups of segments with different lifespans, I/O request demands, and backup frequencies across different tablespaces. For each Oracle database, create the special tablespaces described in Table A–6. These tablespaces are in addition to those needed for application segments. Table A–6 Special Tablespaces Tablespace Description SYSTEM Data dictionary segments TEMP Temporary segments RBS Rollback segments USERS Miscellaneous user segments INDX Index associated with data in USERS tablespace DRSYS Oracle interMedia segment This method is effective because dictionary segments are never dropped, and no other segments that can be dropped are allowed in the SYSTEM tablespace. This ensures that the SYSTEM tablespace does not require a rebuild due to tablespace free space fragmentation. Because rollback segments are not stored in tablespaces holding applications data, the administrator is not blocked from taking an application’s tablespace offline for maintenance. The segments are partitioned physically by type, and the administrator can record and predict data growth rates without complicated tools. Naming Tablespaces Name tablespaces descriptively using a maximum of eight characters. Although Oracle8i tablespace names can be 30 characters long, portable UNIX file names are restricted to 14 characters. The recommended standard for a data file basename is tn.dbf, where t is a descriptive tablespace name and n is a two-digit string. Because the extension plus the two-digit string occupy a total of six characters, only eight characters remain for the tablespace name. Optimal Flexible Architecture A-9 OFA Implemented on UNIX Descriptive names enable the name of a data file to be associated with the tablespace that uses it. For example, the names GLD and GLX might be used for the tablespaces storing General Ledger data and indices, respectively. Note: Do not embed reminders of the word "tablespace" in your tablespace names. Tablespaces are distinguishable by context, and names do not need to convey information about type. Exploiting OFA Structure for Oracle Files Table A–7 shows the syntax used for identifying classes of files. Table A–7 Directory Structure Syntax for Identifying Classes of Files A-10 Directory Structure Syntax Description /u[0-9][0-9] User data directories /*/home/* User home directories /*/app/* User application software directories /*/app/applmgr Oracle application software subtrees /*/app/oracle/product Oracle Server software subtrees /*/app/oracle/product/Release 2 (8.1.6) Oracle Server Release 2 (8.1.6) distribution files /*/app/oracle/admin/sab sab database administrative subtrees /*/app/oracle/admin/sab/arch/* sab database archived log files /*/oradata Oracle data directories /*/oradata/sab/* sab database files /*/oradata/sab/*.log sab database redo log files Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX OFA File Mapping Table A–8 shows an hierarchical file mapping of a sample OFA-compliant database, including each files mount point, application, database, and tablespace. The file names indicate the file type (control, log, or data). Table A–8 Hierarchical File Mapping for OFA Installation Directory Description / root mount point /u01/ ’User data’ mount point #1 /u01/app/ Subtree for app software /u01/app/oracle/ Home for oracle software user /u01/app/oracle/admin/ Subtree for database admin files /u01/app/oracle/admin/TAR/ Subtree for Support logs /u01/app/oracle/admin/db_name1/ Admin subtree for db_name1 database /u01/app/oracle/admin/db_name2/ Admin subtree for db_name2 database /u01/app/oracle/doc/ Online documentation /u01/app/oracle/local/ Subtree for local Oracle software /u01/app/oracle/local/aps6/ An Oracle6 admin package /u01/app/oracle/local/aps7/ An Oracle7 admin package /u01/app/oracle/product/ Distribution files /u01/app/oracle/product/7.3.3/ ORACLE_HOME for 7.3.3 instances /u01/app/oracle/product/8.0.4/ ORACLE_HOME for 8.0.4 instances /u01/app/oracle/product/8.1.6/ ORACLE_HOME for 8.1.6 instances /u01/app/ltb/ Home for a user /u01/app/sbm/ Home for a user /u01/oradata/ Subtree for Oracle data /u01/oradata/db_name1/ Subtree for db_name1 database files /u01/oradata/db_name2/ Subtree for db_name2 database files /u02/ ’User data’ mount point #2 /u02/home/ Subtree for login home directories /u02/home/cvm/ Home for a user /u02/home/vrm/ Home for a user Optimal Flexible Architecture A-11 OFA Implemented on UNIX Table A–8 Hierarchical File Mapping for OFA Installation (Cont.) Directory Description /u02/oradata/ Subtree for Oracle data /u02/oradata/db_name1/ Subtree for db_name1 database files /u02/oradata/db_name2/ Subtree for db_name2 database files /u03/ ’User data’ mount point #3 /u03/oradata/ Subtree for Oracle data /u03/oradata/db_name1/ Subtree for db_name1 database files /u03/oradata/db_name2/ Subtree for db_name2 database files Raw Device Sizes Choose a small set of standard sizes for all raw devices that can be used to store Oracle database files. In general, standardizing on a single size is recommended. If a single size is used, raw files can be moved from one partition to another safely. The size should be small enough so that a fairly large number can be created but large enough to be convenient. For example, a 2 GB drive could be divided into 10 partitions of 200 MB each. This is a good balance between size and number. Any tablespace using raw devices should stripe them across several drive partitions. If possible, do the striping with a logical volume manager. Table A–9 Administrative Directory Structure for Dual-Instance OPS A-12 Directory Description u01/app/oracle/admin/sab/ Administrative directory for sab database u01/adhoc/ Directory for miscellaneous scripts u01/arch/ Log archive destination for all instances u01/arch/redo001.arc Archived redo log file u01/bdump/ Directory for background dump files u01/bdump/inst1/ Background dump dest for inst1 instance u01/bdump/inst2/ Background dump dest for inst2 instance u01/cdump/ Directory for core dump files u01/cdump/inst1/ Core dump dest for inst1 instance Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX Table A–9 Administrative Directory Structure for Dual-Instance OPS (Cont.) Directory Description u01/cdump/inst2/ Core dump dest for inst2 instance u01/create/ Directory for creation scripts u01/create/1-rdbms.sql SQL script to create inst database u01/exp/ Directory for exports u01/exp/19990120full.dmp January 20, 1999 full export dump file u01/exp/export/ Directory for export parfiles u01/exp/import/ Directory for import parfiles u01/logbook/ Directory for inst logbook entries u01/logbook/inst1/ Directory for inst1 instance reports u01/logbook/inst1/params.lst v$parameter report for inst1 instance u01/logbook/inst2/ Directory for inst2 instance reports u01/logbook/inst2/params.lst v$parameter report for inst2 instance u01/logbook/user.lst DBA_USERS report u01/pfile/ Directory for instance parameter files u01/pfile/inst1/ Directory for inst1 instance parameters u01/pfile/inst1/init Instance parameters for inst1 instance u01/pfile/inst2/ Directory for inst2 instance parameters u01/pfile/inst2/init Instance parameters for inst2 instance u01/udump/ Directory for user dump files u01/udump/inst1/ User dump dest for inst1 instance u01/udump/inst2/ User dump dest for inst2 instance Optimal Flexible Architecture A-13 OFA Implemented on UNIX Directory Structure The following section describes the directory structure for OFA compliant installations. ORACLE_BASE Directory ORACLE_BASE is the root of the Oracle directory structure. ORACLE_BASE directory structure and content are described in Table A–10. When installing an OFA-compliant database using the Oracle Universal Installer, ORACLE_BASE is set to /pm/app/oracle by default. Table A–10 ORACLE_BASE Directory Structure and Content Directory Structure Syntax Description admin Administrative files doc Online documentation local Subtree for local Oracle software product Oracle software ORACLE_HOME Directory If you install an OFA-compliant Oracle Server, the ORACLE_HOME directory is /pm/app/oracle/product/release_number. ORACLE_HOME directory structure and content are described in Table A–11. Under UNIX, the ORACLE_HOME directory contains the subdirectories described in Table A–11, as well as a subdirectory for each Oracle product selected. You have directories only for the products you have installed. Table A–11 ORACLE_HOME Directory Structure and Content A-14 Directory Description assistants Configuration Assistants bin Binaries for all products ctx interMedia Text options dbs initsid.ora, lksid install Installation related files lib Oracle product libraries jlib Java classes Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX Table A–11 ORACLE_HOME Directory Structure and Content (Cont.) Directory Description md Spatial options mlx Xerox Stemmer (for interMedia Text options) network Net8 nlsrtl NLS runtime loadable data ocommon Common files for all products odg Data gatherer oracore Core libraries ord Data options otrace Oracle TRACE plsql PL/SQL precomp Precompilers rdbms Server files and libraries required for the database slax SLAX parser sqlplus SQL*Plus Contents of Product Subdirectories Each product subdirectory contains the subdirectories described in Table A–12: Table A–12 Contents of Product Subdirectories Subdirectory Description admin Administrative SQL and shell scripts (for example, catalog.sql, catexp.sql, and demo.sql) admin/* Special directories for other products admin/resource Resource files admin/terminal Runtime terminal files demo Demonstration scripts and data files doc README files (for example, readmeunix.doc) install Product installation scripts jlib Product Java classes lib Product libraries and distributed makefiles Optimal Flexible Architecture A-15 OFA Implemented on UNIX Table A–12 Contents of Product Subdirectories (Cont.) Subdirectory Description log Trace files and log files (for example, orasrv.log and *.trc files) mesg U.S. message files and Multilingual Option (formerly National Language Support) message text and binary files (for example, oraus.msg and oraus.msb) Examples of Product Subdirectories Table A–13 shows examples of product subdirectories and their contents. Table A–13 Examples of Product Subdirectories Subdirectory Description rdbms install, lib, admin, doc, mesg, log sqlplus install, demo, lib, admin, doc, mesg File Naming Conventions in the admin Directory Table A–14 shows the SQL scripts contained in the rdbms/admin directory. Table A–14 admin Directory, File Naming Conventions SQL Script Description cat*.sql Creates catalog and data dictionary tables and views. The following files are run automatically during all installations: catalog.sql catproc.sql catrep.sql The catproc.sql file in turn runs the scripts for creating the standard PL/SQL packages, such as DBMS_SQL and DBMS_OUTPUT. A-16 d*.sql Downgrade scripts. dbms*.sql Additional database packages. u*.sql Upgrade scripts. utl*.sql Creates tables and views for database utilities. Oracle8i Administrator’s Reference for IBM DYNIX/ptx OFA Implemented on UNIX File Name Extensions Table A–15 lists file name extensions and their descriptions. Table A–15 File name Extensions Extension Description .a Object file libraries .aud Oracle audit file .bdf X11 font description file .bmp X11 bitmap file .c C source file .ctl SQL*Loader control file; Oracle Server control file .dat SQL*Loader data file .dbf Oracle Server tablespace file .dmp Export file .doc ASCII text file .env Shell script file for setting environment .h C header file; also, sr.h is a SQL*Report Writer help file .jar Java class archive .l UNIX manual page .lis Output of SQL*Plus scripts .log Installation log files; Oracle Server redo log files .mk make files .msb NLS message file (binary) .msg NLS message file (text) .o Object module .ora Oracle configuration files .orc Installation prototype files .pc Pro*C source file .ppd Printer driver file .sh Bourne shell script file .sql SQL* script files Optimal Flexible Architecture A-17 OFA Implemented on UNIX Table A–15 File name Extensions (Cont.) A-18 Extension Description .sys Bourne shell script file .tab SQL* script file .trc Trace files .tut Bourne shell script file .utd Uniform Terminal Definitions .zip Zip file Oracle8i Administrator’s Reference for IBM DYNIX/ptx Index Symbols ? example of use, 1-8 @ to denote $ORACLE_SID, 1-8 A accounts, 1-15 adapters utility, 5-3 administering SQL, 3-2 advanced-developer demo, 6-9 asynchronous I/O, 2-10 automatic login remote_os_roles, 1-19 B BEQ protocol, 5-6 ADDRESS, 5-6 syntax for connection parameters, binding processes, 2-14 buffer cache size tuning, 2-21 buffer manager, 2-4 buffers tuning, 2-6 C 5-7 cache size tuning, 2-21 caching SGA tuning, 2-5 catching routine example, 4-18 CATPROC.SQL, A-16 cfs file system type, 2-12 changing databases, 1-3 command interpreter, 1-9 commands orapwd, 1-18 sar, 2-5 vmstat, 2-5 common environment oraenv file, 1-3 setting, 1-3 configuration master agent, 5-16 configuration files precompiler, 4-3 CONNECT INTERNAL security, 1-17 coraenv, 1-7 CPU usage priority level of processes, 2-14 processor binding, 2-14 tuning, 2-14 customizing initsid.ora file initialization parameters, 1-11 C Pro*C/C++, 4-4 Index-1 disk performance issues, 2-14 DISPLAY variable, 1-8 Distributed Lock Manager tuning, 2-22 DLM tuning, 2-22 dynamic and static linking Oracle libraries, 4-16 D data dictionary cache tuning, 2-8 data options, 6-1 database files authorization, 1-17 security, 1-17 tuning buffers, 2-6 dba group, 1-15 relinking, 1-17 debugger programs, 4-3 demonstration precompiler, 1-28 the procedural option, PL/SQL, 1-27 demonstration programs Oracle Call Interface, 4-12 Pro*C/C++, 4-5 Pro*COBOL, 4-9 demonstration tables creating manually, 3-3 deleting, 3-4 SQL*Plus, 3-3 demos (demonstration files) advanced-developer, 6-9 electric utility, 6-9 Java, 6-9 Oracle Call Interface (OCI), 6-10 Oracle Developer, 6-10 PRO*C/C++, 6-9 retrofitting existing tables, 6-9 usage, 6-9 Developer/2000 (Oracle Developer) demo, disk monitoring performance, 2-13 quotas, 1-21 disk I/O asynchronous I/O, 2-10 file system type, 2-12 I/O slaves, 2-10 tuning, 2-10 tuning for parallel server, 2-23 tuning the database writer, 2-10 Index-2 E 6-10 editor SQL*Plus, 3-5 efs file system type, 2-12 electric utility demo, 6-9 encapsulator configuration, 5-16 environment variables, 1-2, 4-8 DISPLAY, 1-8 HOME, 1-8 LANG or LANGUAGE, 1-9 LD_LIBRARY64_PATH, 1-9 LPDEST, 1-9 MicroFocus COBOL compiler, 4-8 NLS_LANG, 1-6 ORA_NLS, 1-6 ORACLE_HOME, 1-6 ORACLE_SID, 1-7 ORACLE_TRACE, 1-7 ORAENV_ASK, 1-7 PATH, 1-9 Pro*COBOL, 4-8 SHELL, 1-9 TMPDIR, 1-10 TNS_ADMIN, 1-7, 5-3 TWO_TASK, 1-7 TZ, 1-10 XENVIRONMENT, 1-10 environment variables, Oracle, 1-6 environment variables, UNIX, 1-8 F files oratab, 1-4 size limits, 1-14 trace files, 2-24 FORMAT precompiler, Pro*COBOL, 4-11 free list tuning, 2-23 4-11 G getname command, 5-13 glogin.sql file, 3-2 H help facility, 3-4 hit ratio for buffer cache, 2-6 HOME variable, 1-8 I indexes tuning, 2-22 initialization parameters, 1-11 BACKGROUND_DUMP_DEST, 1-12 BITMAP_MERGE_AREA_SIZE, 1-12 COMMIT_POINT_STRENGTH, 1-12 CONTROL_FILES, 1-12 CREATE_BITMAP_AREA_SIZE, 1-12 DB_BLOCK_BUFFERS, 1-12 DB_BLOCK_SIZE, 1-12 DB_FILE_DIRECT_IO_COUNT, 1-12 DB_FILE_MULTIBLOCK_READ_COUNT, 1-12 DB_FILES, 1-12 defaults, 1-12 DISTRIBUTED_TRANSACTIONS, 1-12 HASH_AREA_SIZE, 1-12 HASH_MULTIBLOCK_IO_COUNT, 1-12 JAVA_POOL_SIZE, 1-12 LOG_ARCHIVE_DEST, 1-12 LOG_ARCHIVE_FORMAT, 1-12 LOG_BUFFER, 1-12 LOG_CHECKPOINT_INTERVAL, 1-13 MTS_LISTENER_ADDRESS, 1-13 MTS_MAX_DISPATCHERS, 1-13 MTS_MAX_SERVERS, 1-13 MTS_SERVERS, 1-13 NLS_LANGUAGE, 1-13 NLS_TERRITORY, 1-13 OBJECT_CACHE_MAX_SIZE_PERCENT, OBJECT_CACHE_OPTIMAL_SIZE, 1-13 OPEN_CURSORS, 1-13 OS_AUTHENT_PREFIX, 1-13 PROCESSES, 1-13 SHARED_POOL_SIZE, 1-13 SHOW PARAMETERS command, 1-12 SORT_AREA_SIZE, 1-13 Intelligent Agent configuration on SNMP, 5-16 interMedia Java demo, 6-7 MediaAnnotator, 6-7 sample audio scripts, 6-3 sample programs, 6-4 sample video scripts, 6-6 Web Agent and Clipboard, 6-9 interMedia Audio, Video, and Image, 6-3 interMedia Locator, 6-7 interMedia Text, 6-2 interrupting SQL*Plus, 3-6 I/O tuning, 2-10 tuning for parallel server, 2-23 I/O slaves, 2-10 IPC protocol, 5-7 ADDRESS, 5-8 ireclen, 4-3 1-13 J Java demos, 6-9 K kernel tuning UNIX parameters, 2-15 Index-3 L LANG or LANGUAGE variable, 1-9 language, 1-6 latches contention, 2-17 LD_LIBRARY64_PATH variable, 1-9 library cache tuning, 2-8 limits resource, 1-21 locks tuning for parallel server, 2-22, 2-23 log writer process (LGWR), 2-14 login.sql file, 3-2 LPDEST variable, 1-9 M master agent configuration, 5-16 memory estimating usage, 1-20 SGA tuning, 2-5 shared, 1-21 tuning, 2-4 virtual, 1-20 memory management, 2-4 control paging, 2-5 single shared memory segment, 2-5 swap space, 2-4 UNIX kernel, 2-5 MicroFocus COBOL compiler, 4-8 multiple signal handlers, 4-18 N naming support, 5-15 National Language Support (NLS) variable, 1-6 Net8 adapters utility, 5-3 BEQ protocol, 5-6 IPC protocol, 5-7 naming support, 5-15 protocol support, 5-4 protocols, 5-4 Index-4 README files, 5-2 SPX/IPX protocol, 5-10 TCP/IP protocol, 5-9 NLS_LANG environment variable, 1-6 ntisbsdm broadcast daemon, 5-11 ntspxctl utility, 5-11 O OCI demo, 6-10 OFA See also Optimal Flexible Architecture Optimal Flexible Architecture, A-1 characteristics of OFA, A-2 directory structure, A-14 file mapping, A-2, A-11 implementation on Oracle8 for Unix, A-2 ORA_NLS environment variable, 1-6 Oracle memory usage, 1-20 Oracle Advanced Security .bak files, 5-18 security and single sign-on, 5-18 Oracle Call Interface, 4-12 demonstration programs, 4-12 user programs, 4-13 Oracle Call Interface (OCI) demo, 6-10 Oracle Data Option Demos, 6-1 Oracle Developer demo, 6-10 Oracle environment variables NLS_LANG, 1-6 ORA_NLS33, 1-6 ORACLE_BASE, 1-6 ORACLE_HOME, 1-6 ORACLE_PATH, 1-6 ORACLE_SID, 1-7 ORACLE_TRACE, 1-7 ORAENV_ASK, 1-7 TNS_ADMIN, 1-7 TWO_TASK, 1-7 Oracle Forms demo, 6-10 Oracle libraries Oracle shared library, 4-16 static and dynamic linking, 4-16 Oracle Parallel Server monitoring, 2-24 tuning, 2-22 Oracle Precompiler and OCI linking and makefiles, 4-14 custom makefiles, 4-14 undefined symbols, 4-15 oracle run time system, 4-9 Oracle Server accounts, 1-15 oracle software owner, 1-15 special accounts, 1-15 Oracle System Identifier, 1-7 ORACLE_HOME environment variable, 1-6 using ? for, 1-8 ORACLE_SID environment variable, 1-7 suppressing prompt, 1-4 Oracle8i Spatial, 6-12 oraenv file description, 1-3 moving between databases, 1-3 ORAENV_ASK, 1-7 setting, 1-4 orapwd command, 1-18 oratab file, 1-4 oreclen, 4-3 P paging space tuning, 2-4, 2-5 parallel queries tuning, 2-19 parallel server monitoring, 2-24 tuning, 2-22 parallel server installation, 2-26 passwords remote, 1-18 PATH variable, 1-9 permissions granting, 1-17 PL/SQL demonstrations loading, 1-27 large blocks, 2-9 pool size tuning, 2-7 precompiler relinking executables, 4-2 running demonstration, 1-28 value of ireclen and oreclen, 4-3 precompiler configuration files, 4-3 precompilers overview, 4-2 signals, 4-18 uppercase to lowercase conversion, 4-3 values, 4-3 vendor debugger programs, 4-3 Pro*C/C++ administering, 4-4 demonstration programs, 4-5 signals, 4-18 user programs, 4-6 using, 4-4 PRO*C/C++ demo, 6-9 Pro*COBOL, 4-7 administering, 4-8 demonstration programs, 4-9 environment variables, 4-8 FORMAT precompiler, 4-11 naming differences, 4-7 oracle run time system, 4-9 system configuration file, 4-8 user programs, 4-11 PRODUCT_USER_PROFILE Table, 3-3 protocols, 5-4 Q queries tuning parallel, 2-19 question mark example of use, 1-8 Index-5 R raw devices buffer cache size, 2-21 disadvantages, 2-25 guidelines for using, 2-26 Oracle8i parallel server installation, 2-26 raw disk partition availability, 2-26 setting up, 2-26 README files Net8, 5-2 README.txt files, 6-10 redo buffers tuning, 2-7 redo log buffer latch contention, 2-18 tuning buffer size, 2-7 relinking, 1-29 relinking precompiler executables, 4-2 remote connections parameters OS_AUTHENT_PREFIX, 1-19 REMOTE_OS_AUTHENT, 1-19 REMOTE_OS_ROLES, 1-19 resource contention kernel parameters, 2-15 resource limits, 1-21 restrictions (SQL*Plus), 3-7 resizing windows, 3-7 return codes, 3-7 retrofit demo, 6-9 rollback segments contention, 2-18 root user, 1-15 running operating system commands, 3-6 S sar, 2-2 sar command, 2-5, 2-22 scripts start_peer, 5-17 security CONNECT INTERNAL, 1-17 default group names, 1-17 file ownership, 1-16 Index-6 group accounts, 1-16 Server Manager access, 1-17 SHUTDOWN command, 1-17 STARTUP command, 1-17 two-task, 1-16 Server Manager commands, 1-17 security, 1-17 SHOW PARAMETERS, 1-12 setting up raw devices, 2-26 setup files SQL*Plus, 3-2 SGA calculating, 1-22 locking in physical memory, 2-5 relocating, 1-22 tuning, 2-5 shadow process security, 1-16 shared memory SGA, 1-21 SGA tuning, 2-5 shared pool size tuning, 2-7 SHELL variable, 1-9 SHUTDOWN command, 1-17 security, 1-17 SIGCLD two-task signal, 4-17 SIGINT two-task signal, 4-17 SIGIO two-task signal, 4-18 signal handlers using, 4-17 signal routine example, 4-18 signals creating handlers, 4-17 two-task, 4-17 SIGPIPE two-task signal, 4-17 SIGTERM two-task signal, 4-18 SIGURG two-task signal, 4-18 single shared memory segment, 2-5 site profile SQL*Plus, 3-2 SNMP and Intelligent Agent, 5-16 snmpd executable, 5-17 software distribution, 1-6 Spatial demonstrations, 6-12 special accounts, 1-15 SPOOL command SQL*Plus, 3-6 using, 3-6 SPX/IPX protocol, 5-10 ADDRESS, 5-15 command summary, 5-12 getname command, 5-13 ntisbsdm broadcast daemon, 5-11 ntspxctl utility, 5-11 SQL scripts, 2-4 SQL*DBA SHOW PARAMETERS, 1-12 SQL*Plus default editor, 3-5 demonstration tables, 3-3 editor, 3-5 help facility, 3-4 interrupting, 3-6 PRODUCT_USER_PROFILE Table, 3-3 restrictions, 3-7 running operating system commands, 3-6 setup files, 3-2 site profile, 3-2 SPOOL command, 3-6 system editor, 3-5 user profile, 3-2 using, 3-5 start_peer script, 5-17 STARTUP command security, 1-17 static and dynamic linking oracle libraries, 4-16 superuser, 1-15 swap, 2-3 swap space tuning, 2-4 SYS account, 1-15 privileges, 1-15 SYSDATE and TZ, 1-10 SYSTEM account, 1-15 privileges, 1-15 system configuration file Pro*COBOL, 4-8 system editor SQL*Plus, 3-5 System Global Area (SGA) requirements, 1-21 System Global Area or Shared Global Area (SGA) relocating, 1-22 system time setting, 1-10 T TCP/IP protocol, 5-9 ADDRESS, 5-10 thread support, 4-15 TMPDIR variable, 1-10 TNS listener configuring for Oracle TCP/IP protocol, TNS_ADMIN environment variable, 1-7 tools, 2-2 sar, 2-2 swap, 2-3 trace and alert files alert files, 2-24 trace file names, 2-24 using, 2-21, 2-24 tracing Bourne shell scripts, 1-7 tuning avoiding index contention, 2-22 buffer cache size, 2-21 CPU usage, 2-14 disk I/O, 2-10 I/O bottlenecks, 2-10 isolating contention, 2-15 localizing disk I/O, 2-23 memory management, 2-4 multi-processor systems, 2-20 parallel server, 2-22 trace and alert files, 2-21, 2-24 TWO_TASK environment variable, 1-7 5-9 Index-7 two-task architecture security, 1-16 signals, 4-17 TZ variable, 1-10 U UNIX security, 1-16 UNIX Environment Variables Used with Oracle8i, 1-8 UNIX file system type, 2-12 UNIX kernel tuning, 2-15 usage demo, 6-9 user interrupt handler, 4-18 user profile SQL*Plus, 3-2 user programs Oracle Call Interface, 4-13 Pro*C/C++, 4-6 Pro*COBOL, 4-11 using SQL*Plus, 3-5 utility (electric) demo, 6-9 V V$SESSION_WAIT table, 2-16 V$SGASTAT table, 2-8 V$SYSTEM_EVENT table, 2-15 vmstat command, 2-5 X XA functionality, 4-20 XENVIRONMENT variable, Index-8 1-10 ">
/
Preuzimanje
Samo prijateljski podsetnik. Dokument možete pogledati ovde. Ali što je najvažnije, naš AI ga je već pročitao. Može da objasni složene stvari jednostavnim rečima, odgovori na vaša pitanja na bilo kom jeziku i pomogne vam da brzo navigirate čak i najdužim ili najkomplikovanijim dokumentima.
Reklama