oracle database 10g sql and pl/sql:a brief primer978-1-4302-0066-6/1.pdf · oracle database 10g sql...
TRANSCRIPT
Oracle Database 10g SQL and PL/SQL: A Brief Primer
I’m sure most of you are already familiar with SQL to some extent. However, I present in thisappendix a quick introduction to Oracle Database 10g SQL and its programmatic cousin, PL/SQL,as a starting point for those new to programming Oracle databases. My goal here is simply to pres-ent a short summary of the classic DML and DDL commands and to discuss the newer SQL andPL/SQL concepts in greater detail.
Your need to know SQL or PL/SQL depends somewhat on the type of DBA you are—a produc-tion support DBA won’t need to know as much about Oracle programming as a DBA assisting indevelopmental efforts. It’s becoming increasingly important, however, for DBAs to learn a numberof advanced SQL and PL/SQL concepts, including the new Java and XML-based technologies. Thereason is simple: even when you aren’t developing applications yourself, you’re going to be assistingpeople who are doing so, and it helps to know what they’re doing.
This appendix aims to summarize some of the most important Oracle Database 10g SQL andPL/SQL features so you and the developers you work with can take advantage of them. Oracle SQLand PL/SQL represent an enormously broad topic, so this appendix lightly covers several importanttopics without attempting any detailed explanation due to space considerations. Please refer to theOracle manuals, “Application Developer's Guide—Fundamentals” and “PL/SQL User’s Guide andReference,” for a comprehensive introduction to SQL and PL/SQL.
The Oracle Database 10g Sample SchemasThe examples in this appendix use the demo schemas provided by Oracle as part of the OracleDatabase 10g server software. The demo data is for a fictitious company and contains the followingfive schemas:
• HR is the human resources division, which contains information on employees. It is themost commonly used schema, with its familiar employees and dept tables. The schemauses scalar data types and simple tables with basic constraints.
• OE is the order entry department, which contains inventory and sales data. This schemacovers a simple order-entry system and includes regular relational objects as well as object-relational objects. Because the OE schema contains synonyms for HR tables, you can queryHR’s objects from the OE schema.
• PM is the product media department, which covers content management. You can use thisschema if you’re exploring Oracle’s interMedia option. The tables in the PM schema containaudio and video tracks, images, and documents.
1183
A P P E N D I X A
■ ■ ■
• IE is the information exchange department in charge of shipping using various B2Bapplications.
• SH is the sales history department in charge of sales data. It is the largest sample schema,and you can use it for testing examples with large amounts of data. The schema containspartitioned tables, an external table, and Online Analytical Processing (OLAP) features. TheSALES and COSTS tables contain 750,000 rows and 250,000 rows, respectively, as comparedto 107 rows in the employees table from the HR schema.
In order to install the SH schema, you must have the partitioning option installed in yourOracle database; this option lets you use table and index partitioning in your database. Ideally, youshould install the Oracle demo schemas in a test database where you can safely practice the partsof SQL you aren’t familiar with. The Oracle “Sample Schemas” documentation manual providesdetailed information about the sample schemas.
If you’ve created a starter database using the Database Configuration Assistant (DBCA) as partof your Oracle software installation (the Basic Installation option), it will have automatically createdthe sample schemas in the new starter database.
If you’ve chosen to not create the starter database (by selecting a Software Only installationoption), you can run the DBCA to install the sample schemas. Choose the Sample Schemas optionwhen you use the DBCA to create the sample schemas in an existing database. By default, all thesample schema accounts are locked, and you must use the ALTER USER . . . ACCOUNT UNLOCK state-ment to unlock them.
If you want to create the sample schemas in a database without using the DBCA, you can run aset of Oracle-provided scripts to install the sample schemas. Each of the scripts creates the neces-sary schema users, tables, indexes, and constraints, and then loads data into the tables. The scriptsdo all this by calling other scripts in the same directory. You must create the schemas in the orderdescribed in the following steps because of dependencies that exist among the schema objects—you may get errors if you create them in another order.
1. Go to the $ORACLE_HOME/demo/schema/human_resources directory and run thehr_main.sql script to create the human resources (HR) schema.
2. Go to the $ORACLE_HOME/demo/schema/order_entry directory and run the oe_main.sqlscript to create the order entry (OE) schema.
3. Go to the $ORACLE_HOME/demo/schema/product_media directory, and run thepm_main.sql script to create the product media (PM) schema.
4. Go to the $ORACLE_HOME/demo/schema/info_exchange directory and run theix_main.sql script to create the information exchange (IE) schema.
5. Go to the $ORACLE_HOME/demo/schema/sales_history directory and run the sh_main.sqlscript to create the sales history (SH) schema.
The sample schemas are now ready, and you can use them to practice your SQL and PL/SQLcommands.
If you need to reset the schemas to their initial state and undo any changes you made to thevarious schema tables, all you have to do is run the following command in SQL*Plus:
$ $ORACLE_HOME/demo/schema/mksample systempwd syspwd hrpwd oepwd pmpwd ixpwd shpwddefault_tablespace temporary_tablespace log_file_directory
In the preceding command, the seven variables following the mksample script should bereplaced with the actual passwords for the SYSTEM and SYS users and the passwords for the HR,OE, PM, IX, and SH schemas. You should supply the actual tablespace names and directory namefor the last three variables.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1184
Oracle Data TypesData in an Oracle database is organized in rows and columns inside tables. The individual columnsare defined with properties that limit the values and format of the column contents. Let’s review themost important Oracle built-in data types before we look at Oracle SQL statements.
Character Data TypesThe CHAR data type is used for fixed-length character literals:
SEX CHAR(1)
The VARCHAR2 data type is used to represent variable-length character literals:
CITY VARCHAR2 (20)
The CLOB data type is used to hold large character strings as long as 4GB. BLOB and BFILEdata types are used to store large amounts of binary data.
Numeric Data TypesThere are two important SQL data types used to store numeric data:
• The NUMBER data type is used to store real numbers, either in a fixed-point or floating-point format.
• The BINARY FLOAT and BINARY DOUBLE data types store data in a floating-point format.
Date and Time Data TypesThere are a couple of special data types that let you handle date and time values:
• The DATE data type stores the date and time (such as year, month, day, hours, minutes, andseconds).
• The TIMESTAMP data type stores time values that are precise to fractional seconds.
Conversion FunctionsOracle offers several conversion functions that let you convert data from one format to another. Themost common of these functions are the TO_CHAR, TO_NUMBER, TO_DATE, and TO_TIMESTAMP functions.The TO_CHAR function converts a floating number to a string, and the TO_NUMBER function converts afloating number or a string to a number. The TO_DATE function converts character data to a DATEdata type. Here are some examples:
SQL> SELECT TO_CHAR(TO_DATE('20-JUL-05', 'DD-MON-RR') ,'YYYY') "Year" FROM DUAL;Year---------------------------------------------------------------------------2005SQL>
SQL> SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY')FROM DUAL;
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1185
TO_CHAR(SYSDATE--------------20-JUL-2005 SQL>
SQLIn Chapter 5 you saw how Oracle SQL statements include DDL, DML, and other types of state-ments. Let’s begin with a review of the basic SQL statements.
The SELECT StatementThe SELECT statement is the most common SQL statement (it is also called a projection). A SELECTstatement retrieves all or some of the data in a table, based on the criteria that you specify.
The most basic SELECT statement is one that retrieves all the data in the table:
SQL> SELECT * FROM employees;
To retrieve only certain columns from a table, you specify the column names after the SELECTkeyword, as shown in the following example:
SQL> SELECT first_name, last_name, hiredate FROM employees;
If you want only the first ten rows of a table, you can use the following statement:
SQL> SELECT * FROM employees WHERE rownum <11;
If you want just a count of all the rows in the table, you can use the following statement:
SQL> SELECT COUNT(*) FROM employees;
If a table has duplicate data, you can use the DISTINCT clause to eliminate the duplicate values,as shown here:
SQL> SELECT DISTINCT username FROM V$SESSION;
The optional WHERE clause in a SELECT statement uses conditions to help you specify that onlycertain rows be returned. Table A-1 lists some of the common conditions you can use in a WHEREclause.
Table A-1. Common Conditions Used in WHERE Clauses
Symbol Condition
= Equal
> Greater than
< Less than
<+ Less than or equal to
>= Greater than or equal to
<> or ! Not equal to
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1186
Here are some examples of using the WHERE clause:
SQL> SELECT employee_id WHERE salary = 50000;SQL> SELECT employee_id WHERE salary < 50000;SQL> SELECT employee_id WHERE salary > 50000;SQL> SELECT employee_id WHERE salary <= 50000;SQL> SELECT employee_id WHERE salary >= 50000;SQL> SELECT employee_id WHERE salary ! 50000;
The LIKE ConditionThe LIKE condition uses pattern matching to restrict rows in a SELECT statement. Here’s an example:
SQL> SELECT employee_id, last_name FROM employees2* WHERE last_name LIKE 'Fa%';
EMPLOYEE_ID LAST_NAME----------- ----------
109 Faviet202 Fay
SQL>
The pattern that you want the WHERE clause to match should be enclosed in single quotes (' ').In the preceding example, the percent sign (%) indicates that the letters Fa can be followed by anycharacter string. Thus, the percent sign acts as a wildcard for one or more characters, performingthe same job as the asterisk (*) in many operating systems. Note that a single underscore character(_) acts as a wildcard for one and only one character.
The INSERT StatementThe INSERT statement enables you to add new data to a table, including duplicate data if there areno unique requirements enforced by a primary key or an index. The general form of the INSERTstatement is as follows:
INSERT INTO <table> [(<column i, . . . , column j>)]VALUES (<value i, . . . ,value j>);
Here is an example of the insert command:
SQL> INSERT INTO employees(2 employee_id,last_name,email,hire_date,job_id)3 VALUES4* (56789,'alapati','[email protected]', sysdate,98765);
1 row created.SQL>
In the preceding list, the column names were specified because only some columns were beingpopulated in the row being inserted. The rest of them are left blank, which is okay, provided the col-umn isn’t defined as a “not null” column.
If you’re inserting values for all the columns of a table, you can use the simpler INSERT state-ment shown here:
SQL> INSERT INTO department VALUES(34567, 'payroll', 'headquarters', 'dallas');
1 row created.SQL>
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1187
If you want to insert all the columns of a table into another table, you can use the followingINSERT statement:
SQL> INSERT INTO b SELECT * FROM aWHERE city='DALLAS';
If table b doesn’t exist, you can use the CREATE TABLE table_name AS SELECT * FROM (CTAS)statement, as shown here:
SQL> CREATE table b as SELECT * FROM a;
The DELETE StatementYou use the DELETE statement to remove rows from a table. The DELETE statement has the followingstructure:
DELETE FROM <table> [WHERE ,condition>];
For example, if you want to delete employee Fay’s row from the employees table, you would usethe following DELETE statement:
SQL> DELETE FROM employees2* WHERE last_name='Fay';
1 row deleted.
If you don’t have a limiting WHERE condition, the DELETE statement will result in the removal ofall the rows in the table, as shown here:
SQL> DELETE FROM X;
You can also remove all rows in a table using the TRUNCATE command, but you can’t undo or rollback the TRUNCATE command’s effects. You can undo a delete by using the ROLLBACK statement:
SQL> ROLLBACK;
The UPDATE StatementThe UPDATE statement changes the value (or values) of one or more columns of a row (or rows) in atable. The expression to which a column is being set or modified can be a constant, arithmetic, orstring operation, or the product of a SELECT statement.
The general structure of the UPDATE statement is as follows (note that the elements in squarebrackets are optional):
UPDATE <table>SET <column i> = <expression i>, . . . , <column j> = <expression j>[WHERE <condition> ];
If you want to change or modify a column’s values for all the rows in the table, you use anUPDATE statement without a WHERE condition:
SQL> UPDATE persons SET salary=salary*0.10;
If you want to modify only some rows, you need to use the WHERE clause in your UPDATEstatement:
SQL> UPDATE persons SET salary = salary * 0.10WHERE review_grade > 5;
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1188
Filtering DataThe WHERE clause in a SELECT, INSERT, DELETE, or UPDATE statement lets you filter data. That is, youcan restrict the number of rows on which you want to perform a SQL operation. Here’s a simpleexample:
SQL> INSERT INTO aSELECT * FROM bWHERE city='DALLAS';
Sorting the Results of a QueryFrequently, you’ll have to sort the results of a query in some order. The ORDER BY clause enablesyou to sort the data based on the value of one or more columns. You can choose the sorting order(ascending or descending) and you can choose to sort by column aliases. You can also sort bymultiple columns. Here’s an example:
SQL> SELECT employee_id, salary FROM employeesORDER BY salary;
Changing the Sorting OrderBe default, an ORDER BY clause sorts in ascending order. If you want to sort in descending order, youneed to specify the DESC keyword:
SQL> SELECT employee_id, salary FROM employeesORDER BY salary desc;
Sorting by Multiple ColumnsYou can sort results based on the values of more than one column. The following query sorts on thebasis of two columns, salary and dept:
SQL> SELECT employee_id, salary FROM employeesORDER BY salary, dept;
OperatorsSQL provides you with a number of operators to perform various tasks, such as comparing columnvalues and performing logical operations. The following sections outline the important SQL opera-tors: comparison operators, logical operators, and set operators.
Comparison OperatorsComparison operators compare a certain column value with several other column values. These arethe main comparison operators:
• BETWEEN: Tests whether a value is between a pair of values
• IN: Tests whether a value is in a list of values
• LIKE: Tests whether a value follows a certain pattern, as shown here:
SQL> SELECT employee_id from employees WHERE dept LIKE 'FIN%';
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1189
Logical OperatorsThe logical operators, also called Boolean operators, logically compare two or more values. The mainlogical operators are AND, OR, NOT, GE (greater than or equal to), and LE (less than or equal to). Here’san example that illustrates the use of some of the logical operators:
SQL> SELECT last_name, cityWHERE salary GT 100000 and LE 200000;
When there are multiple operators within a single statement, you need rules of precedence.Oracle always evaluates arithmetical operations such as multiplication, division, addition, and sub-traction before it evaluates conditions. The following is the order of precedence of operators inOracle, with the most important first:
=, !=, <, >, <=, >=IS NULL, LIKE, BETWEEN, IN, EXISTSNOTAND OR
The Set OperatorsSometimes your query may need to combine results from more than one SQL statement. In otherwords, you need to write a compound query. Set operators facilitate compound SQL queries. Hereare the important Oracle set operators:
• UNION: The UNION operator combines the results of more than one SELECT statement afterremoving any duplicate rows. Oracle will sort the resulting set of data. Here’s an example:
SQL> SELECT emp_id FROM old_employeesUNIONSELECT emp_id FROM new_employees;
• UNION ALL: The UNION ALL operator is similar to UNION, but it doesn’t remove the duplicaterows. Oracle doesn’t sort the result set in this case, unlike the UNION operation.
• INTERSECTION: The INTERSECTION operator gets you the common values in two or more resultsets derived from separate SELECT statements. The result set is distinct and sorted.
• MINUS: The MINUS operator returns the rows returned by the first query that aren’t in the sec-ond query’s results. The result set is distinct and sorted.
SQL FunctionsOracle functions manipulate data items and return a result, and built-in Oracle functions help youperform many transformations quickly, without your having to do any coding. In addition, youcan build your own functions. Functions can be divided into several groups: single-row functions,aggregate functions, number and date functions, general and conditional functions, and analyticalfunctions.
Single-Row FunctionsSingle-row functions are typically used to perform tasks such as converting a lowercase word touppercase or vice versa, or replacing a portion of text in a row. Here are the main single-row func-tions used in Oracle:
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1190
• CONCAT: The CONCAT function concatenates or puts together two or more character strings intoone string.
• LENGTH: The LENGTH function gives you the length of a character string.
• LOWER: The LOWER function transforms uppercase letters into lowercase, as shown in thefollowing example:
SQL> SELECT LOWER('SHANNON ALAPATI') from dual;LOWER('SHANNONALAPATI')-----------------------shannon alapatiSQL>
• SUBSTR: The SUBSTR function returns part of a string.
• INSTR: The INSTR function returns a number indicating where in a string a certain stringvalue starts.
• LPAD: The LPAD function returns a string after padding it for a specified length on the left.
• RPAD: The RPAD function pads a string on the right side.
• TRIM: The TRIM function trims a character string.
• REPLACE: The REPLACE function replaces every occurrence of a specified string with a specifiedreplacement string.
Aggregate FunctionsYou can use aggregate functions to compute things such as averages and totals of a selected columnin a query. Here are the important aggregate functions:
• MIN: The MIN function returns the smallest value. Here’s an example:
SELECT MIN(join_date) FROM employees;
• MAX: The MAX function returns the largest value.
• AVG: The AVG function computes the average value of a column.
• SUM: The SUM function computes the sum of a column:
SQL> SELECT SUM(bytes) FROM dba_free_space;
• COUNT: The COUNT function returns the total number of columns.
• COUNT(*): The COUNT(*) function returns the number of rows in a table.
Number and Date FunctionsOracle includes several number functions, which accept numeric input and return numeric values.The date functions help you format dates and times in different ways. Here are some of the impor-tant number and date functions:
• ROUND: This function returns a number rounded to the specified number of places to the rightof the decimal point.
• TRUNC: This function returns the result of a date truncated in the specified format.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1191
• SYSDATE: This commonly used function returns the current date and time:
SQL> SELECT sysdate FROM dual;SYSDATE--------------------07/AUG/2005 10:00:00SQL>
• TO_TIMESTAMP: This function converts a CHAR or VARCHAR(2) data type to a timestampdata type.
• TO_DATE: You can use this function to change the current date format. The standard date for-mat in Oracle is DD-MON-YYYY, as shown in the following example:
07-AUG-2005
The TO_DATE function accepts a character string that contains valid data and converts it intothe default Oracle date format. It can also change the date format, as shown here:
SQL> SELECT TO_DATE('August 20,2005', 'MonthDD,YYYY') FROM dual;TO_DATE('AUGUST20,2005'-----------------------20/AUG/2005 12:00:00 AMSQL>
• TO_CHAR: This function converts a date into a character string, as shown in the followingexample:
SQL> SELECT SYSDATE FROM dual;SYSDATE-----------04-AUG-2005SQL>
SQL> SELECT TO_CHAR(SYSDATE, 'DAY, DDTH MONTH YYYY') FROM DUAL;
TO_CHAR(SYSDATE,'DAY,DDTHMON--------------------------------THURSDAY , 04TH AUGUST 2005
SQL>
• TO_NUMBER: This function converts a character string to a number format:
SQL> UPDATE employees SET salary = salary + TO_NUMBER('100.00', '9G999D99')WHERE last_name = 'Alapati';
General and Conditional FunctionsOracle provides some very powerful general and conditional functions that enable you to extendthe power of simple SQL statements into something similar to a traditional programming languageconstruct. The conditional functions help you decide among several choices. Here are the impor-tant general and conditional Oracle functions:
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1192
• NVL: The NVL function replaces the value in a table column with the value after the comma ifthe column is null. Thus, the NVL function takes care of column values if the column valuesare null and converts them to non-null values:
SQL> SELECT last_name, title, salary * NVL (commission_pct,0)/100 COMMFROM employees;
• COALESCE: This function is similar to NVL, but it returns the first non-null value in the list:
SQL> COALESCE(region1, region2, region3, region4)
• DECODE: This function is used to incorporate basic if-then functionality into SQL code. Thefollowing example assigns a party name to all the voters in the table based on the value inthe affiliation column. If there is no value under the affiliation column, the voter is listed asan independent:
SQL> SELECT DECODE(affiliation, 'D', 'Democrat','R', 'Republican', 'Independent') FROM voters;
• CASE: This function provides the same functionality as the DECODE function, but in a muchmore intuitive and elegant way. Here’s a simple example of using the CASE statement, whichhelps you incorporate if-then logic into your code:
SQL> SELECT ename, (CASE deptnoWHEN 10 THEN 'Accounting'WHEN 20 THEN 'Research'WHEN 30 THEN 'Sales'WHEN 40 THEN 'Operations'ELSE 'Unknown'END) departmentFROM employees;
Analytical FunctionsOracle’s SQL analytical functions are powerful tools for business intelligence applications. Oracleclaims a potential improvement of 200 to 500 percent in query performance with the use of the SQLanalytical functions. The purpose behind using analytical functions is to perform complex sum-mary computations without using a lot of code. Here are the main SQL analytical functions of theOracle database:
• Ranking functions: These enable you to rank items in a data set according to some criteria.Oracle has several types of ranking functions, including RANK, DENSE_RANK, CUME_DIST,PERCENT_RANK, and NTILE. Listing A-1 shows a simple example of how a ranking functioncan help you rank some sales data.
Listing A-1. An Example of a Ranking Function
SQL> SELECT sales_type, TO_CHAR(SUM(amount_sold), '9,999,999,999') SALES,RANK() OVER (ORDER BY SUM(amount_sold) ) AS original_rank, RANK() OVER (ORDER BY SUM(amount_sold) DESC NULLS LAST) AS derived_rankFROM sales, products, customers, time_frame, sales_typesWHERE sales.prod_id=products.prod_id ANDsales.cust_id=customers.cust_id AND
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1193
sales.time_id=time_frame.time_id ANDsales.sales_type_id=sales_types.sales_type_id AND timeframe.calendar_month_desc IN ('2005-07', '2005-08')AND country_id='INDIA'GROUP BY sales_type;
SALES_TYPE SALES ORIGINAL_RANK DERIVED_RANK-------------------- -------------- ------------ ---------------Direct Sales 5,744,263 5 1Internet 3,625,993 4 2Catalog 1,858,386 3 3Partners 1,500,213 2 4Tele Sales 604,656 1 5 SQL>
• Moving-window aggregates: These functions provide cumulative sums and moving averages.
• Period-over-period comparisons: These functions let you compare two periods (for example,“How does the first quarter of 2005 compare with the first quarter of 2006 in terms of per-centage growth?”).
• Ratio-to-report comparisons: These make it possible to compare ratios (for example, “What isAugust’s enrollment as a percentage of the entire year’s enrollment?”).
• Statistical functions: These functions calculate correlations and regression functions so youcan see cause and effect relationships among data.
• Inverse percentiles: These help you find the data corresponding to a percentile value (forexample, “Get me the names of the salespeople who correspond to the median sales value.”).
• Hypothetical ranks and distributions: These help you figure out how a new value for a col-umn fits into existing data in terms of its rank and distribution.
• Histograms: These functions return the number of the histogram data appropriate for eachrow in a table.
• First/last aggregates: These functions are appropriate when you are using the GROUP BY clauseto sort data into groups. Aggregate functions let you specify the sort order for the groups.
Hierarchical Retrieval of DataIf a table contains hierarchical data (data that can be grouped into levels, with the parent data athigher levels and child data at lower levels), you can use Oracle’s hierarchical queries. Hierarchicalqueries typically use the following structure:
• The START WITH clause denotes the root row or rows for the hierarchical relationship.
• The CONNECT BY clause specifies the relationship between parent and child rows, with theprior operator always pointing out the parent row.
Listing A-2 shows a hierarchical relationship between the employees and manager columns.The CONNECT BY clause describes the relationship. The START WITH clause specifies where the state-ment should start tracing the hierarchy.
Listing A-2. A Hierarchical Relationship Between Data
SQL> SELECT employee_id, last_name, manager_idFROM employeesSTART WITH manager_id = 100CONNECT BY PRIOR employee_id = manager_id;
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1194
EMPLOYEE_ID LAST_NAME MANAGER_ID----------- -------------- ----------
101 Reddy 100108 Greenberg 101109 Faviet 108110 Colon 108111 Chowdhary 108112 Urman 108113 Singh 108200 Whalen 101
SQL>
Selecting Data from Multiple TablesSo far, we’ve mostly looked at how to perform various DML operations on single tables, includingusing SQL functions and expressions. However, in real life, you’ll mostly deal with query outputretrieved from several tables or views. When you need to retrieve data from several tables, you needto join the tables. A join is a query that lets you combine data from tables, views, and materializedviews. Note that a table can be joined to other tables or to itself.
The Cartesian product or Cartesian join is simply a join of two tables without a selective WHEREclause. Therefore, the query output will consist of all rows from both tables. Here’s an example of aCartesian join:
SQL> SELECT * FROM employees, dept;
Cartesian products of two large tables are almost always the result of a mistaken SQL querythat omits the join condition. By using a join condition when you’re combining data from two ormore tables, you can limit the number of rows returned. A join condition can be used in the WHEREclause or the FROM clause, and it limits the data returned by selecting only data that satisfies thecondition stipulated by the join condition.
Here’s an example of a join statement that uses a join condition:
SQL> SELECT * FROM employees, deptWHERE dept='HR';
Types of Oracle JoinsOracle offers various types of joins based on the way you combine rows from two or more tables orviews. The next sections discuss the most commonly used types of Oracle joins.
Equi-Join
With an equi-join, two or more tables are joined based on an equality condition between twocolumns. In other words, the same column has the same value in all the tables that are being joined.Here’s an example:
SQL> SELECT e.last_name, d.deptFROM emp e, dept d WHERE e.emp_id = d.emp_id;
You can also use the following new syntax for the preceding join statement:
SQL> SELECT e.last_name, d.deptFROM emp e JOIN dept dUSING (emp_id);
If you want to join multiple columns, you can do so by using a comma-delimited list of columnnames, as in USING (dept_id, emp_name).
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1195
Natural Join
A natural join is an equi-join where you don’t specify any columns to be matched for the join.Oracle will automatically determine the columns to be joined, based on the matching columnsin the two tables. Here’s an example:
SQL> SELECT e.last_name, d.deptFROM emp e NATURAL JOIN dept d;
In the preceding example, the join is based on identical values for the last_name column inboth the emp and dept tables.
Self Join
A self join is a join of a table to itself through the use of table aliases. In the following example, theemployees table is joined to itself using an alias. The query deletes duplicate rows in the employeestable.
SQL> DELETE FROM employees X WHERE ROWID > 2 (select MIN(rowid) FROM employees Y3 where X.key_values = Y.key_values);
Inner Join
An inner join, also known as a simple join, returns all rows that satisfy the join condition. The tradi-tional Oracle inner join syntax used the WHERE clause to specify how the tables were to be joined.Here’s an example:
SQL> SELECT e.flast_name, d.deptFROM emp e, dept d WHERE e.emp_id = d.emp_id;
The newer Oracle inner joins (or simply joins) specify join criteria with the new ON or USINGclause. Here’s a simple example:
SQL> SELECT DISTINCT NVL(dname, 'No Dept'),COUNT(empno) nbr_empsFROM emp JOIN DEPTON emp.deptno = dept.deptnoWHERE emp.job IN ('MANAGER', 'SALESMAN', 'ANALYST')GROUP BY dname;
Outer Join
An outer join returns all rows that satisfy the join condition, plus some or all of the rows from thetable that doesn’t have matching rows that meet the join condition. There are three types of outerjoins: left outer join, right outer join, and full outer join. Usually, the word “outer” is omitted fromthe full outer join statement.
Oracle provides the outer join operator, wherein you use a plus sign (+) to indicate missingvalues in one table, but it recommends the use of the newer ISO/ANSI join syntax. Here’s a typicalquery using the full outer join:
SQL> SELECT DISTINCT NVL(dept_name, 'No Dept') deptname,COUNT(empno) nbr_empsFROM emp FULL JOIN deptON dept.deptno = emp.deptnoGROUP BY dname;
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1196
Grouping OperationsOracle provides the GROUP BY clause so you can group the results of a query according to variouscriteria. The GROUP BY clause enables you to consider a column value for all the rows in the tablefulfilling the SELECT condition.
A GROUP BY clause commonly uses aggregate functions to summarize each group defined bythe GROUP BY clause. The data is sorted on the GROUP BY columns, and the aggregates are calculated.Here’s an example:
SQL> SELECT department_id, MAX(salary)2 FROM employees3* GROUP BY department_id;DEPARTMENT_ID MAX(SALARY)------------- -----------
10 440020 1300030 1100040 650050 8200
5 rows selected.SQL>
Oracle also allows you to nest group functions. The following query gets you the minimumaverage budget for all departments (the AVG function is nested inside the MIN function here):
SQL> SELECT MIN(AVG(budget)) FROM dept_budgets GROUP BY dept_no;
The GROUP BY Clause with a ROLLUP OperatorYou’ve seen how you can derive subtotals with the help of the GROUP BY clause. The GROUP BY clausewith a ROLLUP operator gives you subtotals and total values. You can thus build subtotal aggregatesat any level. In other words, the ROLLUP operator gets you the aggregates at each group by level. Thesubtotal rows and the grand total row are called the superaggregate rows.
Listing A-3 shows an example of using the ROLLUP operator.
Listing A-3. A GROUP BY Clause with a ROLLUP Operator
SQL> SELECT Year,Country,SUM(Sales) AS SalesFROM Company_SalesGROUP BY ROLLUP (Year,Country);
YEAR COUNTRY SALES-------- -------- ---------1997 France 39901997 USA 130901997 170801998 France 43101998 USA 139001998 182101999 France 45701999 USA 146701999 19240
54530 /*This is the grand total */SQL>
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1197
The GROUP BY Clause with a CUBE OperatorYou can consider the CUBE operator to be an extension of the ROLLUP operator, as it helps extend thestandard Oracle GROUP BY clause. The CUBE operator computes all possible combinations of subto-tals in a GROUP BY operation. In the previous example, the ROLLUP operator gave you yearly subtotals.Using the CUBE operator, you can get countrywide totals in addition to the yearly totals. Here’s asimple example:
SQL> SELECT department_id, job_id, SUM(salary)4 FROM employees5 GROUP BY CUBE (department_id, job_id);
DEPARTMENT_ID JOB_ID SUM(SALARY)------------- ---------- -----------------
10 AD_ASST 4400020 MK_MAN 13000020 MK_REP 6000030 PU_MAN 11000030 PU_CLERK 139000
. . . SQL>
The GROUP BY Clause with a GROUPING OperatorAs you’ve seen, the ROLLUP operator gets you the superaggregate subtotals and grand totals. TheGROUPING operator in a GROUP BY clause helps you distinguish between superaggregated subtotalsand the grand total column from the other row data.
The GROUP BY Clause with a GROUPING SETS OperatorThe GROUPING SETS operator lets you group multiple sets of columns when you’re calculating aggre-gates such as sums. Here’s an example that shows how you can use this operator to calculateaggregates over three groupings: (year, region, item), (year, item), and (region, item). TheGROUPING SETS operator eliminates the need for inefficient UNION ALL operators.
SQL> SELECT year, region, item, sum(sales)FROM regional_salesitem GROUP BY GROUPING SETS (( year, region, item),(year, item), (region, item));
The GROUP BY Clause with a HAVING OperatorThe HAVING operator lets you restrict or exclude the results of a GROUP BY operation, in essence put-ting a WHERE condition on the GROUP BY clause’s result set. In the following example, the HAVINGoperator restricts the query results to only those departments that have a maximum salary greaterthan 20,000:
SQL> SELECT department_id, max(salary)2 FROM employees3 GROUP BY department_id4* HAVING MAX(salary)>20000;
DEPARTMENT_ID MAX(SALARY)------------- -----------
90 24000SQL>
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1198
Writing SubqueriesSubqueries resolve queries that have to be processed in multiple steps—where the final resultdepends on the results of a child query or subquery to the main query. If the subquery occurs inthe WHERE clause of the statement, it’s called a nested subquery.
Top-N AnalysisThe following query gives you the top ten employees in a firm ranked by salary. You can just aseasily retrieve the bottom ten employees by using the ORDER BY clause instead of the ORDER BY DESCclause.
SQL> SELECT emp_id, emp_name, job, manager, salaryFROM(SELECT emp_id, emp_name, job, manager, salary,RANK() OVER(ORDER BY SALARY DESC NULLS LAST) AS Employee_RankFROM employeesORDER BY SALARY DESC NULLS LAST)WHERE employee_Rank < 5;
Subqueries can be single-row or multiple-row SQL statements. Let’s take a quick look at bothtypes of subqueries.
Single-Row SubqueriesSubqueries are useful when you need to answer queries on the basis of as-yet unknown values, suchas which employees have a salary higher than the employee with the employee ID 9999? To answersuch a question, a subquery or inner query is executed first (and only once). The result of this sub-query is then used by the main or outer query. Here’s the query:
SQL> SELECT first_name||last_name, dept2 FROM employee3 WHERE sal > 4 (SELECT sal5 FROM emp6 WHERE empno= 9999);
Multiple-Row SubqueriesA multiple-row subquery returns multiple rows in the output, so you need to use multiple-rowcomparison operators, such as IN, ANY, and ALL. Using a single-row operator with a multiple-rowsubquery returns this common Oracle error:
ERROR:ORA-01427: single-row subquery returns more than one row
Multiple-Column SubqueriesMultiple-column subqueries are queries where the inner query retrieves the values of more than onecolumn. The rows in the subquery are then evaluated in the main query in pair-wise comparison,column by column and row by row.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1199
Advanced SubqueriesCorrelated subqueries are more complex than regular subqueries and answer questions such as“What are the names of all employees whose salary is below the average salary of their department?”The inner query computes the average salary, and the outer or main query gets the employee infor-mation. However, for each employee in the main (outer) query, the inner query has to be computed,because department averages depend on the department number of the employee in the outerquery.
The Exists and Not Exists OperatorsThe EXISTS operator tests for the existence of rows in the inner query or subquery when you’re usingsubqueries. The NOT EXISTS operator tests for the nonexistence of rows in the inner query. In the fol-lowing statement, the EXISTS operator will be TRUE if the subquery returns at least one row:
SQL> SELECT department_idFROM departments dWHERE EXISTS(SELECT * FROM employees eWHERE d.department_id = e.department_id);
Using Regular ExpressionsOracle Database 10g adds support for regular expressions to SQL. Regular expressions let you usespecial operators to manipulate strings or carry out a search. Traditionally, developers used opera-tors such as LIKE, REPLACE and SUBSTRING in their search expressions. However, these expressionsforced you to write lengthy SQL and PL/SQL code when performing complex searches. OracleDatabase 10g lets you perform complex searches and string manipulations easily with regularexpressions.
■Note Oracle’s regular expression features follow the popular POSIX standards.
A regular expression searches for patterns in character strings. The character string has to beone of CHAR, VARCHAR2, NCHAR, or NVARCHAR2, and the regular expression function can be oneof the following:
• REGEXP_LIKE
• REGEXP_REPLACE
• REGEXP_INSTRING
• REGEXP_SUBSTRING
The REGEXP_LIKE function evaluates strings using a specified set of characters. The regularexpression function searches for a pattern in a string, which is specified with the SOURCE_STRINGparameter in the function. The PATTERN variable represents the actual regular expression, which isthe pattern to search for. A regular expression is usually a text literal, it can be one of CHAR, VAR-CHAR2, NCHAR, or NVARCHAR2, and it can be a maximum of 512 bytes long. You can also specifyan optional match parameter to modify the matching behavior. For example, a value of i specifiescase-insensitive matching, while c specifies case-sensitive matching.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1200
Here is the syntax of the REGEXP_LIKE function:
REGEXP_LIKE(source_string, pattern [,match_parameter])
If you want to carry out string-manipulation tasks, you can use the REGEXP_INSTR, REGEXP_REPLACE, or REGEXP_SUBSTR built-in functions. These are really extensions of the normal SQL INSTR,REPLACE, and SUBSTR functions.
Regular expression features use characters like the period (.), asterisk (*), caret (^), and dollarsign ($), which are common in UNIX and Perl programming. The caret character (^), for example,tells Oracle that the characters following it should be at the beginning of the line. Similarly, the Scharacter indicates that a character or a set of characters must be at the very end of the line. Here’san example using the REGEXP_LIKE function that picks up all names with consecutive vowels:
SQL> SELECT last_nameFROM employeesWHERE REGEXP_LIKE (last_name, '([aeiou])\1', 'i');
LAST_NAME-----------FreedmanGreenbergKhooGeeLee. . .SQL>
Here’s another example that quickly searches for employees who were hired between the years2000 and 2005.
SQL> SELECT emp_name, salary,2 TO_CHAR(hire_date,'yyyy') year_of_hire3 FROM .emp4* WHERE REGEXP_LIKE (TO_CHAR (hire_date, 'yyyy'), '^200[0-5]$');
LAST_NAME FIRST_NAME SALARY YEAR------------------------- -------------------- ---------- ----Austin David 4800 1997Chen John 8200 1997Alapati Shannon 7700 1997Baida Shelli 2900 1997Tobias Sigal 2800 1997Weiss Matthew 8000 1996
Abstract Data TypesIn this section you’ll briefly review the important Oracle features that facilitate object-orientedprogramming. Abstract types, also called object types, are at the heart of Oracle’s object-orientedprogramming. Unlike a normal data type, an abstract data type contains a data structure along withthe functions and procedures needed to manipulate the data; thus, data and behavior are coupled.
Object types are like other schema objects, and they consist of a name, attributes, and methods.Object types are similar to the concept of classes in C++ and Java. Oracle support for object-orientedfeatures, such as types, makes it feasible to implement object-oriented features, such as encapsula-tion and abstraction, while modeling complex real-life objects and processes. Oracle also supportssingle inheritance of user-defined SQL types.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1201
The CREATE TYPE CommandObject types are created by users and stored in the database like Oracle data types such asVARCHAR2, for example. The CREATE TYPE command lets you create an abstract template thatcorresponds to a real-world object. Here’s an example:
SQL> CREATE TYPE person AS object2 (name varchar2(30),3 phone varchar2(20))4 /
Type created.SQL>
Object TablesObject tables contain objects such as the person type that was created in the previous section.Here’s an example:
SQL> CREATE TABLE person_table OF person;Table created.SQL>
Here’s the interesting part. The person_table table doesn’t contain single value columns like aregular Oracle table—its columns are types, which can hold multiple values. You can use objecttables to view the data as a single-column table or a multicolumn table that consists of the compo-nents of the object type. Here’s how you would insert data into an object table:
SQL> INSERT INTO person_table2 VALUES3 ('john smith', '1-800-555-9999');
1 row created.SQL>
CollectionsCollections are ideal for representing one-to-many relationships among data. Oracle offers you twomain types of collections: varrays and nested tables. We’ll look at these two types of collections inmore detail in the following sections.
VarraysVarrays are stored in the database as RAW or BLOB objects. A varray is simply an ordered collectionof data elements. Each element in the array is identified by an index, which is used to access thatparticular element. Here’s how you declare a VARRAY type:
SQL> CREATE TYPE prices AS VARRAY (10) OF NUMBER (12,2);
Nested TablesA nested table consists of an ordered set of data elements. The ordered set can be of an object typeor an Oracle built-in type. Here’s a simple example:
SQL> CREATE TYPE lineitem_table AS TABLE OF lineitem;
To access the elements of a collection with SQL, you can use the TABLE operator, as shown inthe following example. Here, history is a nested table and courses is the column you want to insertdata into:
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1202
SQL> INSERT INTO TABLE(SELECT courses FROM department WHERE name = 'History')VALUES('Modern India');
Type InheritanceYou can create not just types, but also type hierarchies, which consist of parent supertypes and childsubtypes connected to the parent types by inheritance. Here’s an example of how you can create asubtype from a supertype. First, create the supertype:
SQL> CREATE TYPE person_t AS OBJECT (name varchar2(80),social_sec_no number,hire_date date,member function age() RETURN number,member function print() RETURN varchar2) NOT FINAL;
Next, create the subtype, which will inherit all the attributes and methods from its supertype:
SQL> CREATE TYPE employee_t UNDER person_t(salary number,commission number,member function wages () RETURN number,OVERRIDING member function print () RETURN varchar2);
The Cast OperatorThe CAST operator enables you to do two things. It lets you convert built-in data types and also con-vert a collection-type value into another collection-type value.
Here’s an example of using CAST with built-in data types:
SQL> SELECT product_id, CAST(description AS VARCHAR2(30))FROM product_desc;
PL/SQLAlthough SQL is easy to learn and has a lot of powerful features, it doesn’t allow the procedural con-structs of third-generation languages such as C. PL/SQL is Oracle’s proprietary extension to SQL,and it provides you the functionality of a serious programming language. One of the big advantagesof using PL/SQL is that you can use program units called procedures or packages in the database,thus increasing code reuse and performance.
The Basic PL/SQL BlockA PL/SQL block is an executable program. A PL/SQL code block, whether encapsulated in a pro-gram unit such as a procedure or specified as a free-form anonymous block, consists of thefollowing structures, with a total of four key statements, only two of which are mandatory:
• DECLARE: In this optional section, you declare the program variables and cursors.
• BEGIN: This mandatory statement indicates that SQL and PL/SQL statements will follow it.
• EXCEPTION: This optional statement specifies error handling.
• END: This mandatory statement indicates the end of the PL/SQL code block.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1203
Here’s an example of a simple PL/SQL code block:
SQL> DECLARE isbn NUMBER(9)BEGINisbn := 123456789;insert into book values (isbn, 'databases', 59.99);COMMIT;END;
SQL>
Declaring VariablesYou can declare both variables and constants in the DECLARE section. Before you can use any vari-able, you must first declare it. A PL/SQL variable can be a built-in type such as DATE, NUMBER,VARCHAR2, or CHAR, or it can be a composite type such as VARRAY. In addition, PL/SQL uses theBINARY_INTEGER and BOOLEAN data types.
Here are some common PL/SQL variable declarations:
hired_date DATE;emp_name VARCHAR2(30);
In addition to declaring variables, you can also declare constants, as shown in the followingexample:
tax_rate constant number := 0.08;
You can also use the %TYPE attribute to declare a variable that is of the same type as a specifiedtable’s column, as shown here:
emp_num employee.emp_id%TYPE;
The %ROWTYPE attribute specifies that the record (row) is of the same data type as a databasetable. In the following example, the DeptRecord record has all the columns contained in the depart-ment table, with identical data types and length:
declarev_DeptRecord department%ROWTYPE;
Writing Executable StatementsAfter the BEGIN statement, you can enter all your SQL statements. These look just like your regularSQL statements, but notice the difference in how you handle a SELECT statement and an INSERTstatement in the following sections.
A SELECT Statement in PL/SQLWhen you use a SELECT statement in PL/SQL, you need to store the retrieved values in variables, asshown here:
DECLAREname VARCHAR2(30);BEGIN SELECT employee_name INTO name FROM employees WHERE emp_id=99999;END;/
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1204
DML Statements in PL/SQLAny INSERT, DELETE, or UPDATE statements in PL/SQL work just as they do in regular SQL. You can usethe COMMIT statement after any such operation, as shown here:
BEGINDELETE FROM employee WHERE emp_id = 99999;COMMIT;END;/
Handling ErrorsIn PL/SQL, an error or a warning is called an exception. PL/SQL has some internally defined errors,and you can also define your own error conditions. When any error occurs, an exception is raisedand program control is handed to the exception-handling section of the PL/SQL program. If youdefine your own error conditions, you have to raise exceptions by using a special RAISE statement.
The following example shows an exception handler using the RAISE statement:
DECLAREacct_type INTEGER := 7;
BEGINIF acct_type NOT IN (1, 2, 3) THEN
RAISE INVALID_NUMBER; -- raise predefined exceptionEND IF;
EXCEPTIONWHEN INVALID_NUMBER THENROLLBACK;
END; /
PL/SQL Control StructuresPL/SQL offers you several types of control structures, which enable you to perform iterations ofcode or conditional execution of certain statements. The various types of control structures inPL/SQL are covered in the following sections.
Conditional ControlThe main type of conditional control structure in PL/SQL is the IF statement, which enables condi-tional execution of statements. You can use the IF statement in three forms: IF-THEN, IF-THEN-ELSE,and IF-THEN-ELSEIF. Here’s an example of a simple IF-THEN-ELSEIF statement:
BEGIN. . .IF total_sales > 100000 THEN
bonus := 5000;ELSEIF total_sales > 35000 THEN
bonus := 500;ELSE
bonus := 0;END IF;INSERT INTO new_payroll VALUES (emp_id, bonus . . .);
END; /
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1205
PL/SQL Looping ConstructsPL/SQL loops provide a way to perform iterations of code for a specified number of times or until acertain condition is true or false. The following sections cover the basic types of looping constructs.
The Simple Loop
The simple loop construct encloses a set of SQL statements between the keywords LOOP and ENDLOOP. The EXIT statement ends the loop. You use the simple loop construct when you don’t knowhow many times the loop should execute. The logic inside the LOOP and END LOOP statementsdecides when the loop is terminated.
In the following example, the loop will be executed until a quality grade of 6 is reached:
LOOP. . .if quality_grade > 5 then. . .EXIT;end if;
END LOOP;
Another simple loop type is the LOOP . . . EXIT . . . WHEN construct, which controls theduration of the loop with a WHEN statement. A condition is specified for the WHEN statement, andwhen this condition becomes true, the loop will terminate. Here’s a simple example:
DECLAREcount_num NUMBER(6);
BEGINcount_num := 1;LOOPdbms_output.put_line(' This is the current count '|| count_num);count_num := count_num + 1;Exit when count_num > 100;END LOOP;
END;
The WHILE Loop
The WHILE loop specifies that a certain statement be executed while a certain condition is true. Notethat the condition is evaluated outside the loop. Each time the statements within the LOOP and ENDLOOP statements are executed, the condition is evaluated. When the condition no longer holds true,the loop is exited. Here’s an example of the WHILE loop:
WHILE total <= 25000LOOP. . .SELECT sal INTO salary FROM emp WHERE . . .total := total + salary;END LOOP;
The FOR Loop
The FOR loop is used when you want a statement to be executed a certain number of times. The FORloop emulates the classic do loop that exists in most programming languages. Here’s an example ofthe FOR loop:
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1206
BEGINFOR count_num IN 1..100LOOPdbms_output.put_line('The current count is : '|| count_num);
END LOOP;END;
PL/SQL RecordsRecords in PL/SQL let you treat related data as a single unit. Records contain fields, with each fieldstanding for a different item. You can use the %ROWTYPE attribute to declare a table’s columns as arecord, which uses the table as a cursor template, or you can create your own records. Here’s asimple example of a record:
DECLARETYPE MeetingTyp IS RECORD (date_held DATE,location VARCHAR2(20),purpose VARCHAR2(50));
To reference an individual field in a record, you use the dot notation, as shown here:
MeetingTyp.location
Using CursorsAn Oracle cursor is a handle to an area in memory that holds the result set of a SQL query, enablingyou to individually process the rows in the result set. Oracle uses implicit cursors for all DML state-ments. Explicit cursors are created and used by application coders.
Implicit CursorsImplicit cursors are automatically used by Oracle every time you use a SELECT statement in PL/SQL.You can use implicit cursors in statements that return just one row. If your SQL statement returnsmore than one row, an error will result.
In the following PL/SQL code block, the SELECT statement makes use of an implicit cursor:
DECLARE emp_name varchar2(40);salary float;
BEGINSELECT emp_name, salary FROM employeesWHERE employee_id=9999;dbms_output.put_line('employee_name : '||emp_name||' salary :'||salary);
END;/
Explicit CursorsExplicit cursors are created by the application developer, and they facilitate operations with a set ofrows, which can be processed one by one. You always use explicit cursors when you know your SQLstatement will return more than one row. Notice that you have to declare an explicit cursor in the
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1207
DECLARE section at the beginning of the PL/SQL block, unlike an implicit cursor, which you neverrefer to in the code.
Once you declare your cursor, the explicit cursor will go through these steps:
1. The OPEN clause will identify the rows that are in the cursor and make them available for thePL/SQL program.
2. The FETCH command will retrieve data from the cursor into a specified variable.
3. The cursor should always be explicitly closed after your processing is completed.
Listing A-4 shows how a cursor is first created and then used within a loop.
Listing A-4. Using an Explicit Cursor
DECLARE/* The cursor select_emp is explicitly declared */
CURSOR select_emp ISselect emp_id, cityfrom employeeswhere city = 'DALLAS';v_empno employees.emp_id%TYPE;v_empcity employees.city%TYPE;
BEGIN/* The cursor select_emp is opened */Open select _emp;LOOP
/* The select_emp cursor data is fetched into v_empno variable */FETCH select_emp into v_empno;EXIT WHEN select_emp%NOTFOUND;dbms_output.put_line(v_empno|| ','||v_empcity);END LOOP;/* The cursor select_emp is closed */
Close select_emp;END;/
Cursor AttributesIn the example shown in Listing A-4, a special cursor attribute, %NOTFOUND, is used to indicate whenthe loop should terminate. Cursor attributes are very useful when you’re dealing with explicit cur-sors. Here are the main cursor attributes:
• %ISOPEN is a Boolean attribute that evaluates to false after the SQL statement completes exe-cution. It returns true as long as the cursor is open.
• %FOUND is a Boolean attribute that tests whether the SQL statement matches any row—that is,whether the cursor has any more rows to fetch.
• %NOTFOUND is a Boolean attribute that tells you that the SQL statement doesn’t match any row,meaning there are no more rows left to fetch.
• %ROWCOUNT gives you the number of rows the cursor has fetched so far.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1208
Cursor FOR LoopsNormally when you use explicit cursors, cursors have to be opened, the data has to be fetched, andfinally the cursor needs to be closed. A cursor FOR loop automatically performs the open, fetch, andclose procedures, which simplifies your job. Listing A-5 shows an example that uses a cursor FORloop construct.
Listing A-5. Using the Cursor FOR Loop
DECLARECURSOR emp_cursor IS SELECT emp_id, emp_name, salaryFROM employees;v_emp_info employees%RowType;
BeginFOR emp_info IN emp_cursorLOOPdbms_output.put_line ('Employee id : '||emp_id||'Employeename : '|| emp_name||'Employee salary :'||salary); END LOOP;
END;/
Cursor VariablesCursor variables point to the current row in a multirow result set. Unlike a regular cursor, though, acursor variable is dynamic—that is, you can assign new values to a cursor variable and pass it toother procedures and functions. Let’s look at how you can create cursor variables in PL/SQL.
First, define a REF CURSOR type, as shown here:
DECLARETYPE EmpCurTyp IS REF CURSOR RETURN dept%ROWTYPE;
Next, declare cursor variables of the type DeptCurTyp in an anonymous PL/SQL code block or ina procedure (or function), as shown in the following code snippet:
DECLARETYPE EmpRecTyp IS RECORD (
Emp_id NUMBER(9),emp_name VARCHAR2(3O),sal NUMBER(7,2));
TYPE EmpCurTyp IS REF CURSOR RETURN EmpRecTyp;emp_cv EmpCurTyp; -- declare cursor variable
Procedures, Functions, and PackagesA PL/SQL procedure can be used to perform various DML operations. The following is a simpleOracle procedure:
create or replace procedure new_employee (emp_id number, last_name varchar(2), first_name varchar(2))isbegin
insert into employees values ( emp_id, last_name, first_name);end new_employee; /
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1209
Unlike a PL/SQL procedure, a function returns a value, as shown in the following example:
CREATE OR REPLACE FUNCTION sal_ok (salary REAL, title VARCHAR2) RETURN BOOLEAN ISmin_sal REAL;max_sal REAL;
BEGINSELECT losal, hisal INTO min_sal, max_sal FROM sals
WHERE job = title;RETURN (salary >= min_sal) AND (salary <= max_sal);
END sal_ok;
Oracle packages are objects that usually consist of several related procedures and functions,and the package is usually designed to perform an application function by invoking all the relatedprocedures and functions within the package. Packages are extremely powerful, because they cancontain large amounts of functional code and be repeatedly executed by several users.
A package usually has two parts: a package specification and a package body. The package spec-ification declares the variables, cursors, and subprograms (procedures and functions) that are partof the package. The package body contains the actual cursors and subprogram code.
Listing A-6 shows a simple Oracle package.
Listing A-6. A PL/SQL Package
/* First, the Package Specification /*create or replace package emp_pkg astype list is varray (100) of number (5);procedure new_employee (emp_id number, last_name varchar2, first_name varchar2);procedure salary_raise ( emp_id number, raise number);end emp_pkg;//* The Package Body follows */create or replace package body emp_pkg asprocedure new_employee (emp_id number,last_name varchar(2), first_name varchar(2) is begininsert into employees values ( emp_id, last_name, first_name);
end new_employee; procedure salary_raise ( emp_num number, raise_pct real) isbeginupdate employees set salary = salary * raise_pctwhere emp_id = emp_num;
end salary_raise;end emp_pkg;/
If you want to use emp_pkg to award a raise to an employee, all you have to do is execute thefollowing:
SQL> EXECUTE emp_pkg.salary_raise(99999, 0.15);
Oracle XML DBA typical organization has information stored in multiple formats, some of which may be organizedin relational databases, but most of which is stored outside the database. The nondatabase infor-mation may be stored in application-specific formats, such as Excel spreadsheets. Storing the
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1210
nondatabase information in XML format instead makes it easier to access and update nonstruc-tured organizational information.
Oracle XML DB isn’t really a special type of database for XML. It simply refers to the set of built-in XML storage and retrieval technologies for the manipulation of XML data. Oracle XML DBprovides the advantages of object-relational database technology and XML technology. For exam-ple, one of the major problems involved in dealing with XML data from within a relational databaseis that most XML data is hierarchical in nature, whereas the Oracle database is based on the rela-tional model. Oracle manages to deal effectively with the hierarchical XML data by using specialSQL operators and methods that let you easily query and update XML data in an Oracle database.Oracle XML DB builds the XML Document Object Model (DOM) into the Oracle kernel. Thus, mostXML operations are treated as part of normal database processing.
Oracle XML DB provides the ability to view both structured and nonstructured information asrelational data. You can view the data as either rows in a table or nodes in an XML document.
Here is a brief list of the benefits offered by Oracle XML DB:
• You can access XML data using regular SQL queries.
• You can use Oracle’s OLTP, data warehousing, test, spatial data, and multimedia features toprocess XML data.
• You can generate XML from an Oracle SQL query.
• You can transform XML into HTML format easily.
Storing XML in Oracle XML DBOracle uses a special native data type called XMLType to store and manage XML data in a relationaltable. XMLType and XDBURIType, which is another built-in type for XML data, enable you to leavethe XML parsing, storage, and retrieval to the Oracle database. You can use the XMLType data typejust as you would the usual data types in an Oracle database. You can now store a well-formed XMLdocument in the database as an XML test using the CLOB base data type.
Here’s an example of using the XMLType data type:
SQL> CREATE TABLE sales_catalog_table2 (sales_num number(18),3 sales_order xmltype);
Table created.SQL> DESC sales_catalog_tableName Null? Type--------------------- ----- --------SALES_NUM NUMBER(18)SALES_ORDER XMLTYPESQL>
The XMLType data type comes with a set of XML-specific methods, which you use to work withXMLType objects. You can use these methods to perform common database operations, such aschecking for the existence of a node and extracting a node. The methods also support several opera-tors that enable you to access and manipulate XML data as part of a regular SQL statement. Theseoperators follow the emerging SQL/XML standard. Using the well-known XPath notation, theSQL/XML operators traverse XML structures to find the node or nodes on which they should usethe SQL operations. Here are some of the important SQL/XML operators:
• Extract() extracts a subset of the nodes contained in the XMLType.
• ExistsNode() checks whether a certain node exists in the XMLType.
• Validating() validates the XMLType contents against an XML schema.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1211
• Transform() performs an XSL transformation.
• ExtractValue() returns a node corresponding to an XPath expression.
XML is in abstract form compared to the normal relational table entries. To optimize and exe-cute statements that involve XML data, Oracle uses a query-rewrite mechanism to transform anXPath expression into an equivalent regular SQL statement. The optimizer then processes the trans-formed SQL statement like any other SQL statement.
You can store XML in Oracle XML DB in the following ways:
• You can use SQL or PL/SQL to insert the data. Using XMLType constructors, you must firstconvert the sourced data into an XMLType instance.
• You can use the Oracle XML DB repository to store the XML data.
Here’s a simple example using the sales_catalog_table table to demonstrate how to performSQL-based DML operations with an XML-enabled table. In Listing A-7, an XML document isinserted into sales_catalog_table.
Listing A-7. Inserting an XML Document into an Oracle Table
SQL> INSERT INTO sales_catalog_table2 VALUES (123456,3 XMLTYPE(4 '<SalesOrder>5 <Reference>Alapati - 200302201428CDT</Reference>6 <Actions/>7 <Reject/>8 <Requestor>Nina U. Alapati</Requestor>9 <User>ALAPATI</User>10 <SalesLocation>Dallas</SalesLocation>11 <ShippingInstructions/>12 <DeliveryInstructions>Bicycle Courier</DeliveryInstructions>13 <ItemDescriptions>14 <ItemDescription ItemNumber="1">15 <Description>Expert Oracle DB Administration</Description>16 <ISBN Number="1590590228"Price="59.95"Quantity="5"/>17 </ItemDescription>18 </ItemDescriptions>19* </SalesOrder>'));1 row created.SQL>
You can query the sales_catalog_table table’s sales_order column, as shown in Listing A-8, toview the XML document in its original format.
Listing A-8. Viewing XML Data Stored in an Oracle Table
SQL> SELECT sales_order FROM 2 sales_catalog_table;<SalesOrder>
<Reference>Alapati - 200302201428CDT</Reference><Actions/><Reject/><Requestor>Sam R. Alapati</Requestor><User>ALAPATI</User><SalesLocation>Dallas</SalesLocation><ShippingInstructions/>
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1212
<DeliveryInstructions>Bicycle Courier</DeliveryInstructions><ItemDescriptions><ItemDescription ItemNumber="1"><Description>Expert Oracle DB Administration</Description><ISBN Number="9999990228" Price="59.95" Quantity="2"/>
</ItemDescription></ItemDescriptions>
</SalesOrder>SQL>
Once you create the sales_catalog_table table, it’s very easy to retrieve data using one of themethods I just described. The following example shows how to query the table using the extract()method. Note that the query includes XPath expressions and the SQL/XML operators extractValueand existsNode to find the requestor’s name where the value of the /SalesOrder/SalesLocation/text() node contains the value Dallas.
SQL> SELECT extractValue(s.sales_order,'/SalesOrder/Requestor')2 FROM sales_catalog_table s3 WHERE existsNode(s.SALES_ORDER,4* '/SalesOrder[SalesLocation="Dallas"]') = 1;
EXTRACTVALUE(S.SALES_ORDER,'/SALESORDER/REQUESTOR')---------------------------------------------------Nina U. AlapatiSQL>
The Oracle XML DB RepositoryThe best way to process XML documents in Oracle XML DB is to first load them into a special repos-itory called the Oracle XML DB repository. The XML repository is hierarchical, like most XML data,and it enables you to easily query XML data. The paths and URLs in the repository represent therelationships among the XML data, and a special hierarchical index is used to traverse the foldersand paths within the repository. The XML repository can hold non-XML data such as JPEG images,Word documents, and more.
You can use SQL and PL/SQL to access the XML repository. XML authoring tools can directlyaccess the documents in the XML repository using popular Internet protocols such as HTTP, FTP,and WebDAV. For example, you can use Windows Explorer, Microsoft Office, and Adobe Acrobat towork with the XML documents that are stored in the XML repository. XML is by nature document-centric, and the XML repository provides applications with a file abstraction when dealing withXML data.
Setting Up an XML SchemaBefore you can start using Oracle XML DB to manage XML documents, you need to perform the fol-lowing tasks:
1. Create an XML schema. For example, SalesOrder, shown in Listing A-7, is a simple XMLschema that reflects a simple XML document. Within the SalesOrder schema are elementssuch as ItemDescription, which provides details about the attributes of the componentitems.
2. Register the XML schema. After the XML schema is created, you must register it with theOracle database using a PL/SQL procedure. When you register the XML schema, Oracle willcreate the SQL objects and the XMLType tables that are necessary to store and manage theXML documents. For the example shown in Listing A-6, registering the XML schema will
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1213
create a table called SalesOrder automatically, with one row in the table for each SalesOrderdocument loaded into the XML repository. The XML schema is registered under the URLhttp://localhost:8080/home/SCOTT/xdb/salesorder.xsd, and it contains the definition ofthe SalesOrder element.
Creating a Relational View from an XML DocumentEven if a developer doesn’t know much XML, he or she can use the XML documents stored in theOracle database by creating relational views based on the XML documents. The following examplemaps nodes in an XML document to columns in a relational view called salesorder_view:
SQL> CREATE OR REPLACE VIEW salesorder_view2 (requestor,description,sales_location)3 AS SELECT4 extractValue(s.sales_order,'/SalesOrder/Requestor'),5 extractValue(s.sales_order,'/SalesOrder/Sales_Location')6* FROM sales_Catalog_Table s ;
View created.SQL>
You can query salesorder_view like you would any other view in an Oracle database, as shownhere:
SQL> SELECT requestor,sales_location FROM salesorder_view;REQUESTORSALES_LOCATIONAparna AlapatiDallasSQL>
Oracle and JavaYou can use both PL/SQL and Java to write applications that need Oracle database access. AlthoughPL/SQL has several object-oriented features, the Java language is well known as an object-orientedprogramming language. If your application needs heavy database access and must process largeamounts of data, PL/SQL is probably a better bet. However, for open distributed applications, Java-based applications are more suitable.
The Oracle database contains a Java Virtual Machine (JVM) to interpret Java code from withinthe database. Just as PL/SQL enables you to store code on the server and use it multiple times, youcan also create Java stored procedures and store them in the database. These Java stored proceduresare in the form of Java classes. You make Java files available to the Oracle JVM by loading them intothe Oracle database as schema objects.
You can use the Java programming language in several ways in an Oracle database. You caninvoke Java methods in classes that are loaded in the database in the form of Java stored proce-dures. You can also use two different application programming interfaces (APIs), Java DatabaseConnectivity (JDBC) or SQLJ, to access the Oracle database from a Java-based application program.In the sections that follow, we’ll briefly look at the various ways you can work with Java and theOracle database.
Java Stored ProceduresJava stored procedures are, of course, written using Java, and they facilitate the implementation ofdata-intensive business logic using Java. These procedures are stored within the database like
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1214
PL/SQL stored procedures. Java stored procedures can be seen as a link between the Java and non-Java environments.
You can execute Java stored procedures just as you would PL/SQL stored procedures. Here’s asummary of the steps involved in creating a Java stored procedure:
1. Define the Java class.
2. Using the Java compiler, compile the new class.
3. Load the class into the Oracle database. You can do this by using the loadjava command-line utility.
4. Publish the Java stored procedure.
Once you’ve completed these steps, you can invoke the Java stored procedure.
JDBCJDBC is a popular method used to connect to an Oracle database from Java. Chapter 10 contains acomplete example of a Java program. JDBC provides a set of interfaces for querying databases andprocessing SQL data in the Java programming language.
Listing A-9 shows a simple JDBC program that connects to an Oracle database and executes asimple SQL query.
Listing A-9. A Simple JDBC Program
import java.sql.*;public class JDBCExample {public static void main(String args[]) throws SQLException
/* Declare the type of Oracle Driver you are using */{DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
/* Create a database connection for the JDBC program */Connection conn=DriverManager.getConnection(
"jdbc:oracle:thin:@nicholas:1521:aparna","hr","hr");Statement stmt = conn.createStatement();/* Pass a query to SQL and store the results in the result set rs */ResultSet rs =stmt.executeQuery("select emp_id, emp_name,salary from employees");/* Using the while loop, result set rs is accessed row by row */while(rs.next()){int number = rs.getInt(1); String name= rs.getString(2);System.out.println(number+" "+name+" "+salary);
}/* Close the JDBC result set and close the database connection */rs.close();conn.close();
}}
JDBC is ideal for dynamic SQL, where the SQL statements aren’t known until run time.
SQLJSQLJ is a complementary API to JDBC, and it’s ideal for applications in which you’re using staticSQL (SQL that’s known before the execution). Being static, SQLJ enables you to trap errors before
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER 1215
they occur during run time. Keep in mind that that even with SQLJ, you still use JDBC drivers toaccess the database.
There are three steps involved in executing a SQLJ program:
1. Create the SQLJ source code.
2. Translate the SQLJ source code into Java source code using a Java compiler.
3. Execute the SQLJ runtime program after you connect to the database.
Listing A-10 contains a simple SQLJ example that shows how to execute a SQL statement fromwithin Java.
Listing A-10. A Simple SQLJ Program
import java.sql.*;import sqlj.runtime.ref.DefaultContext;import oracle.sqlj.runtime.Oracle;/* Declare the variables here *//* Define an Iterator type to store query results */#sql iterator ExampleIter (int emp_id, String emp_name,float salary);public class MyExample/* The main method */
{ public static void main (String args[]) throws SQLException{
/* Establish the database connection for SQLJ */Oracle.connect("jdbc:oracle:thin:@shannon:1234:nicholas1", "hr", "hr");
/* Insert a row into the employees table */#sql { insert into employees (emp_id, emp_name, salary)
values (1001, 'Nina Alapati', 50000) };/* Create an instance of the iterator ExampleIter */ExampleIter iter;
/* Store the results of the select query in the iterator ExampleIter */#sql iter={ select emp_id, emp_name, salary from employees };
/* Access the data stored in the iterator, using the next() method */while (iter.next()) {
System.out.println(iter.emp_id,()+" "+iter.emp_name()+" "+iter.salary());}
}}
As you can see from the SQLJ example in Listing A-10, SQLJ is nothing more than embeddedSQL in a Java program. Using SQLJ, you can easily make calls to the database from Java. For a wealthof information on Oracle and Java, please visit Oracle’s Java Center web site (http://otn.oracle.com/tech/java/content.html).
This appendix just provided a very brief introduction to the Oracle Database 10g SQL andPL/SQL capabilities. Although Oracle DBAs aren’t always expected be very proficient in SQL andPL/SQL, the more you know about them, the better off you’ll be as a professional Oracle DBA.
APPENDIX A ■ ORACLE DATABASE 10g SQL AND PL/SQL: A BRIEF PRIMER1216
Symbols and Numbers/ command, SQL*Plus, 515$ sign, UNIX, 5364-Bit Itanium processors, 917@@commandfile notation, 518
Aabnormal program failure, 226ABORT command
SHUTDOWN ABORT command,384
ABORT_REDEF_TABLE procedure,818
absolute path, UNIXfile locations, 47navigating directories, 62
abstract data types, 1201–1203CAST operator, 1203collections, 1202CREATE TYPE command, 1202nested tables, 1202object tables, 1202type inheritance, 1203varrays, 1202
ACCEPT command, SQL*Plus, 511ACCEPT_SQL_PROFILE procedure,
998access
restricting database access,382–383
Access Advisorsee SQL Access Advisor
access driverscreating external table layer, 562ORACLE_DATAPUMP access
driver, 563–564ORACLE_LOADER access driver,
562ACCESS PARAMETERS clause, 562access path analysis
Automatic Tuning Optimizer, 996CBO choosing, 948
access planSQL processing, 1005
accessing datasee data access
ACID properties, transactions, 228actions
ADDM recommendations, 763active and inactive pages
memory management, 80
Active Session Historysee ASH
active session poolDatabase Resource Manager
setting, 819resource allocation method, 432
Active Sessions chart, 1067Active Sessions section, 891ACTIVE_SESSION_POOL parameter,
436ACTIVE_SESS_POOL_MTH
parameter, 436ADD PARTITION clause, 191Additional Information section
reading ADDM reports, 768ADDM (Automatic Database
Diagnostic Monitor), 140,759–773
ADDM analysis, 1068analyzing performance problems,
1055automatic performance tuning,
1004AWR relationship, 760configuring, 763–764data dictionary views, 773, 1112determining optimal I/O
performance, 764–765introduction, 759managing, 763problems diagnosed by ADDM,
760–762pronunciation of ADDM, 760purpose of ADDM, 760recommendations, 762–763running ADDM, 765
setting to run by default, 763using OEM Database Control,
773time model statistics, 761, 761–762tuning related advisors, 850types of findings, 762using DBMS_ADVISOR package,
770when ADDM runs, 764
ADDM reportsabbreviated reports, 766caution: confusing with AWR
reports, 840contents, 761creating using addmrpt.sql script,
765, 768–769
detailed reports using OEM,770–772
reading, 766, 768viewing, 765–772
ADDUSER command, iSQL*Plus, 534ADD_FILE command/parameter
Data Pump utilities, 611, 612, 613,621
ADD_LOGFILE proceduresample LogMiner session, 735
ADD_POLICY procedurefine-grained auditing, 469, 470
ADD_POLICY procedure, 459adding security policy to database,
459–460column-level VPD, 460Oracle Policy Manager, 461
ADD_POLICY_CONTEXT procedure,459
ADD_TABLE_RULES procedure, 586adhoc administrative directory, 285admin class, Oracle Backup tool, 685ADMIN OPTION clause
granting system privileges, 444ADMIN privilege
granting privileges, 483Administration Assistant for NT
see Oracle Administration Assistantfor NT
Administration pageOEM Database Control, 893
administrative context, 415administrative directories, 285administrative domain, 681administrative files, 282, 285administrative server
servers comprising administrativedomain, 681
Administrative wait class, 1035Administrator option
installing Oracle Client, 398Administrators option
Database Control Setup page, 895ADMIN_TABLES procedure, 1160adump administrative directory, 285Advanced Queuing (AQ)
Oracle Streams, 584Advanced Replication feature, 700Advanced Security option, 413, 414,
487
Index
1217
Advisor Central pagemanaging advisory framework,
853SQL Access Advisor
recommendations, 218viewing ADDM reports, 770
advisorsAWR snapshots, 836DBMS_ADVISOR package, 1180instance-related advisors, 849invoking from alert messages, 850management advisors, 849–850memory-related advisors, 849MTTR Advisor, 854–855raw data source, 849scheduling to run automatically,
849Segment Advisor, 850, 853SQL Access Advisor, 850SQL Tuning Advisor, 850tuning-related advisors, 850Undo Advisor, 850, 854V$ADVISOR_PROGRESS view,
1123advisory framework, 143, 849–853
data dictionary views, 853,1113–1115
DBMS_ADVISOR package,850–852, 1180
description, 823introduction, 849management advisors, 849–850managing the framework, 850–853OEM Database Control, 852–853PGA Memory Advisor, 143primary function, 849Segment Advisor, 143SGA Memory Advisor, 143SQL Access Advisor, 143SQL Tuning Advisor, 143Undo Advisor, 143
after image records, 109AFTER SUSPEND system event, 273alert log file, 111
creating database, 365DBA daily routine, 15location of file, 111managing flash recovery area, 647parameter logging checkpointing
activity to, 356starting Oracle instance, 362
alertsalert queue, using, 831critical alerts, 828critical threshold, 832data dictionary views related to,
833–834Database Control, 829–831DBA_ALERT_HISTORY view, 833,
1112DBA_OUTSTANDING_ALERTS
view, 833, 1112DBMS_SERVER_ALERT package,
831, 1180Grid Control, 906, 907
invoking advisors from alertmessages, 850
managing alerts, 829–832managing/monitoring database,
144operation suspended alert, 273out-of-space warning and critical
alerts, 647problem-related alerts, 828server-generated alerts, 142,
828–834setting alert thresholds, 830setting notification rules, 831situations causing alerts, 828“snapshot too old” alert, 834tablespace alerts, 161, 162,
832–833tablespace space usage alert, 828threshold-based alerts, 828V$ALERT_TYPES view, 833views-related, 1135–1136warning alerts, 828warning threshold, 832
Alerts table, Database Control, 829ALERT_QUE queue, 829algebra, relational, 21algorithms, encryption, 482aliases for objects, 220All Metrics page, Database Control,
826ALL PRIVILEGES statement, 443ALL views, 1084ALLOCATE CHANNEL command,
656, 660allocation methods, resource, 432alloc_bytes, 198ALLOW n CORRUPTION recovery
option, 753ALL_HOMES subkey, Windows
registry, 921ALL_ROWS hint/value
influencing execution plan, 959OPTIMIZER_MODE parameter,
946ALTER DATABASE command, 160ALTER PROFILE command, 473ALTER SESSION command, 146
changing dynamic parametervalues, 335
enabling Resumable SpaceAllocation, 271
NAME parameter, 272TIMEOUT clause, 271
ALTER SYSTEM command, 146activating Database Resource
Manager, 440changing dynamic parameter
values, 335SCOPE clause, 377
ALTER TABLE command, 153ALTER TABLESPACE command, 160,
163, 164ALTER USER command, 425, 473ALTER_ATTRIBUTES procedure, 876ALTER_SQL_PROFILE procedure, 998
ALWAYS log group, 733analytical functions, 1193–1194ANALYZE command
collection of Optimizer statistics,950
detecting data block corruption,693
ancestor incarnation, 720ANSI (American National Standards
Institute), 145APM (Application Performance
Monitoring) tools, 885APPEND clause, SQL*Loader, 544APPEND command, SQL*Plus, 521application attributes, defining, 454application contexts, 454–456Application Performance Monitoring,
885application security, 487Application wait class, 1035arch administrative directory, 285architecture
see also Oracle Database 10gArchitecture
Optimal Flexible Architecture, 281RMAN architecture, 649–652
ARCHIVE LOG command, SQL*Plus,524
ARCHIVE LOG LIST command,SQL*Plus, 524
confirming archivelog mode, 372archive logs
archive log parameters, 347archived redo logs, SQL*Plus, 109,
524backing up with RMAN, 673dynamic performance views,
1123–1125recovering database with RMAN,
713retention policy, 647viewing details about, 524
archivelog mode, 117, 632archivelog/noarchivelog modes,
110, 371–373making database backups, 687partial database backups, 690recovery catalog, 669
archiver (ARCn) processbackground processes, 114, 117database hangs, 1058–1059flash recovery area, 642
archiving databackup guidelines, 636partitioned tables, 186
archiving, UNIX, 76ARCn
see archiver (ARCn) processarguments, UNIX
executing shell scripts, 69arrays
transforming array data, 581–582user-defined object types, 149
ARRAY[SIZE] variable, SQL*Plus, 500
■INDEX1218
AS OF clauseFlashback Query feature, 256Flashback Versions Query feature,
258ASH (Active Session History), 142,
845–849analyzing instance before tuning,
1066analyzing waits, 1040ashrpt.sql script, 846brief description, 823current active session data,
845–846MMNL process, 845older active session history data,
846sample data, 824
ASH reports, 1072Activity Over Time section, 848analyzing recent session activity
with, 1057beginning of ASH report, 846creating, 846Top Xyz sections, 847–848
ashrpt.sql script, 846, 1057ashrpti.sql script, 1057ASM (Automatic Storage
Management), 141, 783–799architecture, 784–785ASM Cache, 788ASM instance
administering, 792ASM architecture, 784checking processes, 789creating, 787–791DBCA creating automatically,
787examining instance
architecture, 789initialization parameters for,
787–789naming, 789NOMOUNT/MOUNT
commands, 790privileges required, 787purpose of, 787shutting down, 790–791starting up, 790
asmcmd command-line tool, 791backing up ASM database, 789benefits of, 784Cluster Synchronization Service
and, 785–787creating ASM-based Oracle
database, 797Database Control and, 783disk groups, 791
adding disks to, 793adding performance and
redundancy with, 791–792ASM architecture, 784ASM_DISKGROUPS parameter,
787
creating, 792–793creating directories for alias
filenames, 795creating new tablespace, 794dropping disks and, 794dropping files from, 796incomplete ASM filenames, 795managing ASM files, 794–795rebalancing, 794
dynamic performance views, 1142failure groups, 792files
adding and dropping aliases,796
ASM file templates, 796ASM filename usage, 796managing ASM files, 794–795naming conventions, 795types of ASM filenames, 795
installing, 785Logical Volume Manager, 783migrating database to, 797–799
with Database Control,798–799
with RMAN, 797–798mirroring, 792, 792parameter specifying instance
type, 338storage system summarized, 785storage technologies, 94striping, 792templates
ASM file templates, 796using templates with aliases,
795ASM background (ASMB) process,
118ASM rebalance (ARBn) processes, 118asmcmd command-line tool, 791ASM_DISKGROUPS parameter, 787ASM_DISKSTRING parameter, 787ASM_POWER_LIMIT parameter, 787ASSM (Automatic Segment Space
Management), 800, 1045reducing buffer busy waits event,
1047at (@) sign
executing SQL scripts iniSQL*Plus, 536
executing SQL scripts in SQL*Plus,514–515
at command, UNIX, 77at command, Windows, 516, 918ATO (Automatic Tuning Optimizer),
995–996atomicity, transactions, 228ATTACH command/parameter
Data Pump utilities, 599, 609–612attributes
building entity-relationshipdiagram, 27
entity-relationship modeling, 25relational database model, 20
audit filesadump administrative directory,
285default location for audit file, 462
AUDIT SESSION statementdetermining parameter limits, 430information recorded, 464
audit trails, 471auditing
audit by access, 462audit by session, 462audit levels, 462audit-related parameters, 336–337auditing database usage, 461–471data dictionary views, 1098–1099database auditing, 483
customizing with triggers,465–468
DBA_AUDIT_TRAIL view, 463default auditing, 463default location for audit file, 462enabling, 462–463fine-grained auditing, 468–471limiting data written to audit trail,
462object-level audit, 462privilege-level audit, 462standard auditing, 462–468statement-level audit, 462SYS.AUD$ table, 463, 471turning auditing off, 464–465turning auditing on, 463–464using flashback features for, 468
audit_column parameterADD_POLICY procedure, 469
audit_column_opts parameterADD_POLICY procedure, 470
audit_condition parameterADD_POLICY procedure, 469
AUDIT_FILE_DEST parameter, 337,462
AUDIT_SYS_OPERATIONSparameter, 337
AUDIT_TRAIL parameter, 336,462–463
audit_trail parameterADD_POLICY procedure, 470
AUM (Automatic UndoManagement), 133, 244–251
advantages of, 244DBA_UNDO_EXTENTS view, 1104reducing buffer busy waits event,
1047setting up, 245–250space management, 800undo segments, 250UNDO_MANAGEMENT
parameter, 245UNDO_RETENTION parameter,
247UNDO_TABLESPACE parameter,
245using DBCA, 246V$UNDOSTAT view, 1134
■INDEX 1219
authenticationsee also passwords; securitychecking for password file for, 356connecting to RMAN, 651database authentication, 471–475denying remote client
authentication, 486external authentication, 475–476parameter prefixing operating
system authenticatedusernames, 356
proxy authentication, 476AUTHENTICATION_SERVICES
parameter, SQLNET, 406authorization
centralized user authorization, 476database authorization, 450external authorization, 451global authorization, 451role authorization, 450–451
authorizationsdatabase creation, 332
AUTOALLOCATE clause/optionlocally managed tablespaces, 155managing extent sizes, 151tablespace storage parameters,
157–158temporary tablespaces, 165
AUTOCOMMIT variableCOMMIT statement, 227making DML changes permanent,
523AUTOEXTEND feature
ALTER TABLESPACE command,160
altering bigfile tablespaces, 171altering tablespaces, 163sizing undo tablespaces, 250
automated tasks feature, 142automatic checkpoint tuning, 116,
141, 810automatic consumer group
switching, 436resource allocation method, 432
Automatic Database DiagnosticMonitor
see ADDMautomatic database management,
140–141automatic database startup, 380Automatic Disk-Based Backup and
Recovery, 640automatic memory management, 140automatic optimizer statistics
collection, 141, 780–782,949–952
automatic performance tuning,1003–1004
automatic PGA management, 129automatic Segment Advisor
operation, 141Automatic Segment Space
Management, 800, 1045,1047
automatic sequencessee sequences
automatic service registration,401–402
automatic shared memorymanagement
see automatic shared memorymanagement under SGA
automatic space management,799–810
see also space managementAutomatic Storage Management
see ASMAutomatic Tuning Optimizer, 995–996Automatic Undo Management
see AUMautomatic undo retention tuning, 141Automatic Workload Repository
see AWRAUTOMATIC_ORDER
transforming array data with rules,582
autonomous transactions, 267–269Autotrace utility, SQL, 979–983
interpreting execution plans andstatistics, 981–983
options, 980PLUSTRACE role, 980privileges, 979
AUTO[COMMIT] variable, SQL*Plus,500
AUTO_SPACE_ADVISOR_JOBautomatic Segment Advisor job,
809default Scheduler jobs, 882
AUTO_TASK_CONSUMER_GROUP,435
auxiliary databaseusing RMAN for TSPITR, 730
availabilitybenefits of archivelog mode, 632
Average Active Sessions chart, 891,1070
averages, SQL*Plus statistics, 513AVG function, 1191AVG_XYZ system usage statistics,
1053AWR (Automatic Workload
Repository), 142, 834–845ADDM relationship, 760automatic performance tuning,
1004configuring ADDM, 764data dictionary views, 1112data handling with AWR, 835DBMS_WORKLOAD_REPOSITORY,
1181description, 823managing, 836–845types of data collected by, 835
AWR reports, 1072Cache Sizes section, 842caution: confusing with ADDM
reports, 840creating, 840, 844
information included in, 840Instance Efficiency section,
842–843Load Profile section, 842naming, 842Operating System Statistics
section, 844Segments by Physical Reads
section, 844specifying report time period, 841specifying report type, 841SQL Ordered by Elapsed Time
section, 843–844text and HTML versions, 840Time Model Statistics section, 843Top 5 Timed Events section, 843using for individual SQL
statements, 1055–1057AWR snapshots, 834, 1077
CREATE_SNAPSHOT procedure,836
creating and deleting baselines,838–839
Database Control managing,836–838
DBMS_WORKLOAD_REPOSITORY,836
default period for, 836DROP_SNAPSHOT procedure, 836preserved snapshot set, 838purging, 839retention time period, 839running ADDM, 765snapshot interval, 839
setting to zero, 836storage space requirement, 835,
839AWR statistics
controlling volume collected, 764managing with data dictionary
views, 844retention period, 835time model statistics, 762
awrrpt.sql script, 840awrsqrpt.sql script, 1056
BB-tree indexes
bitmap indexes compared, 199index-organized tables, 184Oracle index schemes, 197using appropriate index types,
963–964background and training, DBA, 9–11background processes, 114–119
archiver (ARCn), 117ASM background (ASMB), 118ASM rebalance (ARBn) processes,
118change tracking writer, 119checkpoint (CKPT), 116database writer (DBWn), 115file mapping monitor (FMON), 117getting complete list of, 118
■INDEX1220
job queue coordination (CJQO),118
lock (LCKn), 119log writer (LGWR), 115manageability monitor (MMON),
118manageability monitor light
(MMNL), 118memory manager (MMAN), 118process monitor (PMON), 116Queue Monitor Coordinator
(QMNC), 119rebalance master (RBAL), 118recoverer (RECO), 119recovery writer, 119system monitor (SMON), 117V$BGPROCESS view, 1140
background processes, UNIX, 74BACKGROUND_DUMP_DEST
parameter, 111, 340backup
see also recovery; Flashbackarchitecture, 133–135backing up Oracle databases,
631–640backing up with RMAN, 672backup levels, 634backup piece, 655backup set, 655backup tags, 657backup terminology, 632–634
archivelog/noarchivelogmodes, 632–633
consistent/inconsistentbackups, 633
logical/physical backups, 634open/closed backups, 634whole/partial database
backups, 633benefits of using tablespaces, 105change-tracking writer, 119control file, backing up, 134,
679–680Database Backup Procedure
window, 320database backups, 134database corruption detection,
692–694dynamic performance views,
1120–1121formats, 657guidelines, 634–636HARD initiative, 694incremental backups, 676loss of data since previous backup,
632manual upgrade process, 323monitoring online backups, 691open backups, 632optimization, 667Oracle Backup tool, 134, 680–686Oracle DBA’s role, 3partial database backups, 690–691redo log files, 109, 134
redundancy set, maintaining,636–637
retention policy, 665schedules, 639–640SCN (system change number), 633service level agreements, 637–638SHOW RECYCLEBIN command,
506strategies, 6, 631, 637–640system change number (SCN), 132tape backups, 134testing, 636undo records, 134upgrading with DBUA, 321user-managed backups, 686–691V$ views, 691validating RMAN backups, 708whole closed backups, 687–688whole database backups, 687–690whole open backups, 688–690
backup and restore utilities, UNIX, 76RAID systems, 92
BACKUP command, RMAN, 657,659–660, 671
ARCHIVELOG ALL, 673AS BACKUPSET DATABASE, 659AS COMPRESSED BACKUPSET,
678AS COPY, 659, 661CONTROLFILE TO TRACE, 680CURRENT CONTROLFILE, 674DATABASE, 649, 672, 675DATABASE PLUS ARCHIVELOG,
673DATAFILE, 675DURATION clause, 675INCREMENTAL LEVEL, 676LOGICAL keyword, 659OPTIMIZATION option, 667RECOVERY AREA, 646, 647RECOVERY FILE DESTINATION,
646RECOVERY FILES, 646TABLESPACE USERS, 674VALIDATE DATABASE
ARCHIVELOG ALL, 679BAD FILE parameter, 562BAD parameter, SQL*Loader, 549bandwidth
performance monitoring, UNIX,81
baseline data, 838–839performance statistics, 824
bash (Bourne Again Shell), 45, 55bashrc (.bashrc) file, 55bash_profile (.bash_profile) file, 55batch command, UNIX, 77batch mode, UNIX, 54BATCH option, 227batch script, Windows, 516bdump administrative directory, 285before image records, 109BEGIN BACKUP command, 688BEGIN statement, PL/SQL,
1203–1204
BEGINDATA clause, SQL*Loader, 544begin_discrete_transaction
procedure, 267benefits
ADDM recommendations, 762BETWEEN operator, 1189BFILE data type, 1185bigfile tablespaces, 169–171bin directory, UNIX, 48binary compression feature, RMAN,
649BINARY data types, 1185binary dumps, 102binary large objects (BLOBs)
ORDBMS model, 40binary operations, 942bind variables
CURSOR_SHARING parameter,1010–1011
identical SQL statements, 1006performance tuning, 967query performance, 1006reducing parse time CPU usage,
1028binding
converting hard parse to softparse, 1013
Oracle SQL transaction stages, 232BINDSIZE parameter, SQL*Loader,
548bitmap indexes, 199
using appropriate index types, 963bitmaps, 106BJIs (Bitmap join indexes), 960–961Blackouts option, Database Control,
895BLOB data type, 1185block checking
see data blocksblock corruption
data blocks, 102DBMS_REPAIR package,
1160–1161block media recovery
see BMRblock special files, UNIX, 57block-change tracking, 677BLOCKED status, Oracle listener, 402blocking locks, 239blocking sessions
identifying source of lock, 242BLOCKRECOVER command, RMAN,
753blocks
see data blocksBLOCKSIZE clause, 159BLOCKTERMINATOR variable, SQL,
520BMR (block media recovery)
benefits of RMAN, 648recovering from data block
corruption, 753RMAN and, 705when to use, 705
Boolean operators, 1190
■INDEX 1221
Boolean parametersSET_BOOL_PARAM_IN_SESSION
procedure, 1158bouncing the database, 334Bourne Again Shell (bash), 45, 55Bourne shell (sh), 45, 55Boyce-Codd normal form (BCNF), 33BREAK command, SQL*Plus, 512breaks, clearing, 506BSP (Backup Solutions Program), 652BTITLE command, SQL*Plus, 513buffer busy waits event, 1047–1048buffer cache
ageing out blocks, 1017assign table or index to, 1019auto-tuned SGA parameters, 775buffer busy waits event, 1047buffer cache hit ratio, 124, 1016,
1017caution: high buffer cache hit
ratio, 1033buffer gets, 1016buffer pools, 122consistent gets, 1016database buffer cache, 121–124database writer (DBWn) process,
131DB block gets, 1016logical reads, 1016memory allocation, 121multiple data block sizes and, 123physical reads, 1016setting nonstandard-sized, 344specifying values for subcaches,
123sizing, 1016–1017system global area, 121tuning, 1016–1019using multiple pools for,
1017–1019buffer gets, 1016buffer pools
database buffer cache, 122listing, 1017main types, 123setting size of default pool, 344using multiple block size feature,
159V$BUFFER_POOL view, 1117
bufferssee also memoryclearing SQL buffer, 505executing contents of SQL buffer,
515least recently used buffers, 122listing SQL commands, 518memory buffers, 121redo log buffer, 125saving SQL buffer contents to file,
514understanding memory, 120
BUILD IMMEDIATE clause, 214Burleson Consulting, 14Business Copy XP, 652
business rules, 36–37database integrity constraints, 202
BUSY_TICKS system usage statistic,1053
bytes remainingtablespace alert thresholds, 162
BYXYZ (BYDAY etc.) specifiersOracle Scheduler jobs, 868
CC shell (csh), 45, 55cache buffer chain latch free wait,
1051cache recovery, 701, 703caching
buffer pools, 122cache misses affecting
performance, 125Cache Sizes section, AWR reports,
842data block sizes and tablespaces,
105data dictionary cache, 125library cache, 125performance tuning, 974setting nonstandard-sized buffer
caches, 344setting pool sizes, 344V$DB_CACHE_ADVICE view, 1118
calendaring expression, Scheduler,868
cancel-based recovery, 721candidate keys, 26CAN_REDIF_TABLE procedure, 814capacity planning, 6capture process, Oracle Streams, 584Cartesian product
avoiding Cartesian joins, 960cost-based query optimization,
941join operations, 1195relational algebra, 21
CASCADE clause/keyworddropping tables, 182dropping user profiles, 430
CASCADE optionGATHER_DATABASE_STATS
procedure, 951case command, UNIX, 73CASE function, 1193CASE statement, SQL, 958CAST operator, 1203cat command, UNIX, 58, 52CATALOG command, RMAN, 663catalog.sql script, 368, 1084catblock.sql script, 241catproc.sql script, 368catupgrd.sql script, 325CBO (cost-based optimizer), 136,
943–956Automatic Tuning Optimizer, 995Autotrace utility statistics, 983choosing access path, 948choosing join method/order, 948
choosing optimization mode, 943collecting data dictionary
statistics, 954–955collecting operating system
statistics, 952–954cost-based query optimization,
940–942cost model of Oracle Optimizer,
952DBMS_STATS package, 949–952,
1175drawbacks, 949frequency of statistics collection,
955gathering statistics, 943–945,
949–952heavy data skew in table, 957IN list, 958inefficiently written queries, 957manual collection of statistics
required, 950normal mode, 994Optimizer operations, 947–949Oracle plan stability feature, 969query rewriting, materialized
views, 210selectivity, 957setting Optimizer level, 946–947setting Optimizer mode, 945–946SQL transformation, 947statistics not collected, 955storing Optimizer statistics, 950tuning mode, 994–995understanding logic of, 974using EXPLAIN PLAN tool,
974–979using hints to influence execution
plan, 959using OEM to collect Optimizer
statistics, 956using stored outlines to stabilize
CBO, 969–971views in query, 957WHERE clauses illustrating
function of, 957cd command, UNIX, 48, 62cdump administrative directory, 285centralized configuration, 392centralized user authorization, 476certification, DBA, 11ch command, UNIX, 46chains, Oracle Scheduler, 865,
871–873change-based recovery, 718, 721CHANGE command, SQL*Plus, 519change management, 6, 825, 896CHANGE procedure, 1152change tracking file/writer, 119, 677channel configuration, RMAN, 666channels
automatic channel allocation, 656channel configuration, RMAN,
656, 666, 667character data types, 1185character large objects (CLOBs), 40
■INDEX1222
character sets, 364character special files, UNIX, 57CHECK constraint, 204check constraints, 37checklist (preinstallation)
see preinstallation checkscheckpoint (CKPT) process
background processes, 114, 116Oracle Service thread, 915
checkpoint completed wait event,1048
checkpoint not complete messages,1059
checkpointingautomatic checkpoint tuning, 141,
810Fast Start Checkpointing, 701logging checkpointing activity, 356managing/monitoring database,
144checksumming, 355, 692CHECKSYNTAX parameter, 654CHECK_DB function, 1150CHECK_EXTERNAL function, 1151CHECK_OBJECT procedure, 1161Chen, Peter, 25chgrp command, UNIX, 61child processes, UNIX, 54Childs, D.L., 20chmod command, UNIX, 60–61, 70,
70CJQO (job queue coordination)
process, 114, 118classes
object database model, 39CLEAR command, SQL*Plus, 505client authentication, 486client host server, 681client process
Data Pump utilities, 598client software
Instant Client software, 399–400Oracle Client software, 397–399
client/server modeldatabase connectivity, 391
CLIENT_IDENTIFIER attribute, 989CLIENT_ID_STAT_DISABLE
procedure, 1148CLIENT_ID_TRACE_ENABLE
procedure, 990CLOB data type, 1185Clone Database tool, 894cloning, 726–730
Oracle software cloning, 894manually, 729–730using Database Control, 727–729using RMAN, 727
closed backups, 634making whole closed backups,
687–688closed recovery, 704CLOSE_WINDOW procedure, 879Cluster Synchronization Service,
785–787Cluster wait class, 1035
clusters, 195–196COALESCE function, 1193COALESCE PARTITION clause, 192Codd, E.F., 20, 30cold backups, 634, 687–688collection types, ORDBMS model, 40collections, 1202COLSEP variable, SQL*Plus, 500COLUMN command, SQL*Plus, 512column-level object privileges, 447column-level security, 208column-level VPD, 460–461COLUMNARRAYROWS parameter,
555columns
adding to tables, 179choosing data types, 36clearing, 505DBA_COLUMNS view, 224DBA_TAB_COLUMNS view, 193,
224dropping from tables, 179indexing strategy, 963listing columns and specifications,
509ordering in tables, 20renaming table columns, 180showing properties of, 512
COM Automation, 910, 911COM+, distributed transactions, 911command files, SQL*Plus, 514–518command interpreters, UNIX, 46command line
arguments, UNIX, 69Data Pump utilities using, 598options, SQL*Plus, 504–505parameters, SQL*Loader, 547, 550utilities, Data Pump components,
592commands
lsnrctl commands, 402–403UNIX shell scripts, 68–74
COMMENT parameter, 433comments
adding to scripts, SQL*Plus, 522init.ora file, 377server parameter file, 377using in SQL*Plus, 517
COMMENTS attribute, 868COMMIT keyword, 523commit method, conn class, 419COMMIT statement, 226–227
AUTOCOMMIT variable, 227executing SQL statements, JDBC,
418implicit commit, 226transaction control statements,
148transactions, 226
Commit wait class, 1035COMMIT_SCN/TIMESTAMP
columnsFLASHBACK_TRANSACTION_
QUERY view, 262COMMIT_WRITE parameter, 227
common manageabilityinfrastructure, 141–143
communication protocol, 394compaction phase, 807Companion CD
Oracle Enterprise Editionsoftware, 301
Compare Periods Report, 1076–1078comparison operators, 1189
WHERE clause, 1186COMPATIBLE parameter, 338
database compatibility level, 318Pre-Upgrade Information Tool, 317setting up Oracle Streams, 585
complete recovery, 705COMPLETE refresh option, 211components
PRODUCT_COMPONENT_VERSION view, 1085
removing Oracle components, 930composite indexes, 196
guidelines for use of indexes, 197composite partitioning, 189–190COMPOSITE_LIMIT resource
parameter, 427comprehensive analysis mode, 808COMPRESS keyword, 968compressed backups, RMAN, 678compression
UTL_COMPRESS package, 1148COMPRESSION parameter
Data Pump utilities, 602compression techniques, 968COMPUTE command, SQL*Plus, 513CONCAT function, 1191CONCATENATE clause, SQL*Loader,
544concatenated indexes, 196
using appropriate index types, 964concurrency
see data concurrencyconditional branching, UNIX, 71conditional control, PL/SQL, 1205configuration
iSQL*Plus, 527–528RMAN configuration parameters,
664–668Select Configuration Options
window, 306configuration management
OEM Grid Control, 905–906Oracle Configuration
Management Pack, 825, 896Windows registry, 920
Configuration wait class, 1035CONFIGURE commands, RMAN,
665–668CHANNEL, 667DEFAULT DEVICE TYPE TO, 666DEVICE, 667RETENTION POLICY, 665–666
CONNECT BY clause, 1194CONNECT CATALOG command,
RMAN, 669CONNECT command, iSQL*Plus, 529
■INDEX 1223
CONNECT command, SQL*Plus, 493connect descriptors, 394connect identifiers
net service names, 405Oracle networking, 395
CONNECT privilege, 423, 442connect strings
Oracle networking, 395TWO_TASK environment variable,
399connection architecture, 392connection pooling, 114connections
concurrent connection requests,403
connecting to Oracle database,492, 493
connecting to RMAN, 651–653connectionless SQL*Plus session,
494database links, 858–860modifying tnsnames.ora manually,
406–407naming repositories, 405OID making, 414securing network, 485V$SESSION_CONNECT_INFO
view, 1121connectivity
see also JDBC; Oracle networkingbackground, 391client/server model, 391connect descriptors, 394connect identifiers, 395connect strings, 395establishing Oracle connectivity,
396–397how web applications connect to
Oracle, 393Instant Client software, 399–400naming and connectivity, 405–416
directory naming method,412–416
easy connect naming method,410–411
external naming method, 412local naming method, 405–410tnsnames.ora file, 405
Oracle Client software, 397–399Oracle database connectivity, 419Oracle Internet Directory, 413Oracle Net GUI and command-
line tools, 396Oracle Net Services, 391
CONNECT_IDENTIFIER variable,SQL*Plus
predefined variables, 517showing instance name in prompt,
508CONNECT_TIME parameter, 427CONNECT_TIME_FAILOVER
parameter, 403consistency
see data consistencyconsistent database backups, 633
consistent gets, 1016constraints
CHECK constraint, 204database integrity constraints,
202–207DBA_CONSTRAINTS view, 224,
1105DBA_CONS_COLUMNS view, 1106domain constraints, 37dropping tables, 182entity-relationship modeling, 36integrity constraints, 205NOT NULL constraint, 204primary key constraint, 203referential integrity constraints,
205removing tablespaces, 160SQL*Loader direct-path loading,
556temporary tables, 183UNIQUE constraint, 204
CONSTRAINTS parameterData Pump utilities, 603
consumer group switching, 436consumer groups
see resource consumer groupsCONSUMER_GROUP parameter, 433consumption, Oracle Streams, 585CONTENT parameter, Data Pump
utilities, 603, 613, 616context sensitive security policy, 459contexts, 415continuation characters, SQL*Plus,
495CONTINUEIF clause, SQL*Loader,
545CONTINUE_CLIENT command
Data Pump utilities, 611–612, 621CONTINUOUS_MINE procedure, 736control files, 108
backups, 134, 635, 641, 668,679–680
backups, RMAN, 674, 668configuration parameters
contained, 334CONTROLFILE REUSE clause, 364database files, 286database integrity, 108default file locations, 644description, 107flash recovery area, 644identifying files for recovery, 709making whole closed backups, 688managing RMAN, 651multiplexing, 339naming conventions, 286Oracle Managed Files, 802recovering from loss of, 722–725redo log files, 108RMAN repository data (metadata),
668system change number, 108V$CONTROLFILE view, 1141
CONTROL parameter, SQL*Loader,548
control structures, PL/SQL, 1205CONTROLFILE AUTOBACKUP
optionCONFIGURE command, RMAN,
668CONTROLFILE REUSE clause, 364controllers, disk I/O, 1030CONTROL_FILES parameter, 339CONTROL_FILE_RECORD_KEEP_
TIME parameter, 340conversion functions, 1185CONVERT TABLESPACE command
converting data files to matchendian format, 629
COPY command, RMAN, 661, 671COPY command, SQL*Plus, 522–523copying files
copying files with database server,860–862
image copies, RMAN, 655making copies of RMAN backups,
657managing Oracle on Windows and
UNIX, 918copying files, UNIX, 59
copying files to/from anothersystem, 78
COPY[COMMIT] variable, SQL*Plus,500
COPY_FILE procedure, 860, 1146COPY_TABLE_DEPENDENTS
procedure, 816coraenv script, 311core dump directory, 112CORE_DUMP_DEST parameter, 112,
340correlated subqueries, 1200corruption
benefits of RMAN, 648checksumming, 355, 692database checking for corrupted
data blocks, 355database corruption detection,
692–694monitoring and verifying RMAN
jobs, 678online redo logs, 857parameter enabling detection of,
355repairing corrupted data blocks,
753RMAN detecting, 679
cost-based optimizersee CBO
cost-based query optimization,940–942
COUNT function, 1191cp command, UNIX, 59, 631cpio command, UNIX, 76CPU performance
analyzing instance before tuning,1074
evaluating system performance,1024–1029
managing Oracle on Windows andUNIX, 917
■INDEX1224
CPU resource allocation methodcreating plan directives, 436, 437Database Resource Manager, 432
CPU usagecost model of Oracle Optimizer,
952CPU units used by processes, 1025Database Control home page, 891DBA_CPU_USAGE_STATISICS
view, 1105determining session-level CPU
usage, 1026finding SQL that uses most
resources, 993intensive CPU usage causes, 1025
reducing, 1028parse time CPU usage, 1027performance monitoring, UNIX,
79vmstat utility, 81
recursive CPU usage, 1029run queue length, 1025sar command output showing,
1024SQL Trace tool showing, 984system usage problems, 1059uses of CPU time, 1026–1027
CPUSPEED mode, 953CPUSPEEDNW mode, 953CPU_MTH parameter, 433, 436CPU_PER_CALL parameter, 427CPU_PER_SESSION parameter, 427crash recovery, 701–702create administrative directory, 285CREATE CATALOG command, 670CREATE DATABASE command, 364CREATE GLOBAL SCRIPT command,
654CREATE INDEX statement, 199CREATE MATERIALIZED VIEW
statement, 214CREATE ROLE privilege, 450CREATE SCHEMA statement, 148CREATE SCRIPT command, 653CREATE SESSION privilege, 423CREATE SYNONYM command, 220CREATE TABLE statement, 562CREATE TYPE command, 1202CREATE USER RMAN command, 669CREATE USER statement, 422–425createStatement method, conn class,
417CREATE_CHAIN procedure, 872CREATE_EDIT_TABLES procedure,
1163CREATE_JOB procedure, 867, 874CREATE_JOB_CLASS procedure, 875CREATE_POLICY_GROUP procedure,
459CREATE_PROGRAM procedure, 869CREATE_SCHEDULE procedure, 870CREATE_STORED_OUTLINES
parameter, 970CREATE_TASK procedure, 770
CREATE_TUNING_TASK procedure,997, 1181
CREATE_WINDOW procedure, 877credentials, setting for job system,
923Critical Patch Updates, 486critical threshold, 832critical_value attribute, 163crontab command, UNIX, 76CROSSCHECK command, RMAN,
662, 664monitoring and verifying RMAN
jobs, 679out-of-space warning and critical
alerts, 647cryptography
DBMS_CRYPTO package, 1155csh (C shell), 45, 55cshrc (.cshrc) file, 55CSS (Cluster Synchronization
Service), 785–787CTAS (CREATE TABLE AS SELECT)
command, 181deriving data from existing tables,
570LONG columns, 522using with large tables, 522
CUBE operator, GROUP BY clause,1198
cumulative backup, RMAN, 660cumulative statistics, 824current incarnation, database, 720current_user attribute
USERENV namespace, 455currval pseudo-column, 222cursors, 1207–1209
cursor attributes, 1208cursor variables, 1209description, 1207explicit cursors, 1207FOR loop, 1209implicit cursors, 1207OPEN_CURSORS parameter, 128Oracle SQL transaction stages, 231parameter setting number of open
cursors, 342reusing open cursors, 1013
CURSOR_SHARING parameter, 351optimizing library cache,
1010–1011sharing SQL statements, 1013
CURSOR_SPACE_FOR_TIMEparameter, 351
early deallocation of cursors, 1013optimizing library cache, 1012
custom optioninstalling Oracle Client, 398
cut command, UNIX, 66
Ddaemons, 915data
modifying data on disk, 115Oracle DBA’s role, 3separating table and index data,
104
data accessapplication contexts, 456column-level VPD, 460–461fine-grained access control,
456–460methods, 909–910
data access, controlling, 442–461application contexts, 454
creating, 456creating package to set context,
455–456definer’s rights, 448fine-grained data access, 453–461
application context, 454–456column-level VPD, 460–461fine-grained access control,
456–460granting object privileges, 446invoker’s rights, 448object privileges, 445–448privileges, 442–449revoking object privileges, 448roles, 449–452system privileges, 442–445
data blocks, 100–103bigfile tablespaces, 169bitmaps, 106changing block size, 352checking for corrupted, 355choosing size of, 100
Oracle guidelines, 101creating tablespaces with
nonstandard, 159DB_BLOCK_CHECKING
parameter, 356detecting data block corruption,
692dumping block contents, 102identifying file and block IDs, 102inner workings, 101multiple data block sizes, 101
buffer cache and, 123online database block size
changes, 820–821operating system disk block size,
101parameter setting block size, 351parameter specifying maximum
number read, 352querying data, 351repairing corrupted data blocks,
753space management, 152tablespaces and block sizes, 105using multiple block size feature,
159verification parameters, 355–356
data concurrency, 131concurrency control, 235–243Concurrency wait class, 1035data consistency and, 235isolation levels, 231–232locking, 131, 229, 235managing long transactions, 273optimistic/pessimistic locking, 235
■INDEX 1225
Oracle lock types, 237Oracle’s multiversion system, 236problems relating to, 229–230
dirty reads, 229lost-updates, 230nonrepeatable-read problem,
230phantom reads, 230
time-stamping methods, 235transaction concurrency control,
229–230data consistency, 131
data concurrency and, 235read consistency, 131statement-level read consistency,
234undo data providing, 243–254
transaction concurrency control,229
transaction-level read consistency,234
transactions and, 228, 130undo management, 133undo segments, 131
data definition (DDL) statements, 148data dictionary, 135–136
see also dictionary-managedtablespaces
accessing, 135accessing data dictionary tables,
1084AWR collecting statistics, 834changing data in, 136collecting data dictionary
statistics, 954–955collecting real dictionary table
statistics, 954creating data dictionary objects,
368–369creation of, 1084data dictionary tables, 1083data dictionary views for
managing tables, 192–195viewing object information,
224DBA views for managing
users/roles/privileges, 452described, 124, 136introduction, 1083LogMiner utility extracting,
733–734metadata, 1083–1084monitoring database status,
387–388owner of data dictionary tables,
136protecting data dictionary, 484recursive SQL, 106remembering data dictionary
tables, 1085views for managing tablespaces,
174–175DBA_DATA_FILES, 174DBA_FREE_SPACE, 175
DBA_SEGMENTS, 175DBA_TABLESPACES, 174managing undo space
information, 253data dictionary cache
parameter setting shared pool size,345
shared pool, 125tuning shared pool, 1006–1007V$ROWCACHE view, 1119
data dictionary viewsADDM, 773alerts and metrics, 833–834ALL, DBA, and USER prefixes, 1084data dictionary (DBA_*) views
see DBA viewsdata dictionary (non DBA_*) views
Dict view, 1085FLASHBACK_TRANSACTION_
QUERY, 1089GLOBAL_NAME, 1085INDEX_STATS, 1107NLS_DATABASE_
PARAMETERS, 1086NLS_INSTANCE_
PARAMETERS, 1086NLS_SESSION_PARAMETERS,
1086Plan table, 1087PRODUCT_COMPONENT_
VERSION, 1085ROLE_ROLE_PRIVS, 1093ROLE_SYS_PRIVS, 1094ROLE_TAB_PRIVS, 1094
managing advisory framework,853
managing AWR statistics with, 844managing Database Resource
Manager, 441static views, 1084using dictionary views for SQL
tuning, 994viewing as DBA, 1084viewing user-owned objects, 1084viewing user privileged objects,
1084data encryption, 477–482
ENCRYPT keyword, 478transparent data encryption, 477
data extraction, transformation, andloading
see ETLdata files
backing up with RMAN, 675creating tablespaces, 154data file backup, 634DBA_DATA_FILES view, 1102description, 107determining the size of, 174dropping data file, 703expanding tablespaces, 160flash recovery area, 641making whole closed backups, 687monitoring I/O, 117
naming conventions, 286Oracle data files, 108, 282Oracle Managed Files, 173, 803parameter specifying location for,
341partial database backups, 690recovering data files, 715–717recovering data files without
backup, 725–726tablespaces and, 112V$DATAFILE view, 1140
DATA function, UTL_SMTP, 1172Data Guard
see Oracle Data Guarddata integrity, 36data loading, 6data manipulation statements, 147
using views, 208data modeling
see entity-relationship modelingDATA parameter, SQL*Loader, 548data protection
enhanced for disaster recovery,695–697
Oracle Data Guard, 697Oracle Streams, 584
Data Pump Export and Importutilities, 139, 589–630
accessing expdp and impdp, 590benefits of, 590–591components, 592data access methods, 592–593Data Pump API, 622–623, 1180Data Pump files, 593–596Data Pump privileges, 596DBA_DATAPUMP_JOBS view, 621,
1091DBA_DATAPUMP_SESSIONS view,
622, 1091DBA_EXP_FILES view, 1089description, 706directory objects, using, 593–596dpdump administrative directory,
285export commands, 612
ADD_FILE, 611–613, 621CONTINUE_CLIENT, 611–612EXIT_CLIENT, 612HELP, 612KILL_JOB, 612–613PARALLEL, 612START_JOB, 611–612STATUS, 612STOP_JOB, 612
export examples, 613–614export methods, 598–599export modes, 600export parameters, 601, 613
ATTACH, 609–611COMPRESSION, 602CONSTRAINTS, 603CONTENT, 603DIRECTORY, 601DUMPFILE, 601
■INDEX1226
ENCRYPTION_PASSWORD,607
ESTIMATE, 605ESTIMATE_ONLY, 606estimation parameters,
605–606EXCLUDE, 603–604export filtering parameters,
603–605export mode–related
parameters, 602file- and directory-related
parameters, 601–602FILE, 601FILESIZE, 602FLASHBACK_SCN, 608FLASHBACK_TIME, 608GRANTS, 603INCLUDE, 603–604INDEXES, 603interactive mode export
parameters, 609–613job-related parameters,
607–609JOB_NAME, 607LOGFILE, 602network link parameter, 606NETWORK_LINK, 606–607NOLOGFILE, 602PARALLEL, 609PARFILE, 602QUERY, 604SAMPLE, 605STATUS, 607TRANSPORT_FULL_CHECK,
602export prompt, 599import commands
CONTINUE_CLIENT, 621EXIT_CLIENT, 621HELP, 621KILL_JOB, 621PARALLEL, 621START_JOB, 621STATUS, 621STOP_JOB, 621
import parameters, 614–621CONTENT, 616DIRECTORY, 615EXCLUDE, 616file- and directory-related
parameters, 615–616filtering parameters, 616–617flashback parameters, 621FLASHBACK_SCN, 621FLASHBACK_TIME, 621import mode–related
parameters, 617INCLUDE, 616interactive import parameters,
621job-related parameters, 617NETWORK_LINK, 619–620QUERY, 617remapping parameters, 618
REMAP_DATAFILE, 618REMAP_SCHEMA, 618REMAP_TABLESPACE, 618REUSE_DATAFILES, 616SQLFILE parameter, 615–616TABLE_EXISTS_ACTION, 617TRANSFORM, 618–619TRANSPORT_DATAFILES, 617TRANSPORT_FULL_CHECK,
617TRANSPORT_TABLESPACES,
617import prompt, 599import types and modes, 614interactive mode export
parameters, 609–613introduction to technology,
589–598logical backups, 634managing/monitoring database,
144manual upgrade process, 316monitoring Data Pump jobs,
621–622performing exports and imports,
598–621processes of Data Pump job,
597–598read-only database, 607roles, 612transportable tablespaces,
623–630exporting metadata using Data
Pump, 628importing metadata using Data
Pump, 630uses for, 591–592using Data Pump API, 622–623V$SESSION_LONGOPS view, 622
data redefinition, 812–818data reorganization, 811–812data replication, Oracle Streams, 584data transfer element (dte), 685data types
abstract data types, 1201–1203columns, 36Oracle data types, 1185–1186ORDBMS model, 40SQL*Loader control file, 546user-defined object types, 149XMLType, 1211
data validity, 37data warehouses
Automatic Workload Repository,142
Bitmap join indexes, 960extraction, transformation, and
loading of data, 540indexing strategy, 962loading, Oracle Streams, 584program global area, 120
database access, 382see also data access
database administration commands,SQL*Plus, 524
database administratorsee DBA
database architecture, Oracle, 99–112database auditing
see auditingdatabase authentication, 471–475
see also authenticationencrypted passwords, 474locking accounts, 472managing passwords, 471password expiration, 473password file, 473
database authorizationsee authorization
database availability, 105database backups
see backupdatabase buffer cache
see buffer cachedatabase compatibility level
COMPATIBLE parameter, 318Database Configuration Assistant
see DBCAdatabase connections
see connectionsdatabase connectivity
see connectivityDatabase Control, OEM
see OEM Database Controldatabase corruption detection
detecting data block corruption,692–694
detecting media corruption, 692setting initialization parameters,
692using ANALYZE command, 693using DBMS_REPAIR package, 694using DBVERIFY utility, 693
database creation, 329–373authorizations, 332choosing location for files, 332creating file system, 330–332creating parameter file, 333–358DBA database design role, 7memory allocation, 332preparation for, 329–332setting OS environment variables,
332sizing file system, 330–331using SQL*Plus statements,
358–373changing archive logging
mode, 371–373changing passwords for all
default users, 371creating additional
tablespaces, 369–370creating data dictionary
objects, 368–369creating init.ora file, 359–361creating Oracle Database 10g
database, 364–367privileges, 359quick way to create database,
368–369
■INDEX 1227
running pupbld.sql file, 373setting OS variables, 358–359starting Oracle instance,
361–363using Oracle Managed Files,
803–806Database Credentials window
upgrading with DBUA, 321database design
business rules, 36implementing, 37logical database design, 24–34Oracle DBA’s role, 3, 7–8physical database design, 34–37
database failures, 699–701database files, 286
creating directories for, 287making transactions permanent,
115naming conventions, 286
database hangs, 1058–1065abnormal increase in process size,
1061archiver process stuck, 1058–1059bad statistics, 1062collecting information during,
1063locking issues, 1060severe contention for resources,
1060shared pool problems, 1062system usage problems, 1059using Hang Analysis page, 1063
gathering error messages, 1063getting systemstate dump, 1064using Hanganalyze utility, 1065
database hit ratios, 1033database incarnations, 720database instance names, 394database instances
altering properties of, 146creating database, 364database consistency on restart,
117memory allocation, 121object database model, 39parameter specifying type, 338V$INSTANCE view, 1131
database integrity, 202–207constraint commands, 206control file, 108deferrable constraints, 207immediate constraints, 207integrity constraints, 205, 206, 207parameter enforcing integrity
rules, 350referential integrity constraints,
205RELY constraints, 206
database links, 858–860Database Control, 860, 896DBA_DB_LINKS view, 1108Grid Control, 907private database links, 858–859public database links, 859–860
database loadanalyzing instance before tuning,
1075database management
see OEMdatabase metrics, 826–828
data dictionary views–related,833–834
metric groups, 826thresholds, 828views-related, 1135–1136
database models, 38database mounted statement, 367database names, 394database objects
aliases for, 220creation, design role in, 7DBA_OBJECTS view, 224, 1091initial extent, 103object database model, 39segments and, 104storage allocation to database
objects, 158V$DB_OBJECT_CACHE view, 1119viewing object information, 224
database operationssee processes
database parameter filessee parameter files
Database Performance pageOEM Database Control, 892, 893,
1068–1071database quiescing, 821–822database recovery
see recoverydatabase reorganization, 811–812Database Resource Manager, 431–442
activating, 440creating/editing/deleting resource
plans, 442data dictionary views managing,
441deactivating, 441dynamic resource management,
818–820enabling, 441estimating operation execution
time, 820managing resource consumer
groups, 442managing resources for users, 430managing undo space
information, 253OEM administering, 441–442Oracle database, 140pending area
creating, 433submitting, 438validating, 437
plan directives, 819privileges for, 432resource allocation methods, 432resource consumer groups, 431
assigning users to, 438–440creating, 433–435
resource management, 430resource plan directive, 432resource plans, 431
creating, 436creating plan directives,
436–437setting active session pool, 819setting limits on execution times,
819using, 432–440using Resource Monitors page, 441
database schema, 21database security
see securitysee also authentication; passwords
database servercopying files with, 860–862
database service names, 394database sizing, 37database storage
see storagedatabase triggers
see triggersdatabase types, 8–9Database Upgrade Assistant
see DBUAdatabase usage metrics, 898Database Usage Statistics property
sheet, 898database wait statistics
see wait statisticsdatabase writer (DBWn) process
background processes, 114–115database buffer cache, 131Oracle Service thread, 915write ahead protocol, 132writing dirty data in memory
buffers to disk, 116databases
see also Oracle Database 10g;relational databases
administering with ORADIMutility, 926–928
auditing database usage, 461–471backing up databases
see backupcloning a database, 726–730
manually, 729–730using Database Control,
727–729using RMAN, 727
connecting to, 137creating databases
see database creationcreating parameter file, 333–358creating stored outlines for, 970database-related parameters,
337–339described, 99dropping, 386–387maintenance outside normal
window, 385–386managing on Linux systems, 933monitoring database status,
387–388
■INDEX1228
Oracle XML DB, 1210–1214quiescing, 385–386recovering Oracle databases
see recoveryrecovering, SQL*Plus, 524restricting access, 382–383reverse engineering, 38shutting down from SQL*Plus,
383–385shutting down with Windows,
925–926starting up automatically, 380–381starting up from SQL*Plus,
378–380starting up in restricted mode, 382starting up with Windows, 925–926suspending, 386variable naming database, 517
DATABASE_PROPERTIES viewbigfile tablespaces, 171monitoring instance status, 388
datasetsperforming backups with Oracle
Backup, 686DATA_CACHE parameter,
SQL*Loader, 555DATA_DUMP_DIR variable, 595–596date and time data types, 1185date command, UNIX, 48DATE data type, 1185DATE variable, SQL*Plus, 517dates
specifying default date format, 339DB block gets, 1016db file scattered read wait event,
1038–1039, 1048, 1074db file sequential read wait event,
1037–1040, 1049, 1074DB time statistic, 760DB value, AUDIT_TRAIL parameter,
462DBA (database administrator)
background and training, 9–11operating system knowledge,
12UNIX knowledge, 12
certification, 11Oracle Certified Associate, 11Oracle Certified Master, 12Oracle Certified Professional,
11connecting to Oracle database,
493daily routine, 15–16database design role, 7–8development DBA, 8multiple DBAs, 484Oracle classes, 10Oracle DBA’s role, 3–8performance tuning, DBA
strategies forsee under performance tuning
production DBA, 8reducing vulnerability with
recoveries, 706
resources, 13–14International Oracle Users
Group, 13MetaLink, 14Oracle by Example, 14Oracle DirectConnect, 15Oracle Technology Network, 13
security role, 4–5managing users, 4monitoring system, 4protecting database, 4
some general advice, 16–17system management role, 5–6
backup strategies, 6change management, 6estimating requirements, 6loading data, 6minimizing downtime, 5performance tuning, 5recovery strategies, 6troubleshooting, 5
varying organizational roles, 8DBA views
DBA_ADVISOR_ACTIONS, 773,853, 1115
DBA_ADVISOR_DEFINITIONS,1113
DBA_ADVISOR_DEF_PARAMETERS, 764
DBA_ADVISOR_FINDINGS, 773,853, 1114
DBA_ADVISOR_LOG, 1115DBA_ADVISOR_PARAMETERS,
853DBA_ADVISOR_RATIONALE, 773,
1115DBA_ADVISOR_RECOMMENDA-
TIONS, 773, 853, 1115DBA_ADVISOR_TASKS, 853, 1114DBA_ADVISOR_USAGE, 1113DBA_ADVISOR_XYZ views, 998DBA_ALERT_HISTORY, 833, 1112DBA_ALL_TABLES, 1109DBA_AUDIT_EXISTS, 1099DBA_AUDIT_OBJECT, 1099DBA_AUDIT_POLICIES, 1099DBA_AUDIT_POLICY_COLUMNS,
1099DBA_AUDIT_SESSION, 1099DBA_AUDIT_STATEMENT, 1099DBA_AUDIT_TRAIL, 463, 471,
1099DBA_AUTO_SEGADV_CTL, 1114DBA_AUTO_SEGADV_SUMMARY,
1114DBA_BLOCKERS, 239, 242, 1097DBA_CATALOG, 224, 1085DBA_COLUMNS, 224DBA_COL_PRIVS, 1096DBA_COMMON_AUDIT_TRAIL,
1099DBA_CONSTRAINTS, 224, 1105DBA_CONS_COLUMNS, 1106DBA_CPU_USAGE_STATISICS,
1105
DBA_DATAPUMP_JOBS, 621, 1091DBA_DATAPUMP_SESSIONS, 622,
1091DBA_DATA_FILES, 174, 1102DBA_DB_LINKS, 1108DBA_DIRECTORIES, 1089DBA_ENABLED_TRACES, 991DBA_ENCRYPTED_COLUMNS,
1097DBA_EXP_FILES, 1089DBA_EXTENTS, 1100DBA_EXTERNAL_TABLES, 1109DBA_FEATURE_USAGE_
STATISTICS, 1088DBA_FGA_AUDIT_TRAIL, 1099DBA_FREE_SPACE, 175, 739, 1101DBA_HIGH_WATER_MARK_
STATISTICS, 1088DBA_HIST_ACTIVE_SESS_
HISTORY, 846, 1041, 1113DBA_HIST_BASELINE, 845DBA_HIST_SNAPSHOT, 845DBA_HIST_SYSMETRIC_
HISTORY, 833DBA_HIST_WR_CONTROL, 845DBA_HIST_XYZ, 827DBA_INDEXES, 224, 1106DBA_IND_COLUMNS, 1106DBA_JOBS, 1090DBA_LOCKS, 1104DBA_MVIEWS, 1111DBA_OBJECTS, 224, 1091, 1108DBA_OUTLINES, 1098DBA_OUTLINE_HINTS, 1098DBA_OUTSTANDING_ALERTS,
647, 833, 1112DBA_PART_TABLES, 224, 1109DBA_POLICIES, 1096DBA_PROFILES, 1092DBA_RECYCLEBIN, 1089DBA_REDEFINITION_ERRORS,
817DBA_REGISTRY, 315, 1085DBA_RESUMABLE, 273DBA_ROLES, 1093DBA_ROLLBACK_SEGS, 250, 253DBA_RSRC_CONSUMER_
GROUPS, 434DBA_RSRC_CONSUMER_
GROUP_PRIVS, 441DBA_RSRC_PLANS, 441, 1098DBA_SCHEDULER_JOBS, 881,
943, 1090DBA_SCHEDULER_JOB_LOG, 881,
1090DBA_SCHEDULER_JOB_RUN_
DETAILS, 881, 1090DBA_SCHEDULER_PROGRAMS,
1090DBA_SCHEDULER_RUNNING_
JOBS, 881, 1090DBA_SCHEDULER_SCHEDULES,
881, 1090DBA_SCHEDULER_WINDOWS,
1090
■INDEX 1229
DBA_SEC_RELEVANT_COLUMNS,1097
DBA_SEGMENTS, 175, 1101DBA_SEQUENCES, 224, 1108DBA_SERVER_REGISTRY, 315, 327DBA_SOURCE, 1087DBA_SQLSET, 1112DBA_SQLSET_PLANS, 1112DBA_SQLSET_STATEMENTS, 1112DBA_SQLTUNE_PLANS, 1112DBA_SQLTUNE_STATISTICS, 1112DBA_SQLTUNE_XYZ views, 998DBA_SYNONYMS, 224, 1108DBA_SYS_PRIVS, 1095DBA_TABLES, 192, 224, 1108DBA_TABLESPACES, 174, 224, 253,
1103DBA_TABLESPACE_GROUPS, 168,
1104DBA_TAB_COLUMNS, 193, 224,
1110DBA_TAB_COL_STATISTICS, 945DBA_TAB_MODIFICATIONS, 943,
1110DBA_TAB_PARTITIONS, 192, 1109DBA_TAB_PRIVS, 1095DBA_TEMP_FILES, 1103DBA_THRESHOLDS, 833, 834,
1112DBA_TRIGGERS, 224, 1108DBA_UNDO_EXTENTS, 254, 1104DBA_USERS, 168, 1091DBA_VIEWS, 1110DBA_WAITERS, 1097, 1104
DBAsupport.com, 14DBCA (Database Configuration
Assistant)accessing from UNIX/Linux, 329Automatic Undo Management
using, 246benefits of using, 329creating Sysaux tablespace, 172managing/monitoring database,
144dbconsole process, 889, 925DBIO_EXPECTED parameter, 764DBMS packages
DBMS_ADVISOR, 1180invoking SQL Access Advisor,
219managing advisory framework,
850–852procedures and functions, 770QUICK_TUNE procedure, 219using with ADDM, 765, 770
DBMS_APPLICATION_INFO,1153–1154
DBMS_AQ, 832DBMS_AQADM, 832DBMS_CRYPTO, 477, 1155DBMS_DATAPUMP, 592, 622, 1180DBMS_ERRLOG, 1167–1168DBMS_FGA, 469, 470, 1176DBMS_FILE_TRANSFER, 823,
860–862, 1146–1148
DBMS_FLASHBACK, 256–257,1178–1179
DBMS_JOB, 863, 864, 1151–1153DBMS_JOBS, 139DBMS_LOGMNR, 1179–1180
ADD_LOGFILE procedure, 735CONTINUOUS_MINE
procedure, 736PRINT_PRETTY_SQL
procedure, 736sample LogMiner session, 734
DBMS_METADATA, 194, 592, 1178DBMS_MONITOR, 989–990, 1046,
1148DBMS_MVIEW, 212, 1177DBMS_OBFUSCATION_TOOLKIT,
477DBMS_OLAP, 969, 1177DBMS_OUTLN, 1162–1163DBMS_OUTLN_EDIT, 1162–1163DBMS_OUTPUT, 1159DBMS_PROFILER, 1165–1167DBMS_REDEFINITION, 814, 1178DBMS_REFRESH, 1181DBMS_REPAIR, 694, 752,
1160–1161DBMS_RESOURCE_MANAGER,
432, 436, 438, 1176DBMS_RESUMABLE, 272, 1105,
1176–1177DBMS_RLMGR, 1175DBMS_RLS, 459, 1176DBMS_RULE_ADM, 872DBMS_SCHEDULER, 139, 1178
administering programs, 870administering Scheduler jobs,
868administering schedules, 871altering common component
attributes, 880creating event-based
schedules, 873creating job classes, 875creating Scheduler chains, 872creating Scheduler jobs, 867creating Scheduler programs,
869creating Scheduler schedules,
870creating Scheduler windows,
877managing job classes, 875managing Scheduler windows,
878Oracle Scheduler, 863retrieving attributes, 880unsetting component
attributes, 880DBMS_SERVER_ALERT, 162, 831,
832, 1180DBMS_SERVER_REGISTRY, 326DBMS_SESSION, 990, 1155–1156DBMS_SHARED_POOL, 1014,
1173–1174
DBMS_SPACE, 177, 198,1163–1164
DBMS_SPACE_ADMIN, 799,1164–1165
DBMS_SQLTUNE, 997–998, 1181DBMS_STATS, 1175–1176
automatic optimizer statisticscollection, 781
gathering statistics, 944, 949GATHER_XYZ_STATS
procedures, 950manually collecting Optimizer
statistics, 783, 949–952DBMS_STORAGE_MAP, 117, 1182DBMS_SYSTEM, 1046, 1156–1159DBMS_TDB, 1150–1151DBMS_TTS, 1181DBMS_UTILITY, 1181DBMS_WM, 1174DBMS_WORKLOAD_REPOSITORY,
764, 836, 1181DBMS_XPLAN, 976–977, 1182
dbshut scriptautomatic database startup, 380managing Oracle on UNIX, 917
DBSNMP accountchanging passwords for default
users, 371passwords, database
authentication, 471dbstart script
automatic database startup, 380managing Oracle on UNIX, 917
DBUA (Database Upgrade Assistant),315–316, 318–321
managing/monitoring database,144
Pre-Upgrade Information Tool, 316preinstallation checks, 316restoring pre-upgrade database,
321starting, 319
DBVERIFY utility, 693DB_BLOCK_CHECKING parameter,
355, 693DB_BLOCK_CHECKSUM parameter,
355, 692, 743DB_BLOCK_SIZE parameter, 351
choosing size of data blocks, 100multiple data block sizes, 101
buffer cache and, 123tablespaces with nonstandard
block size, 159using multiple block size feature,
159DB_CACHE_SIZE parameter, 123, 344
auto-tuned SGA parameters, 775multiple data block sizes, 123online database block size
changes, 820Oracle’s guidelines, 343tablespaces with nonstandard
block size, 159
■INDEX1230
DB_CREATE_FILE_DEST parameter,341
control file default locations, 644OMF file locations, 644OMF initialization parameters,
801–802, 804redo log file default locations, 645setting up flash recovery
parameters, 645DB_CREATE_ONLINE_LOG_DEST_n
parameter, 341control file default locations, 644flash recovery area file locations,
644OMF initialization parameters,
801, 803redo log file default locations, 645setting up flash recovery
parameters, 645DB_DOMAIN parameter, 337DB_FILES parameter, 340DB_FILE_MULTIBLOCK_READ_
COUNT parameter, 352,1030, 1048
DB_FILE_NAME_CONVERTparameter, 629, 630, 727
DB_FLASHBACK_RETENTION_TARGET parameter, 355,744, 747
DB_KEEP_CACHE_SIZE parameter,123, 344, 775
db_name attribute, USERENVnamespace, 455
DB_NAME parameter, 286, 337DB_nK_CACHE_SIZE parameter, 344
manually managed SGAparameters, 775
multiple data block sizes, 123online database block size
changes, 820DB_RECOVERY_FILE_DEST
parameter, 288, 354configuring flash recovery area,
643control file default locations, 644disabling flash recovery area, 644dynamically defining flash
recovery area, 643flash recovery area file locations,
644OMF initialization parameters, 801redo log file default locations, 645setting up flash recovery
parameters, 645synonym for flash recovery area,
644DB_RECOVERY_FILE_DEST_SIZE
parameter, 288, 354configuring flash recovery area,
643dynamically defining flash
recovery area, 643OMF initialization parameters, 801out-of-space warning and critical
alerts, 647
DB_RECYCLE_CACHE_SIZEparameter, 123, 344, 775
DB_UNIQUE_NAME parameter, 337DB_WRITER_PROCESSES parameter,
115, 342dd command, UNIX, 76, 631DDL (data definition language)
statements, 22changing data dictionary tables,
1083extracting object DDL using
DBMS_METADATApackage, 194
making DML changes permanentwith SQL*Plus, 523
resumable operations, 270transactions, 226
DDL locks, 238DDL triggers, 467deadlocks, 228, 235, 240decision support systems (DSSs), 9DECLARE statement, PL/SQL,
1203–1204, 1208DECODE function, 1193dedicated server architecture, 392default auditing, 463default buffer pool, 123, 1017–1018default device type, RMAN, 666DEFAULT DIRECTORY clause, 563default file location, 644default profile, 428–429default shell, UNIX, 46default tablespaces, 422, 423
caution: assigning specifictablespaces as, 422
default permanent tablespaces,168, 331, 365
default temporary tablespaces,165, 365
query showing tablespaces fornew user, 423
using bigfile tablespaces as, 170default users
changing passwords for, 371DEFAULTIF parameter, SQL*Loader,
556DEFAULT_CONSUMER_GROUP, 435deferrable constraints, 207DEFINE command, SQL*Plus, 516,
517definer’s rights, 448DEFINE_CHAIN procedure, 872DEFINE_CHAIN_RULE procedure,
872DEF[INE] variable, SQL*Plus, 500degree of parallelism, 436, 667DEL command, SQL*Plus, 520DELETE clause
MERGE statement, 573DELETE command, 1188
data manipulation statements, 147removing all data from tables, 180RMAN commands, 661
DELETE EXPIRED command, RMAN,647, 662
DELETE OBSOLETE command,RMAN, 662
DELETE_CATALOG_ROLE, 444DELETE_TASK procedure, 770deleting files, UNIX, 59deletion anomaly, 29DELIMITED BY clause, 562delimiters, SQL*Loader, 547delta values, 824denormalization, 34deployments, Grid Control, 906DESC keyword
ORDER BY clause, 1189DESCRIBE command, SQL*Plus, 193,
509listing procedures and functions
in packages, 1146design
see database designdev (/dev) directory, UNIX, 62development databases, 9development DBA, 8dev/null
input/output redirection, UNIX,56
device files, 62mapping files to physical devices
see file mapping featuredf command, UNIX, 80, 86diagnostics
see also ADDMdiagnostic tools, 918Oracle Diagnostics Pack, 824, 896performance/diagnostics-related
parameters, 349–353Diagnostics Summary section
Database Control home page, 891Dict view, 1085dictionary
see data dictionarydictionary cache
see data dictionary cachedictionary-managed tablespaces, 106,
150, 153see also data dictionary
diff command, UNIX, 53difference, relational algebra, 21differential backup, RMAN, 660DIRECT parameter, SQL*Loader, 549,
555Direct Path API, 592direct path read wait event, 1049direct path write wait event, 1049direct-path loading, SQL*Loader,
554–556DirectConnect, Oracle (ODC), 15directories
administrative directories, 285creating directories for database
files, 287DBA_DIRECTORIES view, 1089flash recovery area, 288integrating with Windows security
policies, 911mount points, 282
■INDEX 1231
naming conventions, 283OFA-compliant Oracle database,
287Oracle base, 283Oracle home, 283Oracle Inventory Directory, 284
directories, UNIX, 62cd command, 48creating, 62creating, preinstallation, 296file types, 57home directory, 46locating directory, 52navigating, 62permissions, 60pwd command, 49removing, 62system configuration files, 62
directory administration tools, 414Directory Information Tree (DIT), 414directory naming, 412–416
naming methods, 405OID making database
connections, 414directory naming context, 415directory naming method
Oracle Internet Directory, 413–414directory objects
creating external table layer, 563Data Pump files using, 593–596
DIRECTORY parameterData Pump utilities, 595, 596, 601,
615directory privileges, 446directory services
directory naming method, 412DIRECTORY_PATH parameter, 411dirty buffers, 121dirty reads, 233, 229DISABLE NOVALIDATE command,
206DISABLE procedure, 870, 879DISABLE VALIDATE command, 206disaster recovery
enhanced data protection for,695–697
DISCARD FILE parameter, 562DISCARD parameter, SQL*Loader,
549DISCARDMAX parameter,
SQL*Loader, 550DISCONNECT command, iSQL*Plus,
529discrete transactions, 267disk allocation/layout, OFA, 281Disk Based Backup and Recovery, 640disk cache for tape
flash recovery area, 641disk fragmentation, ASM, 784disk groups, ASM
see under ASMdisk I/O
see I/Odisk partitioning, UNIX, 87
disk storagenew storage technologies, 92–95Oracle Database 10g installation,
280preinstallation checks, 291
disk storage, UNIXavailability and performance, 86configuration choices, 85disk partitioning, 87disk striping, 87Logical Volume Manager, 87logical volumes, 87monitoring disk usage, 85performance monitoring, 80RAID systems, 88–92using file systems, 87
disk striping, UNIX, 87disks
cost of disk I/O, 120damaged disk drive, 738disk I/O, 1030modifying data on, 115transferring contents of redo log
buffer to, 115writing dirty data in memory
buffers to, 116dispatcher
shared server processes, 114V$DISPATCHER view, 1137
DISPATCHERS parameter, 339DISPLAY function
DBMS_XPLAN package, 1182DISPLAY variable
accessing DBCA fromUNIX/Linux, 329
preinstallation checklist, 301setting, preinstallation, 298,
299–300using response files, 309
DISPLAY_AWR function, 976, 1182DISPLAY_CURSOR function, 1182DISTINCT operations, 963distinguished names, 415, 416distributed locks, 239distributed transactions, 911DIT (Directory Information Tree), 414DML (data manipulation language)
statements, 22Flashback Versions Query feature,
259indexing strategy, 962making DML changes permanent,
523PL/SQL, 1205resumable operations, 270
DML locks, 237DML triggers, 465DNs (distinguished names), 415, 416documentation review
Oracle Database 10g installation,280
domain componentdistinguished names, 416
domain constraints, 37domains, 20
double failure protection mode, DataGuard, 697
downloading Oracle software, 302,397
downtime, minimizing, 5dpdump administrative directory, 285DriverManager class, 417drivers, JDBC, 416, 417DROP CATALOG command, RMAN,
670DROP DATABASE command, 386DROP PARTITION clause, 191DROP ROLE command, 452DROP SYNONYM command, 221DROP TABLE command, 182
consequences, 738–739SHOW RECYCLEBIN command,
506DROP TABLESPACE command, 159DROP USER statement, 425–426DROP_JOB procedure, 869DROP_JOB_CLASS procedure, 875DROP_PROGRAM procedure, 870DROP_SCHEDULE procedure, 871DROP_TABLES procedure, 1163DROP_UNUSED procedure, 1163DROP_WINDOW procedure, 879du command, UNIX, 80, 86dump files
cdump administrative directory,285
Data Pump files, 593DUMPFILE parameter, 601, 609, 614,
615dumping
data blocks, 101–102duplexing, 856DUPLICATE command, RMAN, 707,
727durability, transactions, 229DURATION attribute
CREATE_WINDOW procedure, 877OPEN_WINDOW procedure, 878
DURATION clause, RMAN, 675dynamic data sampling, ATO, 995dynamic initialization parameters,
110dynamic parameters, 334, 374, 377dynamic performance tables, 136,
954dynamic performance views, 136,
1115–1143see also V$ viewsautomatic performance tuning
compared, 1003–1004backup- and flashback-related
views, 1120–1121database metrics, 826effect of shutting down instance,
1115memory-related views, 1116–1119metric- and alert-related views,
1135–1136naming, 1115
■INDEX1232
operational performance–relatedviews, 1131–1134
performance monitoring views,1128–1130
recovery-related views, 1126–1128redo log– and archive–log related
views, 1123–1125session- and user-related views,
1121–1123SQL-related views, 1131storage- and file-related views,
1140–1143wait class views, 1130–1131
dynamic resource management,818–820
long transactions, 819MAX_ESTIMATED_EXEC_TIME
resource plan directive, 820UNDO_POOL resource plan
directive, 820dynamic sampling, 955dynamic security policy, 459dynamic service registration, 117
Oracle PMON process, 401
Ee-mail notifications, Database
Control, 895easy connect method, 493easy connect naming, 410–411
naming methods, 405echo command, UNIX, 48
displaying environment variables,55
showing variable value, 53ECHO variable, SQL*Plus, 500ed command, SQL*Plus, 519EDIT command, SQL*Plus, 499EDITF[ILE] variable, SQL*Plus, 500editing
creating command files, SQL*Plus,514
editing files, UNIX, 63editing within SQL*Plus, 519–524
EDITOR variable, SQL*Plus, 517egrep command, UNIX, 66Embarcadero Technologies, 884embedded SQL statements, 147emca utility, 887emctl utility, 889, 902–903EMPHASIS method, 436emulators, UNIX, 46ENABLE NOVALIDATE command,
206enable parameter, 469ENABLE procedure, 870ENABLE QUERY REWRITE clause,
214ENABLE VALIDATE command, 206ENABLED attribute, CREATE_JOB,
868encapsulation, 39ENCLOSED BY clause, SQL*Loader,
547
ENCRYPT clause/keyword, 179, 478,481
encrypted passwords, 474encryption
data encryption, 477–482DBA_ENCRYPTED_COLUMNS
view, 1097DBMS_CRYPTO package, 1155encryption algorithms, 482generating master encryption key,
480transparent data encryption, 477
ENCRYPTION_PASSWORDparameter, 607
END statement, PL/SQL, 1203end-to-end tracing, 989–991endian format, 627, 628, 629END_DATE attribute
CREATE_JOB procedure, 867CREATE_WINDOW procedure, 878
enqueue waits event, 1050enterprise user security, 476–482entity-relationship modeling (ER
modeling), 24–26attributes, 25building ER diagram, 27–28constraints, 36converting logical into physical
design, 35description, 24entities, 25ER modeling tools, 34relationships, 25
entryID attribute, USERENV, 455env command, UNIX, 54environment, SQL*Plus, 499, 506environment variables, Linux
see environment variables, UNIXenvironment variables, SQL*Plus,
500–504see also under SQL*Plus
environment variables, UNIXchanging permanently, 55displaying, 54executing, 55setting OS environment variables,
332setting, post-installation, 311setting, preinstallation, 297startup file, oracle user’s home
directory, 300environment variables, Windows, 920environments
OEM versions managing, 886equi joins, 1195
using correct joins in WHEREclauses, 958
error correctionflashback using undo data,
254–267error handling
Java programs, 419PL/SQL, 1205
error messagesautonomous transactions, 268database hangs, 1063error accessing
PRODUCT_USER_PROFILE,373
errorsbenefits of RMAN, 649common resumable errors, 270data block corruption, 102DBMS_ERRLOG package,
1167–1168maximum extents errors, 270ORA-00257, 647ORA-00376, 756ORA-01152, 755ORA-01194, 754ORA-01555: snapshot too old
error, 141, 244, 252ORA-01588: must use RESETLOGS
option, 754ORA-01589: must use RESETLOGS
or, 754ORA-01756: quoted string not
properly terminated, 521ORA-12500: TNS: listener failed,
922ORA-12541: TNS: no listener, 924ORA-12571: TNS: packet writer
failure, 922ORA-15110: no diskgroups
mounted, 788ORA-19804, 647ORA-19809, 647ORA-19815: WARNING:
db_recovery_file_dest_size,647
ORA-29701: unable to connect toCluster Manager, 788
ORA-30032: the statement hastimed out, 271
ORA-30393: a query block in thestatement did not write, 210
out of space errors, 270recovery errors, 754–756SHOW ERRORS command, 507user’s space quota errors, 270
ERRORS parameter, SQL*Loader, 549ESTIMATE parameter, Data Pump,
605ESTIMATE_ONLY parameter, Data
Pump, 606ESTIMATE_PERCENT attribute
GATHER_DATABASE_STATS, 951etc (/etc) directory, UNIX, 62ETL (extraction, transformation, and
loading), 540–541external tables, loading data using,
559–569Oracle Streams, 583–587SQL*Loader utility, 541–559transforming data, 570–583
eventscaution: setting events, 1064event 10046: Trace SQL code, 1045
■INDEX 1233
event metrics, 827Oracle Streams, 583
event management andnotification, 584
problem-related alerts, 828SET_EV procedure, 1158Top Background Events section,
ASH, 847Top User Events section, ASH, 847
events, Oracle Scheduler, 864,873–874
EVENT_CONDITION attributeCREATE_JOB procedure, 874
EXCEPTION statement, PL/SQL, 1203EXCHANGE PARTITION clause, 191exclamation mark (!)
SQL*Plus using operating systemcommands, 509
EXCLUDE parameter, Data Pump,603–604, 613, 616
excluded addresses, 485exclusive lock mode, 131exclusive locks, 237executable files
components of Oracle process,1061
Oracle home directory, 283EXECUTE command, SQL*Plus, 511execute permission, UNIX files, 59EXECUTE SCRIPT command, RMAN,
653executeQuery method, JDBC, 418executeUpdate method, JDBC, 418EXECUTE_CATALOG_ROLE, 444EXECUTE_TASK procedure, 770EXECUTE_TUNING_TASK
procedure, 997, 1181executing queries
optimizing query processing, 942execution phase
Oracle SQL transaction stages, 232SQL processing steps, 1005TKPROF utility output, 988
execution plan generation phase, 940execution plans
see also EXPLAIN PLAN tool, SQLOracle plan stability feature, 969query processing, 939using hints to influence, 959–960
execution time, limiting, 432, 819EXISTS operator, 1200existsNode method, SQL/XML, 1211,
1213exit command, iSQL*Plus, 529EXIT command, SQL*Plus, 495, 523EXIT_CLIENT command, Data Pump,
612, 621exp utility
Data Pump equivalent of, 592expdp utility
accessing expdp and impdp, 590PARFILE parameter invoking, 599
expired accounts, 472EXPLAIN parameter, TKPROF utility,
986
EXPLAIN PLAN tool, SQL, 974–979creating EXPLAIN PLAN, 975
using Autotrace utility, 979–983DBMS_XPLAN package, 976–977,
1182DISPLAY_AWR function, 976displaying EXPLAIN PLAN,
975–977identifying SQL inefficiency, 999indexing strategy, 962interpreting EXPLAIN PLAN,
977–979from Autotrace utility, 981–983
monitoring index usage, 201SQL Trace tool using, 984understanding output of, 974utlxplan.sql script, 976
EXPLAIN_MVIEW procedure, 212explicit capture, Oracle Streams, 584explicit cursors, 1207explicit locking, 239export command, UNIX, 53–54
changing shell prompt, 51export modes, Data Pump, 600export parameters, Data Pump,
601–613exporting data
see Data Pump Export and Importutilities
extents, 103amalgamating free extents, 117Automatic Storage Management,
141ASM mirroring, 792
bigfile tablespaces, using, 170DBA_EXTENTS view, 1100description, 100dictionary-managed tablespaces,
150extent allocation/deallocation, 156locally managed tablespaces, 150managing extent sizes, 151maximum extents errors, 270tablespace storage parameters,
156–157temporary tablespaces, sizing for,
164external authentication, 475–476external authorization, 451external naming, 412
naming methods, 405external tables, 139, 185
access drivers, 562ACCESS PARAMETERS clause, 562creating external table layer,
561–564Data Pump data access, 592directory objects, 563ETL components, 540existence of, 560Flashback Versions Query feature,
260loading data using, 559–569populating external tables,
564–566
SQL*Loader, 560, 567using external tables, 566–567
external_name attribute, USERENV,455
EXTERNAL_TABLE parameter, 567EXTPROC functionality, PL/SQL, 485extract method, SQL/XML, 1211, 1213extracting data
see ETLextractValue method, SQL/XML,
1212–1213EX_FAIL/FTL/SUCC/WARN
SQL*Loader return codes, 554EZCONNECT keyword, 411
FFAILED_LOGIN_ATTEMPTS
parameter, 427locking accounts, 473setting user profiles, 482
FAILGROUP keywordcreating ASM disk groups, 793
failure groups, ASM mirroring, 792failures, database, 699–701FAST refresh option, 211Fast Start Checkpointing, 701Fast Start Fault Recovery, 701–702FAST_START_MTTR_TARGET
parameterautomatic checkpoint tuning, 141,
810crash recovery, 702MTTR Advisor, 854
FAT file system, 918FCLOSE procedure, 1170FCLOSE_ALL procedure, 1170FEED[BACK] variable, SQL*Plus, 500FETCH command, explicit cursors,
1208Fetch operation, TKPROF utility,
987–988fetching, 1005FGAC (fine-grained access control)
creating package that will accesscontext, 457
data access, 453–461DBMS_RLS package, 1176described, 457policy functions, 457security policy, 458–459steps required, 457uses of, 453
fgrep command, UNIX, 65Fifth Normal Form (5NF), 34file deletion policy
flash recovery area, 646file locations
flash recovery area, 644file management
ASM, 783–799OMF, 800–806
file mapping feature, 862–863file mapping monitor (FMON)
process, 117, 862
■INDEX1234
file metrics, 827FILE parameter, Data Pump, 601file permissions
setting, preinstallation, 295file systems
choosing location for files, 332creating prior to database
creation, 330–332disk storage, UNIX, 87managing Oracle on Windows and
UNIX, 918Oracle Managed Files managing,
173removing, 931sizing file system, 330–331
FILENAME parameter, TKPROF, 986files
administrative files, 285alert log file, 111control file, 108control files, 107copying files with database server,
860–862creating directories for database
files, 287data files, 107database files, 286DBMS_FILE_TRANSFER package,
1146–1148dynamic performance views,
1140–1143FCLOSE procedure, 1170FCLOSE_ALL procedure, 1170FFLUSH procedure, 1168file-related parameters, 339–341FOPEN function, 1170initialization files, 107mapping to physical devices,
862–863network administration files, 107Oracle data files, 108password file, 111physical files, 107product files, 286recovering, SQL*Plus, 524redo log files, 107, 109server parameter file, 110trace files, 111V$FILESTAT view, 1140
files, UNIX, 57avoiding overwriting, 57changing file name, 59changing group, 61comparing UNIX files, 53copying, 59crontab file, 76cutting, pasting, and joining text,
66device files, 62editing files, 63file editors, 65file types, 57getting to top or bottom of, 64joining files, 66–67linking files, 58
listing, 58locating file, 52location of executable file
command, 49locations and paths, 47moving file location, 59outputting columns, 66pattern matching, 65permissions, 59–60reading contents of a file, 52redirection operators, 56removing duplicate lines of text, 67removing files, 59searching for patterns, 65shell scripts, 68–74sorting lines of text, 67special files, 57system configuration files, 62temporary files, 62text extraction utilities, 65transmitting files, 79vi editor, 63viewing contents, 58, 59writing files, 63
FILESIZE parameter, Data Pump, 602,614
FILE_MAPPING parameter, 863filtering operations
WHERE clause, 1189using correct joins in, 958
find command, UNIX, 52Finding column, ADDM, 772findings, ADDM, 762, 768fine-grained access control
see FGACfine-grained auditing, 468–471
DBMS_FGA package, 470, 1176FINISH_REDEF_TABLE procedure,
817First Normal Form (1NF), 30FIRST_ROWS value
OPTIMIZER_MODE parameter,946
FIRST_ROWS(n) hint, 959FIXED clause
creating external table layer, 562fixed objects, 954fixed record format, SQL*Loader, 545FIX_CORRUPT_BLOCKS procedure,
1161flash recovery area, 134, 288, 640–648
alert log during database creation,367
backing up, 646benefits, 641configuring, 643contents of, 641–642control files, 644creating, 643, 646
preinstallation, 297default file location, 644–645described, 354disabling, 644dynamically defining, 643–644managing, 646–648
managing/monitoring database,144
monitoring, 747Oracle Managed Files, 644out-of-space warning and critical
alerts, 647parameter specifying default
location for, 354parameter specifying size of, 354parameters, setting up, 645–646redo log files, 645sizing, 642–643sizing file system for database, 331upgrading with DBUA, 321V$FLASH_RECOVERY_AREA_
USAGE view, 1128Flashback, 736–750
DBMS_FLASHBACK package,256–257, 1178–1179
description, 705dropping tables, 182dynamic performance views, 1128error correction using undo data,
254–267flash recovery area, 641flashback features, 133
using flashback features forauditing, 468
flashback logs, 119indicating if logging enabled,
891flashback mode clause, 154FLASHBACK_RETENTION_
TARGET parameter, 747FLASHBACK_SCN parameter, 608,
621FLASHBACK_TIME parameter,
608, 621FLASHBACK_TRANSACTION_
QUERY view, 261, 1089levels, 737parameter specifying flashback
time, 355techniques, 135traditional recovery techniques
compared, 738Flashback Database feature, 154, 641,
742–750concepts, 746configuring, 744–745description, 738disabling, 745–746example, 748–750FLASHBACK DATABASE
command, 743Flashback Database logs, 746limitations, 750monitoring flash recovery area,
747storage limits, 747when to use, 743
Flashback Drop feature, 264, 738–742description, 737how Flashback Drop works, 739
■INDEX 1235
permanently removing tables,741–742
privileges, 742Recycle Bin, 740restoring dropped tables, 741turning off, 739
Flashback Query feature, 254AS OF clause, 256advantages of AUM, 244description, 737querying old data with, 255–256using flashback features for
auditing, 468Flashback Table feature, 254, 264–267
description, 737restrictions, 267undoing Flashback Table
operation, 266Flashback Transaction Query feature,
254, 261–264description, 737points to remember, 263using, 261using flashback features for
auditing, 468using with Flashback Versions
Query, 263Flashback Versions Query feature,
254, 258–261AS OF clause, 258description, 737example using, 260key points, 258pseudo-columns, 259restrictions on, 260syntax, 258using flashback features for
auditing, 468using with Flashback Transaction
Query, 263VERSIONS clause, 258, 260
flow control structures, UNIX, 71case command, 73conditional branching, 71for-do-done loop, 72if-then-else-fi structure, 71looping, 72until-do-done loop, 73while-do-done loop, 72
FLUSH variable, SQL*Plus, 500flushing, shared pool, 1007FMON process, 862footers, SQL*Plus, 513FOPEN function, UTL_FILE, 1170FOR loop
cursors, 1209for-do-done loop, UNIX, 72PL/SQL, 1206
FORCE refresh option, 212foreign keys, 35
converting logical into physicaldesign, 35
enforcing constraints, 36
indexing strategy, 963referential integrity constraints,
205FORMAT clause
SET SERVEROUTPUT command,502
FORMAT option, backups, 657FORMAT parameter
converting data files to matchendian format, 629
RMAN backup locations, 658formatting, SQL*Plus
specifying where formattingchange occurs, 512
forName method, java.langJDBC drivers, 417
forward slash (/) commandexecuting contents of SQL*Plus
buffer, 515FOUND (%FOUND) attribute, 1208Fourth Normal Form (4NF), 34fragmentation, 806free buffer waits event, 1050free buffers, 121free space
data blocks, 101DBA_FREE_SPACE dictionary
view, 175freelists, 152FREE_BLOCKS procedure, 1164
FROM clause, subqueries, 147FTP (File Transfer Protocol), 79ftp command, UNIX, 79FULL hint, 959FULL parameter/full export mode,
600, 617full table scans
avoiding unnecessary, 967CBO choosing access path, 948INDEX_FFS hint, 959
function-based indexes, 200using appropriate index types, 964using SQL functions in WHERE
clauses, 958function privileges, 446functional dependencies
normal forms, 33functions
PL/SQL, 1210SQL functions, 1190–1194
fuzzy-read problem, 230
GGather Statistics wizard, 1066GATHER_DATABASE_STATS
procedurecollecting fixed object statistics,
954collecting real dictionary table
statistics, 954gathering Optimizer statistics,
950–952
GATHER_DICTIONARY_STATSprocedure
collecting data dictionarystatistics, 955
collecting real dictionary tablestatistics, 954
GATHER_FIXED_OBJECTS_STATSprocedure
collecting fixed object statistics,954
GATHER_STATS_JOBautomatic optimizer statistics
collection, 781–782default Scheduler jobs, 882gathering statistics, 943–945objects for which statistics are
collected, 782GATHER_SYSTEM_STATS procedure
collecting operating systemstatistics, 952–954
GATHER_XYZ_STATS proceduresgathering Optimizer statistics, 950
General sectionDatabase Control home page, 891
GET command, SQL*Plus, 499, 518get command, UNIX, 79getConnection method,
DriverManagerJDBC drivers, 417
GET_FILE procedure, 862, 1147GET_LINE procedure, 1170GET_SCHEDULER_ATTRIBUTE
procedure, 880GET_TASK_REPORT procedure, 770GET_TASK_SCRIPT procedure, 1180GET_THRESHOLD procedure, 831,
1180glance command, UNIX, 84GlancePlus, UNIX, 84global authorization, 451global database names, 394global indexes, 200global partitioned indexes, 965global preferences file
SQL*Plus environment variables,502–503
global RMAN scriptscreating, 654–655
GLOBAL_NAME view, 1085GLOBAL_NAMES parameter, Oracle
Streams, 585glogin.sql file
applicability, 504default file, 503execution order with login.sql file,
504iSQL*Plus, 536specifying environment variables,
502–503gpm command, UNIX, 85GRANT ANY OBJECT privilege, 444
granting/revoking objectprivileges, 448
■INDEX1236
GRANT ANY PRIVILEGE privilege,444
GRANT CONNECT statement, 423GRANT statement
granting object privileges, 447granting privileges, 442granting system privileges, 443
GRANTROLE command, iSQL*Plus,534
grantsdatabase security dos and don’ts,
483, 487DBA views for managing, 452granting privileges through roles,
487granting roles to maintain/query
RMAN, 669GRANTS parameter, Data Pump, 603GRANT_ADMIN_PRIVILEGE
procedure, 586granular recovery, 730–736
LogMiner utility, 731–736Tablespace Point-in-Time
Recovery, 730–731granularity
benefits of Data Pump, 591locking, 237row-level granularity, 237
GRANULARITY attributeGATHER_DATABASE_STATS
procedure, 951grep command, UNIX, 49, 65, 74Grid Control, OEM
see OEM Grid ControlGROUP BY clauses, 1197–1198
CUBE operator, 1198GROUPING operator, 1198GROUPING SETS operator, 1198guidelines for use of indexes, 197HAVING operator, 1198indexing strategy, 963nesting group functions, 1197ROLLUP operator, 1197
groupsmanaging Oracle on Windows and
UNIX, 917OEM Grid Control, 906, 908
groups, UNIXcreating, preinstallation, 294files changing, 61
guaranteed restore points, 751guaranteed undo retention, 251GUI sessions
managing Oracle on Windows andUNIX, 918
Hh (esc-h), UNIX
editing the previous command, 50handler_module/schema parameters
ADD_POLICY procedure,DBMS_FGA, 469, 470
Hang Analysis page, DatabaseControl, 1063
blocking and waiting sessions, 242hanganalyze utility, 1065hanging
see database hangsHARD (Hardware Assisted Resilient
Data) initiative, 694storage technologies, 94
hard links, UNIX, 58hard parsing
caution: high hard parse rates,1007
converting to soft parsing, 1013description, 1007examples, 1008resources used, 1010sessions with high number of hard
parses, 1011–1012hardware
ADDM recommendations, 763Hardware Assisted Resilient Data
see HARDhash clusters, 195–196hash join
CBO choosing join method, 948selecting best join method, 960
hash partitioning, 187–188HASHKEYS value, 195HAVING clause, GROUP BY, 959, 1198head command, UNIX, 64headers, SQL*Plus, 513heap
components of Oracle process,1061
HEA[DING] variable, SQL*Plus, 500HELO procedure, UTL_SMTP, 1172help
SQL*Plus, 499UNIX commands, 50
HELP command, Data Pump, 612,613, 621
help command, lsnrctl utility, 402HELP INDEX command, SQL*Plus,
499heuristic strategies
optimizing query processing, 942hidden Oracle parameters, 110hierarchical queries, 1194High Availability section, Database
Control, 891high availability systems
enhanced data protection fordisaster recovery, 695
high water marksee HWM
hintsDBA_OUTLINES view, 1098optimizing queries, 137REWRITE_OR_ERROR hint, 210using hints to influence execution
plan, 959–960histograms, 972–973history, ASH, 142, 845–849
history command, UNIX, 49hit ratios
database buffer cache, 124database hit ratios, 1033
home directory, UNIX, 46, 62HOME shell variables, UNIX, 54HOMEID key, Windows registry, 921host attribute, USERENV, 455Host chart, Database Performance,
1070HOST command, SQL*Plus, 509
restricting use of, 498restriction levels, 499
Host CPU bar chart, DatabaseControl, 1067
Host CPU section, Database Control,891
Host graph, Database Control, 891host name
connect descriptors, 395host parameter
easy connect naming, 410hosts
administrative domain, 681hot backups
see open backupshot restore, RMAN, 713hot spares, RAID systems, 88hot swapping, RAID systems, 88Hotsos, DBA resources, 14HR (human resources) schema, 1183,
1184http-web-site.xml, iSQL*Plus, 527HWM (high water mark)
Database Usage Statistics propertysheet, 899
manual segment shrinking, 807OEM Database Control, 898online segment shrinking, 806
hyphen (-)continuation characters,
SQL*Plus, 495using comments in SQL*Plus, 518
II/O
ADDM determining optimalperformance, 764
analyzing instance before tuning,1074
Automatic Storage Management,141
block size and I/O performance,1030
caution: excessive reads/writes onsome disks, 1031
cost model of Oracle Optimizer,952
cost of disk I/O, 120data block sizes and tablespaces,
105deploying additional database
writer processes, 115distribution of I/O, 1030
■INDEX 1237
evaluating system performance,1030
finding SQL that uses mostresources, 993
managing Oracle on Windows andUNIX, 917
measuring I/O performance,1030–1032
monitoring, 117multiple buffer pools, 122optimally distributed I/O, 1031rebalancing ASM disk groups, 794reducing I/O contention, 1032SAME guidelines for optimal disk
usage, 1032SQL Trace tool showing, 984system usage problems, 1059
identifierssee keys
idle events category, 1052idle time resource allocation method
Database Resource Manager, 432Idle wait class, 1035idle-time-limit resource directive, 437IDLE_TICKS system usage statistic,
1053IDLE_TIME resource parameter, 427,
430IE (information exchange) schema,
1184IF statement, PL/SQL, 1205if-then-else-fi control structure,
UNIX, 71IFILE parameter, 339image copies, RMAN, 649, 655–656,
659, 678immediate constraints, 207IMMEDIATE option, 227imp utility
Data Pump equivalent of, 592Impact column, ADDM reports, 772impact estimate, ADDM, 762impdp utility, accessing, 590implementation
database design, 37Oracle DBA role, 3RAID systems, 92
implicit capture, Oracle Streams, 584implicit commit, 226implicit cursors, 1207implicit locking, 239import parameters, Data Pump, 614,
621import scripts
see Data Pump Export and Importutilities
Import utilitydisabling integrity constraints, 205
import-export element (iee)tape libraries, Oracle Backup, 685
importing datasee Data Pump Export and Import
utilitiesIMPORT_FULL_DATABASE role
Data Pump utilities, 614
in-memory metrics, 827IN operator, 1189incarnations, databases, 720INCLUDE parameter, Data Pump,
603–604, 616INCLUDING CONTENTS clause, 160incomplete recovery, 704, 717–721
change-based SCN, 718description, 705log sequence–based recovery, 718through parent incarnation, 720time-based recovery, 718using RMAN, 717–721
inconsistent database backups, 633incremental backups
backup strategies, 638benefits of RMAN, 648enabling block-change tracking,
677fast incremental backups, 677flash recovery area, 641monitoring block-change tracking,
677RMAN, 659–660, 676
INDEX hint, 959index key compression, 968index-organized tables
see IOTindex scans
CBO choosing access path, 948indexes, 196–202
bitmap indexes, 199, 963Bitmap join indexes (BJIs),
960–961B-tree indexes, 197, 199coalescing an index online, 812concatenated indexes, 964creating an index, 199creating an index online, 812DBA_INDEXES view, 224, 1106DBA_IND_COLUMNS view, 1106dropping tables, 182estimating size of index, 198function-based indexes, 200, 958,
964guidelines for use of, 197index-organized tables (IOTs), 963indexing strategy, 962–965
index-only plans, 963using appropriate index types,
963–965what to index, 963when to use indexes, 962
low cardinality, 963maintaining, 202materialized views, 209monitoring index usage, 201, 965Oracle index schemes, 197partitioned indexes, 200, 201, 964performance tradeoff using, 196performance tuning, 973primary index, 962rebuilding an index online, 812removing unnecessary indexes,
965
reverse key indexes, 199, 964secondary indexes, 962separating table and index data,
104sizing file system for database, 330SQL Access Advisor
recommendations, 201SQL*Loader utility, 558types, 196
INDEXES parameter, Data Pump, 603INDEXFILE parameter, Data Pump,
615INDEX_FFS hint, 959INDEX_STATS view, 1107INFILE parameter, SQL*Loader, 544InfiniBand
storage technologies, 94inheritance
object database model, 39init.ora file
see also initialization parameterfile
automatic service registration, 401backup guidelines, 635comments, 377creating, 359–361creating new database, 110creating SPFILE from, 375database instance names, 394DB_BLOCK_SIZE parameter, 100dynamic parameter changes, 374manual upgrade process, 324modifying, 376reading file, 357SPFILE as alternative, 779
INITCAP functionderiving data from existing tables,
570initdb_name.ora, 333, 334initial extent, 103Initial Options page, 217initialization files, 107
Oracle looking for correct file, 378setting up flash recovery
parameters, 645uses of, 333
initialization parameter file (pfile),334
see also init.ora fileactions of parameters
associating multiple instances,338
auditing actions of SYS user,337
checking for corrupted datablocks, 355
checking for password file forauthentication, 356
collecting timed statisticsduring tracing, 353
configuring dispatcher process,339
defining archive logdestinations, 347
■INDEX1238
defining format for archivedredo log files, 347
determining defaulttablespace, 348
determining number of parallelexecution processes, 352
determining query rewriting,350
dynamically sampling data, 350enabling behavior of previous
versions, 350enabling detection of
corruption, 355enabling/disabling Resumable
Space Allocation, 355enforcing integrity rules, 350enforcing resource limits in
user’s profile, 353ensuring compatibility of
releases, 338locking SGA into host’s physical
memory, 346logging checkpointing activity
to alert log, 356multiplexing control file, 339nesting common parameters,
339optimizing PL/SQL library
units, 353prefixing operating system
authenticated usernames.,356
providing name for databaseservice, 338
retaining shared SQL areas, 351setting Java pool size, 346setting large pool size, 345setting limit for processes, 342setting memory for user jobs,
346setting name of database, 337setting nonstandard-sized
buffer caches, 344setting number of open
cursors, 342setting number of sessions, 342setting redo log buffer size, 345setting SGA maximum size, 346setting shared pool size, 345setting size of default buffer
pool, 344setting size of keep pool, 344setting size of recycle pool, 344setting standard database
block size, 351setting Streams pool size, 346sharing cursors, 351sizing SQL work areas for users,
353specifying default date format,
339specifying default location for
flash recovery area, 354specifying directory for audit
records, 337
specifying flashback time, 355specifying fully qualified name,
337specifying instance type, 338specifying level of statistics
collected, 349specifying location for alert log,
340specifying location for core
messages, 340specifying location for data
files, 341specifying location for error
messages, 340specifying location for OMF,
341specifying location for
processing I/O, 341specifying maximum number
of blocks read, 352specifying maximum number
of users, 348specifying number of files to
open, 340specifying number of writer
processes, 342specifying optimization type,
349specifying record retention
time, 340specifying saved redo
information, 348specifying size of flash recovery
area, 354storing undo records, 348turning auditing on/off, 336turning SQL trace utility on/off,
352using automatic shared
memory management, 343changing initialization parameter
values, 333, 334–335ALTER SESSION command,
335ALTER SYSTEM command, 335dynamic parameters, 334for all sessions, 335for duration of session, 335for new sessions, 335making permanent, 335static parameters, 334
configuration parameterscontained, 334
creating init.ora file, 360described, 333dynamic changes, 333editing, 333initdb_name.ora, 333location of, 333optional parameters, 334Oracle Database 10g initialization
parameters, 335–357AUDIT_FILE_DEST, 337AUDIT_SYS_OPERATIONS, 337AUDIT_TRAIL, 336
BACKGROUND_DUMP_DEST,340
COMPATIBLE, 338CONTROL_FILES, 339CONTROL_FILE_RECORD_
KEEP_TIME, 340CORE_DUMP_DEST, 340CURSOR_SHARING, 351CURSOR_SPACE_FOR_TIME,
351DB_BLOCK_CHECKING, 355DB_BLOCK_CHECKSUM, 355DB_BLOCK_SIZE, 351DB_CACHE_SIZE, 344DB_CREATE_FILE_DEST, 341DB_CREATE_ONLINE_LOG_
DEST_n, 341DB_DOMAIN, 337DB_FILES, 340DB_FILE_MULTIBLOCK_
READ_COUNT, 352DB_FLASHBACK_RETENTION_
TARGET, 355DB_KEEP_CACHE_SIZE, 344DB_NAME, 337DB_nK_CACHE_SIZE, 344DB_RECOVERY_FILE_DEST,
354DB_RECOVERY_FILE_DEST_
SIZE, 354DB_RECYCLE_CACHE_SIZE,
344DB_UNIQUE_NAME, 337DB_WRITER_PROCESSES, 342DISPATCHERS, 339IFILE, 339INSTANCE_NAME, 338INSTANCE_TYPE, 338JAVA_POOL_SIZE, 346LARGE_POOL_SIZE, 345LICENSE_MAX_USERS, 348LOCK_SGA, 346LOG_ARCHIVE_DEST_n, 347LOG_ARCHIVE_FORMAT, 347LOG_BUFFER, 345LOG_CHECKPOINTS_TO_
ALERT, 356NLS_DATE_FORMAT, 339OPEN_CURSORS, 342OPTIMIZER_DYNAMIC_
SAMPLING, 350OPTIMIZER_FEATURES_
ENABLE, 350OPTIMIZER_MODE, 349OS_AUTHENT_PREFIX, 356PARALLEL_MAX_SERVERS, 352PGA_AGGREGATE_TARGET,
346PLSQL_OPTIMIZE_LEVEL, 353PROCESSES, 342QUERY_REWRITE_ENABLED,
350QUERY_REWRITE_INTEGRITY,
350
■INDEX 1239
REMOTE_LOGIN_PASSWORDFILE, 356
RESOURCE_LIMIT, 353RESUMABLE_TIMEOUT, 355SERVICE_NAME, 338SESSIONS, 342SGA_MAX_SIZE, 346SGA_TARGET, 343SHARED_POOL_SIZE, 345SQL_TRACE, 352STATISTICS_LEVEL, 349STREAMS_POOL_SIZE, 346TIMED_STATISTICS, 353UNDO_MANAGEMENT, 348UNDO_RETENTION, 348UNDO_TABLESPACE, 348USER_DUMP_DEST, 340UTL_FILE_DIRECTORY, 341WORKAREA_SIZE_POLICY, 353
Oracle template for creation of,334
pfile administrative directory, 285SHOW PARAMETER command,
358undocumented initialization
parameters, 357viewing current initialization
parameter values, 357–358V$PARAMETER view, 357
initialization parametersADDM recommendations, 763BACKGROUND_DUMP_DEST, 111changing for session only, 146database creation using OMF, 803detecting data block corruption,
692dynamic initialization parameters,
110modifying, 146Oracle Managed Files, 801–802Pre-Upgrade Information Tool, 317setting, post-installation, 311SET_INT_PARAM_IN_SESSION
procedure, 1158V$PARAMETER view, 1138V$SPPARAMETER view, 110V$SYSTEM_PARAMETER view,
1138INITIAL_EXTENT storage parameter,
157INITTRANS parameter
serializable isolation level, 235inline stored functions
writing efficient SQL, 966inline view, 147inner join, 1196input, SQL*Plus
saving user input in variable, 511INPUT command, SQL*Plus, 520input/output statistics, UNIX
iostat utility, 82input/output redirection, UNIX, 56INSERT ALL statement, 574INSERT clause, SQL*Loader, 544INSERT FIRST statement, 574
INSERT parameter, TKPROF, 986INSERT statement, 1187–1188
data manipulation statements, 147table functions, 576, 578
insertion anomaly, 29Installation Guide, Oracle, 280installations
see also Oracle Database 10ginstallation
Instant Client software, 400iSQL*Plus, 526Oracle Internet Directory, 416Oracle Client software, 398–399
instancesee Oracle instance
instance attribute, USERENV, 455Instance Disk I/O graph, Database
Control, 892instance failure
benefits of archivelog mode, 632instance performance
analyzing instance performance,1035–1052
application knowledge fordiagnosis, 1053
measuring instance performance,1032–1065
database hit ratios, 1033database wait statistics,
1033–1035wait classes and wait events,
1035symptoms and causes, 1054
instance recovery, 701–702Instance Throughput graph,
Database Control, 892instance tuning
see performance tuninginstances
see database instancesINSTANCE_NAME parameter, 338
automatic service registration, 401database instance names, 394
INSTANCE_TYPE parameter, ASM,338, 787
Instant Client software, 398, 399–400instant protection mode, Data Guard,
697INSTR function, 1191integrated systems management,
OEM, 886integrity
see database integrityinteractive mode
Data Pump utilities, 599, 614export parameters, 609–613
UNIX commands, 54internal locks, Oracle, 239internal plan, Oracle, 435internal quiesce, Oracle, 435International Oracle Users Group
(IOUG), 13intersection, relational algebra, 21INTERSECTION operator, 1190
INTERVAL keyword/parameterAWR snapshots, 839
setting to zero, 840collecting operating system
statistics, 953INTO TABLE statement, SQL*Loader,
544invalid objects
manual upgrade process, 325upgrading with DBUA, 320
invited addresses, 485invoker’s rights, 448IOSEEKTIM mode, 953iostat utility, UNIX, 82, 1030IOT (index-organized tables),
184–185Flashback Versions Query feature,
259using appropriate index types, 963
IOTFRSPEED mode, 953IOUG (International Oracle Users
Group), 13IOWAIT_TICKS statistic, 1053IP (Internet Protocol) address, 47, 77ip_address attribute, USERENV, 455ISO transaction standard, 231isolation, transactions, 228isolation levels, 232–235
changing default, 234ISO transaction standard, 231read-committed, 233read-uncommitted, 233repeatable-read, 232serializable, 232statement-level read consistency,
234transaction-level read consistency,
234ISOPEN (%ISOPEN) attribute, 1208iSQL*Plus, 138, 526–536
architecture, 526–527authentication
authentication levels, 533–535creating authorized users, 534granting webDba role to new
users, 534JAAS, 533starting JAZN shell, 533
browser requirements, 527changing iSQL*Plus default port,
530changing password, 533commands
ADDUSER command, 534CONNECT command, 529DISCONNECT command, 529exit command, 529GRANTROLE command, 534inapplicable SQL*Plus
commands, 536LISTUSERS command, 534netstat command, 530REMUSER command, 534REVOKEROLE command, 535SETPASSWD command, 534
■INDEX1240
configuration, 527–528connecting to, 527
different database, 529remote databases, 531unable to connect, 527
database administration, 532disconnecting from, 529displaying results in, 533glogin.sql file, 503, 536History screen, 531HTTP network timeouts, 536inapplicable SQL*Plus commands,
536installing, 526interface configuration settings,
532iSQL*Plus Application Server, 527,
528iSQL*Plus DBA URL, 533, 535iSQL*Plus Workspace, 531limitations, 526logging into, 528login.sql file, 504, 536navigating in, 531Preferences screen, 531restricting access to limited set of
databases, 536script execution, 532script formatting, 532security, 536starting, 370starting iSQL*Plus from URL, 530system configuration, 532troubleshooting startup on
UNIX/Linux, 529Workspace screen, 531
isqlplusctl utilitylocation, 528starting JAZN shell, 533stop command, 528
Itanium processorsmanaging Oracle on Windows and
UNIX, 917Ixora, DBA resources, 14
JJAAS (Java Authentication and
Authorization Service)iSQL*Plus authentication, 533
Javaerror handling, 419Oracle and Java, 1214–1216stored procedures, 1214
Java Database Connectivitysee JDBC
Java poolauto-tuned SGA parameters, 775JAVA_POOL_SIZE parameter, 346,
775parameter setting size, 346system global area, 121, 126tuning, 1019
java.lang classforName method, 417
JAZN (Java authorization), 533–534JDBC (Java Database Connectivity),
416–420, 1215createStatement method, conn
class, 417Java program using, 419–420making database connection, 417PreparedStatement object, 417Statement object, creating, 417
JDBC drivers, 416forName method, java.lang, 417getConnection method,
DriverManager, 417JDBC OCI driver, 416JDBC server-side internal driver,
417JDBC server-side thin driver, 417JDBC thin driver, 416registerDriver method,
DriverManager, 417Job Activity page, Grid Control, 907job classes, Oracle Scheduler, 865,
874–876job commands, RMAN, 660–662job coordinator, Scheduler, 866job queue coordination (CJQO)
process, 114, 118job scheduling, UNIX, 76job table, Scheduler, 866job worker processes, Scheduler, 866jobs
automating jobs, 918DBA_JOB package, 1151–1153DBA_JOBS view, 1090setting credentials for the job
system, 923jobs, Oracle Scheduler
administering jobs, 868–869creating event-based jobs, 873creating jobs, 867–868default Scheduler jobs, 882description, 864embedding jobs in chains, 873frequency (FREQ keyword), 868managing, 867–869prioritizing jobs, 879purging job logs, 882repeat interval (INTERVAL
keyword), 868specifiers, 868
JOB_ACTION attribute, 867JOB_CLASS_NAME attribute, 875JOB_NAME attribute, 867JOB_NAME parameter, Data Pump,
607, 614, 617JOB_QUEUE_PROCESSES parameter
gathering Optimizer statistics, 952setting up Oracle Streams, 585
JOB_TYPE attribute, 867join command, UNIX, 67join operations
Bitmap join indexes (BJIs),960–961
Cartesian joins/product, 960, 1195CBO choosing access path, 948
CBO choosing join order, 948equi joins, 958, 1195examples of cost-based query
optimization, 941HASH join, 960heuristic strategies for query
processing, 942indexing strategy, 963inner join, 1196MERGE join, 960natural join, 22, 1196nested loops (NL join), 960outer join, 1196relational algebra, 22selecting best join method, 960selecting best join order, 961self join, 1196theta-join, 22types of Oracle joins, 1195–1196using correct joins in WHERE
clauses, 958JVM (Java Virtual Machine), 1214
Kk (esc-k), UNIX
retrieving previous command, 50keep buffer cache, 775keep buffer pool, 123
determining candidates for, 1019multiple pools for buffer cache,
1017–1018setting size of keep pool, 344
KEEP procedure, 1010, 1174kernel
Linux requirements for Oracle, 292UNIX, 45
kernel parameterspreinstallation checks, 289, 300reconfiguring, preinstallation, 292
kernel versionpreinstallation checks, 290
keysALL_HOMES subkey, 921candidate keys, 26HOMEID key, 921primary keys, 26removing registry keys, 930tables, 20
keyword variables, UNIX, 54kill command, UNIX, 75
database security, 489managing Oracle on UNIX, 913problems starting iSQL*Plus, 530
killing Oracle processes, 489, 913KILL_JOB command, Data Pump,
597, 612–613, 621ksh (Korn shell), 45, 55
LL (-L) no-prompt logon, SQL*Plus,
505l (esc-l), UNIX
editing the previous command, 50label-based security policy, 461
■INDEX 1241
large objectssee LOBs
large poolauto-tuned SGA parameters, 775parameter setting size, 345RMAN, 126system global area, 121, 126tuning, 1019
LARGE_POOL_SIZE parameter, 126,345, 775
latch contentionanalyzing instance before tuning,
1076eliminating contention, 1078–1079parsing, 1013reducing parse time CPU usage,
1028soft parsing, 1013
latch free wait events, 1050latch rate, 1054latches, 1050
Oracle lock types, 239shared pool, 1005V$LATCH view, 1133V$LATCHNAME view, 1133
LDAP (Lightweight Directory AccessProtocol), 413, 476, 477
LD_LIBRARY_PATH variable, 332, 359least recently used (LRU) algorithm,
115least recently used (LRU) buffers, 122leaves, B-tree index structure, 197Legato Single Server Version software,
680LENGTH function, 1191library cache
ad hoc SQL, 1013CURSOR_SHARING parameter,
1010–1011CURSOR_SPACE_FOR_TIME
parameter, 1012hit ratio formula, 1009measuring efficiency, 1009–1010optimizing, 1010–1014parameter retaining shared SQL
areas, 351sessions with high number of hard
parses, 1011–1012SESSION_CACHED_CURSORS
parameter, 1012–1013shared pool, 125
parameter setting size of, 345pinning objects in, 1014–1015tuning, 1005–1006
V$DB_OBJECT_CACHE view, 1119V$LIBRARYCACHE view, 1119
LICENSE_MAX_USERS parameter,348
licensinglicensed number of users
parameter, 348–349Management Packs, 824, 895–896performance tools, 824V$LICENSE view, 1136
Lightweight Directory AccessProtocol (LDAP), 413, 476,477
LIKE operator, WHERE clause, 1187,1189
CBO (Cost Based Optimizer), 958limited analysis mode, Segment
Advisor, 808lines of text
GET_LINE procedure, 1170inserting and deleting, SQL*Plus,
520NEW_LINE procedure, 1170PUT procedure, 1170PUT_LINE procedure, 1159, 1170
link command, UNIX, 58linking files, UNIX, 58links
see database linksLinux, 931–933
see also UNIXchoosing Linux or UNIX, 932introduction, 44managing Oracle databases on,
933Oracle’s commitment to, 932stable versions of, 933troubleshooting iSQL*Plus startup
on, 529whatis command, UNIX, 51
LIN[ESIZE] variable, SQL*Plus, 500LIST command, RMAN, 708LIST command, SQL*Plus, 518LIST commands, RMAN
ARCHIVELOG ALL, 664BACKUP, 663COPY, 664GLOBAL SCRIPT NAMES, 664INCARNATION, 720SCRIPT NAMES, 664
list partitioning, 188listener.ora file, 117, 137
advice on modifying, 403concurrent connection requests,
403default location, 400making changes to, 403PMON process, 401typical file, 401
listeners, 400–405automatic service registration,
401–402BLOCKED status, 402checking listener status, 402, 924connecting to Oracle, 137default password, 404described, 393dynamic service registration, 117failed attempt to stop, 404lsnrctl commands, 402–403
help command, 402reload command, 403services command, 402start command, 403
status command, 402stop command, 403
LSNRCTL STATUS command, 789multiple listeners, 403Oracle listener, 400–401Oracle networking and, 400Oracle Service thread, 914Oracle services, Windows, 924–925QUEUESIZE parameter, 403READY status, 402setting password for, 404securing listener, 485UNKNOWN status, 402
listing commands, RMAN, 663–664listing files, UNIX, 58LISTUSERS command, iSQL*Plus,
534ln command, UNIX, 58load balancing, ASM benefits, 784LOAD DATA statement, SQL*Loader,
544LOAD parameter, SQL*Loader, 549Load Profile section, AWR report,
1075LOAD WHEN clause, 562load-then-transform method, ETL,
540loading data
see also ETLexternal tables, 559–569SQL*Loader utility, 541–559
LOBs (large objects)choosing size of data blocks, 101ORDBMS model, 40transportable tablespaces, 623
local commands, SQL*Plus, 496local naming, 405–410
modifying tnsnames.ora manually,406–408
modifying tnsnames.ora withNCA, 408–410
local partitioned indexes, 965locally managed tablespaces, 106, 150
AUTOALLOCATE option, 155automatic segment space
management, 155, 800bitmaps, 106managing/monitoring database,
144migrating from dictionary
managed, 153space management, 799–800specifying default storage
parameters, 156storage allocation to database
objects, 158locally partitioned indexes, 201LOCATION parameter, 563location transparency
Oracle Net Services features, 391using synonyms, 220
lock (LCKn) process, 119lock conversion, Oracle, 236lock escalation, Oracle, 236LOCK TABLE statement, 147
■INDEX1242
locked accounts, 472locking
blocking locks, 239caution: locking during segment
shrinking, 807data concurrency, 131, 229DBA_BLOCKERS view, 1097DBA_LOCKS view, 1104DBA_WAITERS view, 1097DDL locks, 238deadlocks, 240distributed locks, 239DML locks, 237exclusive locks, 131, 237explicit locking, 239granularity, 237identifying source of lock, 241–242implicit locking, 239internal locks, 239latches, 239lock escalation, 236LOCK_SGA parameter, 346locking issues, 1060locks on suspended operations,
272managing long transactions, 273Oracle lock types, 237, 238, 239Oracle locks, 236, 240–243page-level locking, 237pessimistic concurrency control,
235releasing locks, 237row exclusive locks, 237row-level locking, 236sequences avoiding, 222serializable isolation level, 235session locks, 242sessions holding locks, 241share lock mode, 131table locks, 238temporary tables, 183V$LOCK view, 241, 1132V$LOCKED_OBJECT view, 1133V$LOCK_HOLDERS view, 241V$SESSION view, 241
log buffermanually managed SGA
parameters, 775space wait event, 1051
LOG FILE parameter, 562log file switch wait event, 1052log file sync wait events category,
1052log files
alert log file, 111create materialized view log, 213creating database, 364Data Pump files, 593online redo logs, 855–858Pre-Upgrade Information Tool, 317SQL*Loader utility, 552–553
LOG parameter, SQL*Loader, 549log sequence–based recovery, 718
Flashback Database example, 749
log writer (LGWR) processbackground processes, 114–115Oracle Service thread, 915redo log buffer, 125–126
LOGFILE parameter, Data Pump, 602,615
logging onFAILED_LOGIN_ATTEMPTS
parameter, 427locking accounts, 472logging in as different user, 489no-prompt logon option, 505performance issues, 1014Single Sign-On feature, 477
logging on, UNIXaccessing UNIX system, 46login to another system, 78
LOGGING_LEVEL attributeCREATE_JOB procedure, 875SET_ATTRIBUTE procedure, 882
logical change record (LCR)Oracle Streams, 585
logical database backups, 634logical database design, 24–34
converting into physical design, 34entity-relationship diagram, 27–28entity-relationship modeling,
24–26ER modeling tools, 34normal forms, 29–34normalization, 28–29
logical database structures, 100–107data blocks, 100–103extents, 100, 103schema, 100segments, 100, 104tablespaces, 100, 104–107
logical DBA, 8LOGICAL keyword, RMAN, 659logical operators, 1190logical reads, 1016logical standby databases, 696logical unit number (LUN), 784Logical Volume Manager (LVM), 87,
783logical volume stripe sizes, 1030logical volumes, UNIX, 87LOGICAL_READS_PER_CALL
parameter, 427LOGICAL_READS_PER_SESSION
parameter, 427, 430login (.login) file, UNIX, 54, 55login scripts
changing, preinstallation, 293login.sql file
applicability, 504execution order with glogin.sql
file, 504iSQL*Plus, 504, 536Oracle Database 10g execution,
505sample file, 504specifying environment variables,
503–504
LogMiner utility, 139analyzing redo logs, 735–736DBMS_LOGMNR package, 1179description, 705extracting data dictionary, 733–734granular recovery using, 731–736how LogMiner works, 732sample LogMiner session, 734–735supplemental logging, 732–733
LOGON_USER column, 262LOG_ARCHIVE_DEST_n parameters,
347flash recovery area, 642, 644OMF parameters, 803setting up flash recovery
parameters, 645setting up Oracle Streams, 585
LOG_ARCHIVE_DUPLEX_DESTparameter, 644
LOG_ARCHIVE_FORMAT parameter,347, 720
LOG_ARCHIVE_MAX_PROCESSESparameter, 117
LOG_BUFFER parameter, 126, 345,775
LOG_CHECKPOINTS_TO_ALERTparameter, 356
LOG_FILE_NAME_CONVERTparameter, 727
LOG_HISTORY attributeCREATE_JOB procedure, 875PURGE_LOG procedure, 875
LONG data, Data Pump, 593LONG variable, SQL*Plus, 501lookup tables, 35LOOP keyword, PL/SQL, 1206looping
flow control structures, UNIX, 72nested loops (NL join), 960PL/SQL, 1206
lossless-join dependency, 34lost update problem, 230low cardinality, 963LOWER function, 1191LOW_GROUP resource consumer
group, 435LPAD function, 1191ls command, UNIX, 58, 60LSNRCTL STATUS command, ASM,
789lsnrctl utility
listener commands, 402–403Oracle listener, 400–401
checking listener status, 402,924
set password clause, 404lsof utility
problems starting iSQL*Plus, 530LUN (logical unit number), 784LVM (Logical Volume Manager), 87,
783
■INDEX 1243
MM (-M) markup option, SQL*Plus, 505machine name
accessing UNIX system, 47mail program, UNIX, 70mail, UTL_MAIL package, 1149MAIL function, UTL_SMTP package,
1172Maintenance page, Database Control,
893–894maintenance window, Scheduler, 877,
943man command, UNIX, 50manageability monitor (MMON)
process, 114, 118, 845manageability monitor light (MMNL)
process, 114, 118, 845management advisory framework
see advisory frameworkManagement Agent, OEM, 899,
902–903Management Options window, 321Management Packs, 824, 895–896Management Repository, Grid
Control, 900, 907Management Server, 925Management Service, OMS, 900, 903managing database
using Oracle tools, 143manual management mode
PGA memory, 129manual segment shrinking, 807–808many-to-many (M:M) relationship,
26mapping files, 117, 862mapping structures, 862MARKUP command, SQL*Plus, 524markup option (-M), SQL*Plus, 505Master Control Process (MCP), Data
Pump, 597materialized views, 209–214
creating, 212–213DBA_MVIEWS view, 1111DBMS_MVIEW package, 212, 1177DBMS_OLAP package, 1177DBMS_REFRESH package, 1181dropping, 214indexes, 209optimizing, 210performance tuning, 968privileges, 446query rewriting, 210refreshing, 211, 212rewrite integrity, 211REWRITE_OR_ERROR hint, 210SQL Access Advisor, 214
Database Control invoking, 215DBMS_ADVISOR package
invoking, 219getting recommendations, 216QUICK_TUNE procedure
invoking, 219MAX function, 1191
MAXEXTENTS parameter,tablespaces, 157
maximum availability mode, DataGuard, 697
maximum extents errors, 270maximum performance mode, Data
Guard, 697maximum protection mode, Data
Guard, 697MAXSIZE parameter, tablespaces, 161MAXTHR mode, 953MAX_DUMP_FILE_SIZE parameter,
985MAX_ESTIMATED_EXEC_TIME
resource plan directive, 820MAX_IDLE_BLOCKER_TIME
parameter, 437MAX_IDLE_TIME parameter, 437MBR mode, 953media corruption, detecting, 692media failures, 701Media Management Layer (MML),
648, 651–652media managers
benefits of RMAN, 649BSP media management software
vendors, 652Oracle Backup tool, 680
media recovery, 703–705non-file-based recovery
compared, 705–706media recovery scenarios
see recoverymedia server, 681medium transport element (mte)
tape libraries, Oracle Backup, 685memory
see also buffersautomatic shared memory
management, 127buffers, 120database buffer cache, 121Java pool, 126large pool, 126least recently used buffers, 122measuring process memory usage,
1061–1062memory allocation, 121
automatic PGA management,129
memory configurationparameters, 342–347
operating system physicalmemory, 1029
program global area, 120, 128–130redo log buffer, 125shared pool, 124Streams pool, 126system global area, 120–127tuning buffer cache, 1016–1019tuning Java pool, 1019tuning large pool, 1019tuning memory resources, 916
tuning Oracle memory, 1004hard parsing and soft parsing,
1007–1015tuning PGA memory, 1020–1024tuning shared pool, 1005–1007tuning streams pool, 1019understanding, 120
Memory Access mode, 892, 1069Memory Advisor
automatic performance tuning,1004
memory-related advisors, 849optimal buffer cache size, 1017
memory managementsee also shared memory
management; automaticshared memorymanagement under SGA
allocating memory between SGAcomponents, 776
automatic memory management,140
operating system memorymanagement, 1057
performance monitoring, UNIX,80
vmstat utility, 81switching to manual memory
management mode, 777memory manager (MMAN) process,
114, 118, 775memory requirements
database creation, 332estimating, preinstallation, 288Oracle Database 10g installation,
281preinstallation checks, 291
memory structures, 119–130program global area, 128–130system global area, 120–127understanding memory, 120
MERGE join, 960MERGE PARTITION clause, 191MERGE statement, 147, 571–573
conditional statements, 572DELETE clause, 573transforming data, 570upserts, 540, 572using UPDATE and INSERT
clauses, 572messages
object database model, 39Oracle Streams Advanced
Queuing, 584sending message to screen,
SQL*Plus, 511metadata
data dictionary, 135, 1083–1084Data Pump utilities, 602
CONTENT parameter, 603DBMS_METADATA package, 1178exporting using Data Pump, 628exporting using external tables,
567filtering using Data Pump, 603
■INDEX1244
importing using Data Pump, 630RMAN, 650, 668transportable tablespaces, 625,
627MetaLink
database security dos and don’ts,486
DBA resources, 14linking OEM Database Control to,
897methods
object database model, 39ORDBMS model, 40
METHOD_OPT attribute, 951metrics
see database metricsMicrosoft Certificate Store, 911Microsoft Transaction Server (MTS),
911midrange systems, 45Millsap, Cary, 14, 1017MIN function, 1191MINEXTENTS parameter,
tablespaces, 157MINIMIZE LOAD option, RMAN, 675MINIMIZE TIME option, RMAN, 675MINUS operator, 1190mirroring, 784, 792, 855mkdir command, UNIX, 62MMAN (memory manager) process,
114, 118, 775MML (Media Management Layer),
RMAN, 648, 651–652MMNL (manageability monitor light)
process, 114, 118, 845MMON (Manageability Monitor)
processAWR collecting statistics, 834database metrics, 826in-memory metrics, 827running ADDM, 763, 765saved metrics, 827tablespace space alerts, 161
MODEL clause/statementexample using, 582–583multidimensional arrays, 580–581producing final output, 582transforming array data with rules,
581–582transforming data, 570, 580–583
modesarchivelog mode, 117OPTIMIZER_MODE parameter,
349read-only mode, 382restricted mode, 382
MODIFY_SNAPSHOT_SETTINGSprocedure, 764
monitoringApplication Performance
Monitoring, 885Data Pump job, 621–622database, using Oracle tools, 143DBA monitoring system, 4, 15DBMS_MONITOR package, 1148
environment monitoring, 885monitoring index usage, 202real-time monitoring, 884
MONITORING USAGE clause, 202more command, UNIX, 52, 59mount points, 282
creating, preinstallation, 291naming conventions, 282OFA guidelines, 283
mounting databaseSTARTUP MOUNT command, 379STARTUP NOMOUNT command,
378STARTUP OPEN command, 379
MREADTIM mode, 953MTS (Microsoft Transaction Server),
911MTTR (mean time to recover), 702MTTR Advisor, 854–855
automatic performance tuning,1004
instance-related advisors, 849V$MTTR_TARGET_ADVICE view,
1126multidimensional arrays, 580–581multiple DBAs
database security dos and don’ts,484
multiplexingbackup guidelines, 635control file, 339flash recovery area, 641multiplexing and mirroring, 855online redo logs, 855redo log files, 110, 635sizing file system for database, 331
multitable inserts, 573–575ETL components, 540loading rows from source table,
574–575MULTITHREADING parameter,
SQL*Loader, 556multivalued dependency, 34multiversion concurrency control
system, 236MULTI_BLOCK_READ_COUNT
parameter, 948mv command, UNIX, 59
NNAME parameter, 272naming
directory naming, 405, 412–416easy connect naming, 405,
410–411external naming, 405, 412local naming, 405–410naming context, 415naming repositories, 405
naming conventionsadministrative files, 285ASM filenames, 795control files, 286data files, 286
database files, 286directories, 283mount points, 282OFA, 281, 286OMF, 174, 802product files, 286redo log files, 286SPFILE, 374tables, 36tablespaces, 286transactions, 229
natural join, 1196join operations, 22
navigating text commandsvi editor, UNIX, 63
NCA (Oracle Net ConfigurationAssistant), 396
modifying tnsnames.ora with,408–410
selecting configuration in, 409testing new configuration in, 409
NDMP (Network Data ManagementProtocol), 685
nested loop join, 948nested subquery, 147nested tables, 1202NET (.NET)
distributed transactions, 911support for Oracle Database 10g,
910Net Configuration Assistant
see NCAnet service names
connect identifiers, 405connecting to Oracle database,
493net stop/start commands, 923netstat command, iSQL*Plus, 530netstat utility, 85network administration files, 107Network Configuration window, 321Network Data Management Protocol
(NDMP), 685network export, Data Pump, 606Network Information Service (NIS),
412network mode, Data Pump, 591network monitoring, UNIX, 85network performance, 1032Network wait class, 1035, 1036Networked Attached Storage (NAS),
93NetWorker, 652networking
see also connectivityanalyzing instance before tuning,
1073configuring naming methods and
listeners, 396configuring network components
during installation, 396connect descriptors, 394connect identifiers, 395connect strings, 395
■INDEX 1245
creating domains and contexts forOID, 396
database instance names, 394database service names, 394global database names, 394how it works, 393–396listener and, 400securing network, 485web application connecting to
Oracle, 393NETWORK_LINK parameter, Data
Pump, 606–607, 619–620NEVER refresh option, 212NEWP[AGE] variable, SQL*Plus, 501NEW_LINE procedure, UTL_FILE,
1170nextval pseudo-column, 222NEXT_EXTENT storage parameter,
157–158NFS file systems, 282NIS (Network Information Service),
412NL (nested loop) join, 960NLS parameters
V$NLS_PARAMETERS view, 1139NLS_DATABASE_PARAMETERS view,
1086NLS_DATE_FORMAT parameter, 339NLS_INSTANCE_PARAMETERS view,
1086NLS_SESSION_PARAMETERS view,
1086NO LOGGING option, 635no workload mode, 953no-prompt logon option (-L),
SQL*Plus, 505noarchivelog mode, 632
making database backups, 687partial database backups, 690
NOAUDIT keyword, 464noclobber shell variable, 57nodes, B-tree index structure, 197nohup option, 74NOLOG option, SQL*Plus, 494NOLOGFILE parameter, Data Pump,
602, 615NOLOGGING/nologging option
creating tables, 181deriving data from existing tables,
571dropping indexes before bulk data
loads, 558redo log buffer, 126
NOMOUNT mode, 361NONE value, AUDIT_TRAIL
parameter, 462nonprefixed indexes, 965nonrepeatable-reads, 230, 233nonunique indexes, 196normal forms, 29–34
1NF (First Normal Form), 302NF (Second Normal Form), 313NF (Third Normal Form), 334NF (Fourth Normal Form), 345NF (Fifth Normal Form), 34
Boyce-Codd normal form (BCNF),33
functional dependencies, 33lossless-join dependency, 34multivalued dependency, 34non-normalized data, 30partial dependencies, 31primary key dependency, 33repeating groups, 31
normal modeSHUTDOWN NORMAL command,
383normal program conclusion, 226normalization, 28–29
denormalization, 34effect on performance, 36
NOT EXISTS operator, 1200NOT NULL constraint, 204NOTFOUND (%NOTFOUND)
attribute, 1208Notification Methods option,
Database Control, 895notification rules, setting, 831NOWAIT option, 227NOWORKLOAD keyword, 953NT Backup utility, 918NTFS file system, 918null values, 203NULLIF parameter, SQL*Loader, 556NUMBER data type, 1185numeric data types, 1185NUM[WIDTH] variable, SQL*Plus,
501NUM_CPUS system usage statistic,
1053NVL function, 1193
Oob host, Oracle Backup tool, 685object database management system
(ODBMS), 38object database model, 38–39object-level audit, 462object-oriented programming,
1201–1203object privileges, 445–448
column-level object privileges, 447directory privileges, 446GRANT ANY OBJECT privilege,
448granting, 446materialized view privileges, 446procedure/function/package
privileges, 446revoking, 448sequence privileges, 446types of Oracle privilege, 442view privileges, 446
object tables, 1202object transparency, 220object types, 577
see also abstract data typesuser-defined object types, 149
object-relational database model, 38,39
objectssee database objects
object_name parameterADD_POLICY procedure, 469
object_schema parameterADD_POLICY procedure, 469
observiced processOracle Backup Web Interface tool,
683obsolete files, 665obtar command-line tool, 686obtool command-line interface, 685OCOPY command, Windows, 918ODBC (Open Database Connectivity)
data access methods, 910integration with Windows services,
911ODBMS (object database
management system), 38ODS user, 447OE (order entry) schema, 1183, 1184OEM (Oracle Enterprise Manager),
138, 883–908accessing UNIX system, 46administering Database Resource
Manager, 441–442benefits of RMAN, 649benefits of using OEM, 884–886
Application PerformanceMonitoring (APM) tools, 885
complete environmentmonitoring, 885
consolidated databasemanagement, 885
integrated systemsmanagement, 886
out of the box management,884
real-time monitoring, 884scalability, 885web-based management, 884
brief description, 396CD, 301Data Pump utilities using, 599database management, 883introduction, 883performance, 138security, 884using OEM to collect Optimizer
statistics, 956using OEM to manage undo data,
254versions, 883, 886viewing ADDM reports, 765,
770–772OEM Clone Database Wizard, 894OEM Database Control, 886–899
accessing Database Control,889–890
ADDM, running ADDM reports,773
ADDM, viewing ADDM reports,770, 772
■INDEX1246
Administration page, 893Alerts table, 829All Metrics page, 826automatic optimizer statistics
collection, 782automatic SGA management with,
779–780cloning database using, 727–729Compare Periods Report,
1076–1078configuration policies, 897configuring automatically, 886configuring Flashback logging, 745configuring manually, 887–889creating Database Control roles,
896creating database links, 860Data Reorganization page, 811Database Performance page, 893,
1068, 1071database usage metrics, 898DBMS_ADVISOR package and, 215default port, 886default URL, 886end-to-end tracing, 991estimating table size before
creating, 176examining database performance,
1067–1072examining SQL response time
with, 1054Hang Analysis page, 1063home page, 890, 1067–1068interface, 631–632invoking SQL Access Advisor, 215linking to MetaLink, 897Maintenance page, 893–894managing advisory framework,
852–853managing alerts, 829–831managing ASM operations783managing AWR snapshots,
836–838managing session locks, 242managing/monitoring database,
144migrating database to ASM,
798–799OEM versions, 883online database reorganization,
811–812Performance Data Report page,
1072Performance page, 891privileges required, 890Related Links section, 896setting alert thresholds, 830setting notification rules, 831Setup page, 894–896starting, 370statistics, 898sysman (super administrator
account), 895upgrading with DBUA, 321
using to run SQL Tuning Advisor,999
version, 138OEM Grid Control, 899–908
components, 899configuration management,
905–906connecting to, 903–905features, 905–906groups, 906home page, 906installing, 900–901links, 907logging in, 904managing enterprise using,
906–908managing groups, 908managing/monitoring database,
144monitoring host performance, 907monitoring servers, 908monitoring Web Applications, 907Oracle software cloning, 894privileges required, 890upgrading with DBUA, 321versions, 138, 883viewing ADDM reports, 770
OEM Management Agent, 899,902–903
OEM Management Repository, 900,904
OEM Management Service, 900, 903,907
OFA (Optimal Flexible Architecture),281–288
administrative files, 285creating directories for database
files, 287database files, 286directory and file naming
conventions, 283flash recovery area, 288mount points, 282naming convention goals, 286OFA-compliant Oracle database,
287Oracle base, 283Oracle home, 283Oracle Inventory Directory, 284product files, 286
offline tablespaces, 164OID (Oracle Internet Directory)
basic idea behind, 414database security, 482directory naming method,
413–414elements of, 413installing, 416LDAP, 413making database connections, 414Oracle components using, 413organization of, 414–416
OLE DB, 910, 911OLTP
see online transaction processing
OMF (Oracle Managed Files),173–174, 800–806
benefits of using, 801control files, 802, 804creating OMF files, 801–802data files, 803database creation using OMF,
803–806adding tablespaces, 805creating database, 804initialization parameters, 803locating OMF files, 804starting database instance, 803Sysaux tablespace, 805System tablespace, 805temporary tablespace, 805undo tablespace, 805
DB_ parameters, 801–802file naming conventions, 802flash recovery area, 640, 644init.ora file, 802initialization parameters, 801–802
database creation, 803introduction, 800limitations, 174naming conventions, 801OMF-related parameters, 341redo log files, 802, 804types of OMF, 802–803
OMS (Oracle Management Service),900, 903
ON COMMIT DELETE/PRESERVEROWS options, 183
ON COMMIT mode, 211ON DEMAND mode, 211one-to-many (1:M) relationship, 26one-to-one (1:1) relationship, 26online backups, RMAN, 649, 673online capabilities, Oracle Database
10g, 811–822data redefinition, 812–818data reorganization, 811–812database block size changes,
820–821database quiescing, 821–822database reorganization, 811–812dynamic resource management,
818–820suspending database, 822
online data redefinition, 812–818methods used, 813online table redefinition example,
814–818privileges, 815redefinition process activity, 816steps involved, 813tasks performed by, 813
online data reorganization, 811–812coalescing an index online, 812creating an index online, 812moving a table online, 812rebuilding an index online, 812using SQL commands, 812validating an object online, 812
■INDEX 1247
online database block size changes,820–821
online database reorganization, 812online redo log files, 109, 855–858
corruption, 857creating database, 365dropping, 857flash recovery area, 641making whole closed backups, 687mirroring, 855monitoring, 857multiplexing, 855redo log groups, 855, 856renaming, 857
online segment shrinking, 806–807online table redefinition, 812online table redefinition example,
814–818checking for errors, 817completing redefinition process,
817copying dependent objects, 816creating temporary table, 815errors occur during, 818redefining temporary table, 815redefinition process activity, 816synchronizing interim and source
tables, 817verifying eligibility of table, 814
online transaction processing (OLTP)automatic shared memory
management, 774database types, 9indexing strategy, 962
OO4O (Oracle Objects for OLE), 910open accounts, 472open backups
automating jobs, 918benefits of archivelog mode, 632making whole open backups,
688–690open database backups, 634user-managed online backup
script, 690OPEN clause, explicit cursors, 1208open recovery, 704OPEN_CONNECTION function,
UTL_SMTP, 1172OPEN_CURSORS parameter, 128, 342OPEN_WINDOW procedure, 878operating system
collecting operating systemstatistics, 952–954
memory management, 1057saving output to, SQL*Plus, 510setting permissions, 484
operating system accountscreating additional, post-
installation, 310operating system authentication
connecting to RMAN, 652database security dos and don’ts,
483enabling, 475
external authentication, 475Oracle Net, 476
operating system commandsrestricting use from SQL*Plus, 498,
505using from within SQL*Plus, 509
restricting use of HOSTcommand, 498
operating system directoriescreating, preinstallation, 296
operating system file systemsdisk I/O performance, 1030
operating system filesUTL_FILE package, 1168–1172
operating system groupscreating, preinstallation, 294
operating system knowledgeDBA background and training, 12
operating system patchespreinstallation checks, 289
operating system physical memoryevaluating performance, 1029
operating system requirementsinstalling the software, 305
operating system softwareverifying, preinstallation, 289–291
OPERATION columnFLASHBACK_TRANSACTION_
QUERY view, 262operation queuing
limiting long transactions with,819
operationsresumable operations, 270
operator class, Oracle Backup tool,685
operators, 1189–1190BETWEEN operator, 1189Boolean operators, 1190comparison operators, 1189IN operator, 1189INTERSECTION operator, 1190LIKE operator, 1189logical operators, 1190MINUS operator, 1190set operators, 1190UNION ALL operator, 1190UNION operator, 1190
OPS$ prefix, 356OPS$ORACLE database account, 475Optimal Flexible Architecture, 281optimistic concurrency control, 235optimization phase
optimizing query processing,939–942
SQL processing steps, 1005Optimizer
see CBOOptimizer hints
setting Optimizer level, 947optimizer statistics
automated tasks feature, 142automatic optimizer statistics
collection, 141, 780–782, 949
manual collection, 783Oracle recommendation, 781
optimizers, 136see also performance
OPTIMIZER_DYNAMIC_SAMPLINGparameter, 350, 955
OPTIMIZER_FEATURES_ENABLEparameter, 350, 970
OPTIMIZER_MODE parameter, 349setting Optimizer level, 946–947setting Optimizer mode, 945–946using Optimizer hints to override,
959options
OPTIONS attribute, 951V$OPTION view, 1137
OPTIONS clause, SQL*Loader, 547ORA–99999 errors
see under errorsOracle Administration Assistant for
NT, 928–929Oracle Advanced Security option, 487
Oracle components using OID, 413using OID, 414
Oracle and Java, 1214–1216Oracle Application Server Single Sign-
OnOracle components using OID, 413
Oracle Backup Solutions Program(BSP), 652
Oracle Backup tool, 134, 680–686admin class, 685administrative domain, 681benefits of, 681command-line interface, 680configuring, 685–686initiating backup, 680installing, 681–683managing/monitoring database,
144NDMP host, 685ob host, 685operator class, 685oracle class, 685performing backups with, 686reader class, 685user class, 685
Oracle Backup Web Interface tool,680, 683–685
Oracle Base directory, 14, 283Oracle by Example (OBE), 14Oracle Certified Associate (OCA), 11Oracle Certified Master (OCM), 12Oracle Certified Professional (OCP),
11Oracle Change Management Pack,
825, 896oracle class, Oracle Backup, 685Oracle Client software, 397–399
TWO_TASK environment variable,399
Oracle Collaboration Suite, 413Oracle components, 930
PRODUCT_COMPONENT_VERSION view, 1085
■INDEX1248
Oracle Configuration ManagementPack, 825, 896
Oracle connectivitysee connectivity
Oracle context, 415Oracle cost-based optimizer
see CBOOracle data dictionary
see data dictionaryOracle data files
see data filesOracle Data Guard, 695–696
data protection modes, 697Oracle Data Migration Assistant, 315Oracle Data Provider for .NET
(ODP.NET), 910Oracle data types, 1185–1186Oracle Database 10g
.NET support, 910CD/client CD, 301creating database, 364–367gathering statistics, 943–945installing on Windows, 919–920integration with Windows services,
910–912online capabilities, 811–822sample schemas, 1183–1184Windows and, 909–912
Oracle Database 10g Architecture,99–144
automatic database management,140–141
checkpoint tuning, 141Database Diagnostic Monitor,
140memory management, 140optimizer statistics collection,
141Segment Advisor, 141Storage Management, 141undo retention tuning, 141
background processes, 114–119archiver, 117checkpoint, 116database writer, 115file mapping monitor, 117job queue coordination, 118log writer, 115manageability monitor, 118manageability monitor light,
118memory manager, 118process monitor, 116system monitor, 117
backup and recovery architecture,133–135
common manageabilityinfrastructure, 141–143
Active Session History, 142advisory framework, 143automated tasks feature, 142Automatic Workload
Repository, 142Segment Advisor, 143server-generated alerts, 142
SGA Memory Advisor, 143SQL Access Advisor, 143SQL Tuning Advisor, 143Undo Advisor, 143
communication with database,137–138
connecting to Oracle, 137iSQL*Plus, 138Oracle Enterprise Manager, 138SQL*Plus, 138
data consistency/concurrency,131–133
database writer, 131system change number, 132undo management, 133write ahead protocol, 131
data dictionary, 135–137data files and tablespaces, 112database architecture/structures,
99–112Database Resource Manager, 140database transaction, 130–131default tablespace type, 107dynamic performance views, 136logical database structures,
100–107data blocks, 100–103extents, 100, 103segments, 100, 104tablespaces, 100, 104–107
managing and monitoring, 143memory structures, 119–130
program global area (PGA), 128system global area (SGA), 120
optimizer, 136physical database structures,
107–112alert log file, 111control file, 108data files, 108password file, 111redo log files, 109SPFILE, 110trace files, 111
processes, 113–119Scheduler, 139server process, 113utilities, 139
Oracle Database 10g installation,279–313
see also installationsaccessing installation software,
301–303disk storage requirements, 280documentation review, 280downloading Oracle software, 301,
302–303final checklist, 300–301initialization parameter file
see initialization parameter fileinstallation types, 304installing, 303–309
using response files, 307–309installing on Windows, 919–920
uninstalling, 930–931
Linux kernel requirements, 292memory requirements, 281mount points, 282Optimal Flexible Architecture,
281–288Oracle software packages, 301–302overview, 279–281post-installation tasks, 309–312preinstallation tasks, 288–300source of Oracle database
software, 280uninstalling Oracle, 312–313
Oracle Database 10g upgrade,315–328
Advanced Installation option, 919Database Upgrade Assistant, 315,
318–321manual upgrade process, 315, 316,
322–328backing up database, 323checking for invalid objects,
325copying init.ora file, 324creating spool file, 323creating Sysaux tablespace, 324DBA_REGISTRY view, 315DBA_SERVER_REGISTRY view,
315ending spool file, 328recompiling and validating
invalidated objects, 325restarting new database, 328running upgrade script, 325starting up new database, 324summary of steps, 322
post-upgrade actions, 328Post-Upgrade Status Tool,
317–318, 326Pre-Upgrade Information Tool,
316–317, 323upgrade methods and tools,
315–318upgrade paths, 315Upgrade Summary window, 321
Oracle database connectivitysee connectivity
Oracle Database Resource Managersee Database Resource Manager
Oracle databasessee databases; relational databases
Oracle Diagnostic Pack, 824, 896Oracle DirectConnect (ODC), 15Oracle Directory Manager, 396, 414Oracle directory replication server,
413Oracle directory server, 413Oracle Enterprise Edition software,
301Oracle Enterprise Manager
see OEMOracle FAQ
DBA resources, 14Oracle file mapping feature, 862–863Oracle Flashback
see Flashback
■INDEX 1249
Oracle Flashback Database featuresee Flashback Database feature
Oracle Flashback Drop featuresee Flashback Drop feature
Oracle Flashback Query featuresee Flashback Query feature
Oracle Flashback Table featuresee Flashback Table feature
Oracle Flashback Transaction Queryfeature
see Flashback Transaction Queryfeature
Oracle Flashback Versions Queryfeature
see Flashback Versions Queryfeature
Oracle home directory, 283creating, preinstallation, 296installing software, 304multiple Oracle homes, 284path, 284syntax, 284
Oracle indexessee indexes
Oracle Installation Guide, 280web source for, 280
Oracle instance, 99starting, 361–363
creating init.ora file prior to,359
restarting, 702Oracle Internet Directory
see OIDOracle Inventory directory, 284
creating, preinstallation, 296Oracle Label Security feature
column-level VPD, 461Oracle listener
see listenersOracle Management Service (OMS),
900, 903Oracle memory structures
see memory structuresOracle Names
OID and, 413Oracle Net
components, 393configuration files, setting location
of, 298connecting to Oracle, 137described, 393GUI and command-line tools, 396operating system authentication,
476Oracle Network Foundation Layer,
393Oracle Protocol Support, 393
Oracle Net Configuration Assistantsee NCA
Oracle Net Listenersee listeners
Oracle Net Manager, 396Oracle Net Services
centralized configuration, 392configuring, post-installation, 312
database connectivity, 391described, 393features, 391location transparency, 391Oracle home directory, 283Oracle components using OID, 413scalability, 392SQL Net Services, 391
Oracle Network Foundation Layer,393
Oracle networkingsee networking
Oracle Objects for OLE (OO4O), 910Oracle ODBC, 910, 911Oracle OLE DB, 910, 911Oracle Optimizer
see CBOOracle owner
post-installation tasks, 297–300,311–312
Oracle performance statisticssee performance statistics
Oracle PL/SQLsee PL/SQL
Oracle PL/SQL packages, 1145, 1146,1182, 1210
DBMS packagessee DBMS packages
UTL packagessee UTL packages
Oracle PMON processsee PMON process
Oracle Policy Manager, 461Oracle processes
see processesOracle Protocol Support
Oracle Net, 393Oracle RAC (Real Application
Clusters), 695, 700Oracle Resource Manager, 865, 1176Oracle Scheduler
see SchedulerOracle schemas
see schemasOracle sequences
see sequencesOracle Service, 922–924
caution: stopping databasedirectly, 923
confusing with Oracle instance,926
stopping all Oracle services, 930threads, 914
Oracle services, Windows, 922–925listener, 924–925Management Server, 925OracleServiceSID, 922–924
Oracle Software Owner usercreating, preinstallation, 295
Oracle Storage CompatibilityProgram (OSCP), 94
Oracle Storage Management buffercache, 775
Oracle Streamssee Streams, Oracle
Oracle synonymssee synonyms
Oracle tablessee tables
Oracle tablespacessee tablespaces
Oracle Technology Network (OTN), 13Oracle triggers
see triggersOracle Tuning Pack, 825, 896Oracle Universal Installer
see OUIOracle views
see viewsOracle Wallets
creating, transparent dataencryption, 478
opening and closing, 480security features, 911
Oracle Warehouse Builder (OWB), 541Oracle XML DB, 1210–1214OracleDBConsole service, 916OracleJobScheduler service, 916
format of names, 925OracleService Windows service, 916OracleServiceSID service, 922–924OracleTNSListener service, 916ORACLE_BASE variable
setting OS environment variables,332
setting, preinstallation, 297Windows registry, 921
ORACLE_DATAPUMP access driver,563, 564, 565, 566
ORACLE_HOME directorypreinstallation checks, 289
ORACLE_HOME variablecreating database using SQL*Plus,
359deleting preinstallation, 300setting OS environment variables,
332setting preinstallation, 297setting SQL*Plus environment, 492Windows registry, 921
Oracle_Home_Name variableWindows registry, 921
ORACLE_LOADER access driver, 562ORACLE_PATH variable, 514ORACLE_SID variable
accessing database fromcommand prompt, 923
creating database using SQL*Plus,359
DB_NAME initializationparameter, 286
registering database in recoverycatalog, 671
setting OS environment variables,332
setting, preinstallation, 298Windows registry, 921
oradebug utility, 1046ORADIM utility, 926–928oraenv script, 311
■INDEX1250
ORAENV_ASK variable, 299oraInst.loc file, 308OraInventory, 284, 296ORAINVENTORY group, 294orakill utility, 490
caution: exercising care whenusing, 914
managing Oracle on Windows, 913OraPub, 14orapwd utility, 474orastack utility, 916oratab file, 310, 311ORA_DBA group, 917Ora_Sid_Autostart variable, 921Ora_Sid_Shutdown variable, 921ORDBMS model, 39ORDER BY clause
DESC keyword, 1189guidelines for use of indexes, 197indexing strategy, 963sorting SELECT statement, 1189
ORDER BY command, 147ORDERED hint, 959ORGANIZATION EXTERNAL clause,
562ORGANIZATION INDEX phrase, 185OS value, AUDIT_TRAIL parameter,
462OS variables, 358–359OSDBA group, 294OSOPER group, 294OS_AUTHENT_PREFIX parameter,
356default value, 475operating system authentication,
475, 483OS_USER attribute, USERENV,
454–455Other wait class, 1035OTHER_GROUPS resource consumer
group, 435, 437OUI (Oracle Universal Installer)
invoking, 302–303prerequisite checks, 305removing components with, 930welcome window, 304
out of space error, 270outer join, 1196outlines
see also stored outlinesOUTLN user account
changing passwords for defaultusers, 371
passwords, databaseauthentication, 471
stored outlines, 970output, SQL*Plus
silent option, 505saving to operating system, 510viewing screen by screen, 511
overwritingavoiding overwriting files, 57
OWB (Oracle Warehouse Builder), 541ownership, UNIX
root directory, 47
O_RELEASE variable, SQL*Plus, 517O_VERSION variable, SQL*Plus, 517
Ppackage privileges, 446packages
DBMS packagessee DBMS packages
executing, SQL*Plus, 511Oracle PL/SQL packages, 1145,
1146, 1182, 1210preinstallation checks, 290UTL packages
see UTL packagespage command, UNIX, 53page faults
vmstat utility, 81page ins/outs
memory management, 80page-level locking, 237pages
monitoring performance withGrid Control, 907
swapping data, 1029PAGES[IZE] variable, SQL*Plus, 501paging
analyzing instance before tuning,1075
system usage problems, 1059PARALLEL command, Data Pump,
621, 612parallel degree limit resource
allocation methodDatabase Resource Manager, 432
parallel executionperformance tuning, 972table functions, 575
PARALLEL parameterbenefits of Data Pump, 590creating tables, 181Data Pump utilities, 609, 614, 617deriving data from existing tables,
571populating external tables, 566SQL*Loader control file, 550
parallel recovery feature, 704parallelism
creating plan directives, 436degree of parallelism, 667
PARALLEL_DEGREE_LIMIT_MTHparameter, 436
PARALLEL_MAX_SERVERSparameter, 352
parameter filescreating parameter file, 333–358Data Pump utilities, 599
PARFILE parameter, 602initialization parameter file
see initialization parameter filepfile administrative directory, 285types of, 333–334
parametersData Pump Export utility, 601–613Data Pump Import utility, 614–621
hidden Oracle parameters, 110initialization parameter file
see initialization parameter fileSHOW PARAMETERS command,
507PARFILE parameter
Data Pump utilities, 602, 615invoking expdp, 599SQL*Loader utility, 552
Parse operationTKPROF utility output, 987–988
parse tree, 1005parsing
deriving parse information, 1007hard parsing and soft parsing,
1007–1015converting hard parse to soft
parse, 1013sessions with high number of
hard parses, 1011–1012latch contention, 1013optimizing query processing, 939
bind variables, 967Oracle SQL transaction stages, 231parse time CPU usage, 1027, 1028scalability, 1013SQL processing steps, 1005using SQL Trace and TKPROF to
examine parse information,1007–1008
partial database backups, 633,690–691
partial dependenciesnormal forms, 31
partial execution, ATO, 995PARTIAL option, DURATION clause
BACKUP command, RMAN, 675partitioned indexes, 200
using appropriate index types, 964partitioned tables, 185–192
archiving data, 186composite partitioning, 189–190creating, 186DBA_PART_TABLES view, 224DBA_TAB_PARTITIONS view, 192hash partitioning, 187–188
creating hash-partitionedtable, 187
list partitioning, 188creating list-partitioned table,
188partition independence, 186partition maintenance, 190–192partition pruning, 185performance tuning, 968range partitioning, 186–187range-hash partitioning, 189range-list partitioning, 189–190
partitioning, 185passwd command, UNIX, 49password file, 111
backup guidelines, 635checking for, 356creating, 474hardcoding user passwords, 482
■INDEX 1251
REMOTE_LOGIN_PASSWORD-FILE parameter, 356, 473
passwordssee also authentication; securitychanging for default users, 371changing passwords, 482changing user’s password, 425database security dos and don’ts,
482default values, 371encrypted passwords, 474hardcoding user passwords, 482managing passwords, 471parameters enforcing password-
related security, 427–428password expiration, 473password file, 473SYS super user, 359SYSTEM account, 359
PASSWORD_GRACE_TIMEparameter, 428
PASSWORD_LIFE_TIME parameter,427
PASSWORD_LOCK_TIME parameter,428
PASSWORD_REUSE_MAX parameter,428
PASSWORD_REUSE_TIMEparameter, 428
PASSWORD_VERIFY_FUNCTIONparameter, 428
paste command, UNIX, 66patches, 1003
applying post-installation, 311,897
applying preinstallation, 291Critical Patch Updates, 486OEM Grid Control, 906operating system patches, 289
Patching Setup option, DatabaseControl, 895
PATH variablessetting OS environment variables,
332setting preinstallation, 298UNIX, 54
paths, UNIXexecuting SQL scripts in SQL*Plus,
514file locations, 47
pattern matching, SQL*Plus, 519pattern matching, UNIX, 65pattern recognition
grep command, UNIX, 49PAUSE command, SQL*Plus, 511PAU[SE] variable, SQL*Plus, 501PCTFREE parameter, 152, 158PCTTHRESHOLD parameter, 185PCTUSED parameter, 152, 158pending area
creating, Database ResourceManager, 433
submitting, Database ResourceManager, 438
validating, Database ResourceManager, 437
percent fullsetting tablespace alert thresholds,
162performance
see also indexesabnormal increase in process size,
1061–1062ad hoc SQL, 1013analyzing instance performance,
1035–1052analyzing problems using ADDM,
1055analyzing recent session activity
with ASH, 1057Automatic Database Diagnostic
Monitor, 140benefits of Data Pump, 590benefits of using tablespaces, 105bind variables, 1006cache misses affecting
performance, 125collecting trace statistics, 984database hangs, 1058–1065delays due to shared pool
problems, 1062designing tables, 36dynamic performance tables, 136dynamic performance views, 136,
1131–1134evaluating system performance,
1024–1030CPU performance, 1024, 1029disk I/O, 1030operating system physical
memory, 1029examining system performance,
1053gathering statistics, 845instance performance
see instance performancelicensing performance tools, 824locking issues, 1060logging on and off, 1014measuring I/O performance,
1030–1032I/O optimal distribution, 1031
measuring process memory usage,1061–1062
minimizing downtime, 5monitoring host with Grid
Control, 907monitoring system with Grid
Control, 907network performance, 1032operating system memory
management, 1057optimizers, 136Oracle DBA’s role, 3Oracle Enterprise Manager, 138partitioning, 185performance/diagnostics-related
parameters, 349–353problems due to bad statistics,
1062
reducing I/O contention, 1032SAME guidelines for optimal disk
usage, 1032scalability, 1013severe contention for resources,
1060system global area, 120system usage problems, 1059tablespace type, 107temporary tables, 183tracing the entire instance, 990using AWR reports for individual
SQL statements, 1055–1057performance advisors
ADDM recommendations, 763Performance Analysis section,
Database Control, 1068Performance Data Report page,
Database Control, 1072performance monitoring
dynamic performance views,1128–1130
performance monitoring, UNIX,79–85
bandwidth, 81CPU usage, 79, 81disk storage, 80input/output statistics, 82memory management, 80, 81page faults, 81processes, 81read/write operations, 82tools, 81–85
GlancePlus, 84iostat utility, 82netstat utility, 85sar command, 82top command, 83vmstat utility, 81
Performance page, Database Control,891
performance statistics, 823–828AWR providing, 142, 834baseline data, 824cumulative statistics, 824database metrics, 826–828database statistics, 823operating system statistics, 823sample data, 824
performance tuning, 937–1000ADDM and, 759analyzing instance before tuning,
1066–1079approach to tuning SQL
statements, 999–1000automatic checkpoint tuning, 141,
810automatic undo retention tuning,
141AWR and, 759–760buffer cache, 1016–1019cost-based optimizer
see CBO
■INDEX1252
DBA strategies for, 967–974caching small tables in
memory, 974collecting system statistics, 972rebuilding tables and indexes
regularly, 973reclaiming unused space, 974refreshing statistics frequently,
972using compression
(table/index key), 968using histograms, 972–973using materialized views, 968using parallel execution, 972using partitioned tables, 968using stored outlines to
stabilize CBO, 969–971DBA system management role, 5DBA_SQLTUNE_PLANS view, 1112end-to-end tracing, 989–991hard/soft parsing, 1007–1015identifying inefficiency in SQL
statements, 999instance tuning, 1001–1003
analyzing instance beforetuning, 1066–1079
Instance Efficiency section,AWR, 842
Java pool, 1019large pool, 1019memory resources, 916optimizing query processing,
939–943optimization phase, 939–942parsing phase, 939query execution phase, 942
Oracle memory, 1004Oracle Tuning Pack, 825, 896PGA memory, 1020–1024reactive performance tuning,
938–939self-tuning mechanism, 834shared pool, 1005–1007soft/hard parsing, 1007–1015SQL Tuning Advisor, 143, 999streams pool, 1019systematic approach to, 938tuning related advisors, 850using dictionary views for SQL
tuning, 994writing efficient SQL, 957–967
avoiding improper use ofviews, 967
avoiding unnecessary full tablescans, 967
bind variables, 967indexing strategy, 962–965inline stored functions,
966–967monitoring index usage, 965removing unnecessary indexes,
965selecting best join method, 960selecting best join order, 961
using Bitmap join indexes,960–961
using hints to influenceexecution plan, 959–960
using similar SQL statements,965
WHERE clauses, 957–959performance tuning tools, SQL,
974–999Autotrace utility, 979–983EXPLAIN PLAN tool, 974–979SQL Trace tool, 983–985SQL Tuning Advisor, 999TKPROF utility, 985–989TOAD software, 999V$SQL view, 992–994
permanent filesflash recovery area, 641
permanent tablespaces, 107, 168permissions, UNIX files, 59, 60
setting, 60, 295, 484pessimistic concurrency control, 235pfile (initialization parameter file)
see initialization parameter filepfile administrative directory, 285PGA (program global area), 120,
128–130automatic PGA management, 129caution: DBA overemphasis on
SGA, 780managing/monitoring database,
144memory-configuration
parameters, 342–347V$PGASTAT view, 1119V$V$PGA_TARGET_ADVICE view,
1119PGA memory
analyzing instance before tuning,1075
automatic memory management,1020–1021
automatically enabling/disabling,774
manual management mode, 129memory requirements, 129memory types, 128setting memory limit, 1020tuning, 1020–1024tuning target value, 1020V$PGA_TARGET_ADVICE view,
1020PGA Memory Advisor, 143PGA_AGGREGATE_TARGET
parameter, 129–130, 346automatic memory management,
140automatic PGA management, 129,
1020setting value of, 1021–1024
phantom readsdata concurrency problems, 230isolation levels and, 233
phyblkrd, 1049phyrds, 1049
physical database backups, 631, 634physical database design, 34–37
converting logical design, 34implementing, 37
physical database structures, 107–112alert log file, 111control files, 107, 108data files, 107, 108password file, 111redo log files, 107, 109server parameter file, 110trace file, 111
physical devicesmapping Oracle files to, 862–863
physical files, 107physical reads, 1016physical standby databases, 696PID (process ID), UNIX, 74ping command, 396pinhits, library cache, 1009pinned buffers, 121pinning objects in shared pool,
1014–1015pipe (|) command, UNIX, 52, 57PIPELINED keyword, 578Pipelines, The, 14pipelining table functions, 575plan directives
see resource plan directivesplan stability feature, Oracle
see stored outlinesPlan table, 1087platform version
preinstallation checks, 288PL/SQL, 1203–1210
conditional control, 1205declaring variables, 1204displaying output on screen, 501explicit cursors, 1208functions, 1210handling errors, 1205implicit cursors, 1207looping constructs, 1206packages, 1210procedures, 1209records, 1207writing executable statements,
1204PL/SQL block, 1203–1204
BEGIN statement, 1203DECLARE statement, 1203DML statements, 1205END statement, 1203EXCEPTION statement, 1203SELECT statement, 1204
PL/SQL packages, 1145, 1146, 1182,1210
DBMS packagessee DBMS packages
UTL packagessee UTL packages
PLSQL_OPTIMIZE_LEVEL parameter,353
PLUSTRACE role, 980
■INDEX 1253
PM (product media) schema, 1183,1184
PMON (process monitor) process,114, 116
dynamic service registration, 401Oracle Service thread, 914timer idle events, 1052
point-in-time recovery (PITR)database recovery, 700error correction using undo data,
254policy-based configuration
frameworkOEM Database Control, 897
policy functionscreating package to access
context, 457creating security policy, 458fine-grained access control, 457making public, 460performance, 458
policy groupcolumn-level VPD, 461
Policy Manager, 461policy_name parameter, 469polymorphism, 39port number
connect descriptors, 394port parameter
easy connect naming, 410ports
viewing ports in use, 886POSITION clause, SQL*Loader, 546post-installation tasks, 309–312
applying patches, 311configuring Oracle Net Services,
312creating additional operating
system accounts, 310Oracle owner, 311–312setting environment variables, 311setting initialization parameters,
311system administrator, 309–310updating shutdown/start-up
scripts, 310Post-Upgrade Status Tool, 317–318
manual upgrade process, 326–327POWER clause, REBALANCE
command, 794PRAGMA AUTONOMOUS
TRANSACTION statement,268
preinstallation checks, 288–301applying patches, 291changing login scripts, 293changing shell limits, 293checking preinstallation
requirements, 288creating Oracle Software Owner
user, 295Database Upgrade Assistant, 316DISPLAY variable, 301file permissions, 295kernel parameters, 292
kernel version, 290mount points, 291operating system directories, 296
data storage directories, 297flash recovery area, 297Oracle home directory, 296Oracle Inventory directory, 296
operating system groups, 294ORAINVENTORY group, 294OSDBA group, 294OSOPER group, 294
operating system packages, 290operating system version, 290Oracle kernel, 300Oracle owner, 297–300physical space and memory
requirements, 291setting environment variables, 297
DISPLAY variable, 298DISPLAY variable, 299–300ORACLE_BASE variable, 297ORACLE_HOME variable, 297,
300ORACLE_SID variable, 298ORAENV_ASK variable, 299PATH variable, 298TNS_ADMIN variable, 298
swap space, 300system administrator, 289–297temporary space, 300verifying operating system
software, 289–291X Window System emulation, 301
Pre-Upgrade Information Tool,316–317
manual upgrade process, 323predefined variables, SQL*Plus, 517predicate columns, indexing, 963predicates
dynamic access predicates, 457hr_security package, 458
prefixed indexes, 965PreparedStatement object, 417prerequisite checks
installing software, 305primary indexes, 196, 962primary key dependency
normal forms, 33primary keys, 26, 35
converting logical into physicaldesign, 35
guidelines for use of indexes, 197online data redefinition, 813online table redefinition, 814primary key constraint, 203
enforcing constraints, 36sequences generating, 222
PRINT parameter, TKPROF, 986PRINT SCRIPT command, 655PRINT_PRETTY_SQL procedure, 736private data
components of Oracle process,1061
private database linkscreating, 858–859
private synonyms, 220, 221PRIVATE_SGA resource parameter,
427privilege-level audit, 462PRIVILEGE variable, SQL*Plus, 517privileged connections, SQL*Plus,
492privileged users, 473privileges
CONNECT privilege, 423controlling data access, 442–449CREATE SESSION privilege, 423creating database using SQL*Plus,
359creating materialized views, 212creating users, 423data dictionary views, 1093–1096Data Pump, 594, 596database security, 442–449DBA views for managing, 452described, 442Flashback technology, 742GRANT statement, 442granting privileges, 483
object privileges, 256, 446system privileges, 443–444through roles, 487to roles, 450to several users, 525
installing software, 306object privileges, 445–448revoking object privileges, 448revoking system privileges, 444SQL*Plus security, 496SYSDBA privilege, 359, 445SYSOPER privilege, 445system privileges, 442–445types of Oracle privilege, 442
proactive tuning, 5problem-related alerts, 828procedure privileges, 446procedures
see also stored proceduresexecuting, SQL*Plus, 511PL/SQL, 1209
process monitor (PMON) processsee PMON
process numberderiving from V$SESSION view,
490processes
abnormal increase in process size,1061–1062
background processes, 114–119components of Oracle process,
1061continuous processes, 113CPU units used by processes, 1025description, 113freeing up resources from dead
processes, 116managing Oracle on Windows and
UNIX, 912measuring process memory usage,
1061–1062
■INDEX1254
Oracle Administration Assistantfor NT, 928
Oracle processes, 113–119parameter determining number of
parallel executionprocesses, 352
process-related parameters, 342server processes, 113–114system usage problems, 1059thread analogy, 113user processes, 113V$PROCESS view, 1133V$PROCESS_MEMORY view, 1134viewing process information, 928
PROCESSES parameter, 342processes, UNIX, 74
gathering process information, 74running processes after logging
out, 74running processes in the
background, 74terminating processes, 75vmstat utility, 81
product files, 282, 286naming conventions, 286
production databases, 9caution: moving from
development/testing, 962production DBA, 8PRODUCT_COMPONENT_VERSION
view, 1085product_user_profile table, SQL*Plus,
496, 497, 498profile (.profile) file, UNIX, 54, 55profiler
DBMS_PROFILER package,1165–1167
profilessee also user profilesaltering profiles, 488DBA_PROFILES view, 1092Load Profile section, AWR, 842parameters enforcing password-
related security, 427–428parameters limiting resource
usage, 427program global area
see PGAprograms, Oracle Scheduler, 864,
869–870projection operations
brief description of projection, 942heuristic strategies for query
processing, 942SELECT statement, 1186unary operations, 21
PROMPT command, SQL*Plus, 511prompts, SQL*Plus, 492
no-prompt logon option, 505showing information in, 508
propertiesobject database model, 39showing properties of columns,
SQL*Plus, 512transactions, 228
protocol addressconnect descriptors, 395
protocolscommunication protocol, 394LDAP, 413write ahead protocol, 116
proxy authentication, 476proxy copies, RMAN, 656proxy_user attribute, USERENV, 455ps command, UNIX, 74, 81PS1 shell variable, 51pseudo-columns
Flashback Versions Query feature,259
public database links, 859–860public synonyms, 220, 221PUBLIC user group, 444, 451pupbld.sql script, SQL*Plus, 496PURGE clause/commands, 741–742PURGE option
dropping tables, 182permanently removing objects,
739PURGE_LOG procedure, 875put command, UNIX, 79PUT procedure
DBMS_OUTPUT package, 1159UTL_FILE package, 1170
PUT_FILE procedure, 861, 1147PUT_LINE procedure
DBMS_OUTPUT package, 1159UTL_FILE package, 1170
pwd command, UNIX, 49
Qqueries
hierarchical queries, 1194optimizing, 136resumable operations, 270
query optimization, 939see also CBOrule-based approach, 943
QUERY parameter, Data Pump, 604,613, 617
query processingexecution plans, 939heuristic strategies for, 942optimization phase, 939–942parsing phase, 939performance tuning, 939–943query execution phase, 942query rewrite phase, 940
QUERY REWRITE privilege, 212query rewriting, 210QUERY_REWRITE_ENABLED
parameter, 210, 350QUERY_REWRITE_INTEGRITY
parameter, 211, 350Quest Software, 884Queue Monitor Coordinator (QMNC),
119QUEUEING_MTH parameter, 436
queuesALERT_QUE queue, 829limiting long transactions, 819system usage problems, 1059
QUEUESIZE parameter, listener, 403QUEUE_SPEC attribute,
CREATE_JOB, 874QUICK_TUNE procedure
DBMS_ADVISOR package, 1180invoking SQL Access Advisor, 219
quiescing, 821–822QUIT command, SQL*Plus, 495, 523QUIT function, UTL_SMTP, 1172quotas, tablespaces, 161
RR (-R) restrict option, SQL*Plus, 505RAID (redundant array of
independent disk) systems,88–92
backup guidelines, 635backups, 92disk I/O performance, 1030file mapping feature, 862HARD initiative, 694implementing, 92Oracle and RAID, 92RAID levels, 88
choosing the best RAID level,90–91
RAID 0+1: striping andmirroring, 90
RAID 0: striping, 88RAID 1: mirroring, 89RAID 2: striping with error
detection and correction, 89RAID 3: striping with dedicated
parity, 89RAID 4: modified striping with
dedicated parity, 89RAID 5: modified striping with
interleaved parity, 89reducing DBA vulnerability with
recoveries, 706redundant disk controllers, 91
RAISE_APPLICATION_ERRORexception, 1170
RAM (random access memory), 120range partitioning, 186–187range-hash partitioning, 189range-list partitioning, 189–190RANK function, 1193RATIO method, 436rationales, ADDM, 763raw devices
disk I/O performance, 1030rc scripts
updating shutdown/start-upscripts, 310
rcp command, UNIX, 78RCPT function, UTL_SMTP, 1172rdbms ipc message idle events, 1052reactive tuning, 5
■INDEX 1255
read committed isolation level, 233,234–235, 236
read consistency, 131read-only mode, 382read-only tablespaces, 107, 163read permission, UNIX files, 59read uncommitted isolation level, 233reader class, Oracle Backup, 685read/write operations, UNIX
sar command, 82README files, 280READY status, listener, 402Real Application Clusters (RAC), 695,
700REBALANCE command, ASM, 794rebalance master (RBAL) process, 118REBUILD command
maintaining indexes, 202Recommendation Options page
SQL Access Advisor, 217recommendations
reading ADDM reports, 768Recommendations column, ADDM,
772Recompile Invalid Objects window
upgrading with DBUA, 320RECORD parameter, TKPROF, 986records, PL/SQL, 1207RECORD_FORMAT_INFO clause, 562RECOVER command, RMAN, 709RECOVER command, SQL*Plus, 524RECOVER COPY command, RMAN,
676RECOVER DATABASE command,
RMAN, 712, 714RECOVER TABLESPACE command,
RMAN, 715recoverer (RECO) process
background processes, 119Oracle Service thread, 915
recoverysee also backup; Flashbackarchitecture, 133–135automatic checkpoint tuning, 810block media recovery, 753cache recovery, 701closed recovery, 704complete recovery, 705crash and instance recovery,
701–702damaged disk drive, 738data file recovery, 715–717
without backup, 725–726database incarnations, 720database recovery, 699–756disaster recovery, 695–697dynamic performance views,
1126–1128Fast Start Fault Recovery, 701flash recovery area, 354, 640–648Flashback/traditional techniques
compared, 738flashback techniques, 135granular recovery, 730–736
incomplete recovery, 704–705,717–721
media recovery, 703–705dropping data file, 703non-file-based recovery
compared, 705–706restoring vs. recovering, 703scenarios, 711–726time required for recovery, 704
open recovery, 704parallel recovery feature, 704performing recovery with RMAN,
707–711benefits of using RMAN, 707identifying backups available,
708–709identifying necessary files for
recovery, 709monitoring RMAN jobs, 710recovering with incrementally
updated backups, 710RMAN recovery procedures,
709–710validating if backup possible,
708validating RMAN backups, 708
recoverer (RECO) process, 119recovering an instance, 354recovering from loss of control
files, 722–725recovering with incrementally
updated backups, 710recovery errors, 754–756recovery-related parameters,
354–355reducing DBA vulnerability, 706restarting the instance, 702restore points, 750–752RMAN (Recovery Manager), 134,
648–679Simplified Recovery Through
Resetlogs, 720Tablespace Point-in-Time
Recovery, 730–731tablespace recovery, 714–715transaction recovery, 701trial recovery, 753–754types of database failures, 699–701user-managed recovery
procedures, 710–711using LogMiner utility, 731, 736V$RECOVERY_PROGRESS view,
1122whole database recovery, 711–714
performing hot restore withRMAN, 713
recovery catalog, RMAN, 650–651backing up recovery catalog, 672benefits of RMAN, 649connecting to RMAN, 653, 669creating recovery catalog, 670creating recovery catalog schema,
669granting roles to maintain/query,
669
objections to, 651performing PITR, 669recovery catalog schema, 650registering database, 671resynchronizing recovery catalog,
671working with, 668–672
Recovery Configuration windowupgrading with DBUA, 321
Recovery Managersee RMAN
recovery strategies, 6RECOVERY WINDOW option, RMAN,
666recovery writer, 119recursive CPU usage, 1029recursive relationship, 28recursive SQL
dictionary-managed tablespaces,106
locally managed tablespaces, 107Recycle Bin, 740
DBA_RECYCLEBIN view, 1089dropped objects, 739permanently removing objects
from, 739, 742restoring dropped tables, 741
recycle buffer cache, 775recycle buffer pool, 123
determining candidates for, 1018setting size of recycle pool, 344using multiple pools for buffer
cache, 1017–1018recyclebin
SHOW RECYCLEBIN command,506
RECYCLEBIN parameterturning Flashback Drop capability
off, 739Red Hat Linux server
Oracle Database 10g installationon, 279
redirection, UNIXinput/output redirection, 56pipe (|) command, 57
redo entries, SQL*Loader, 554redo log buffer, 109
log writer process, 125–126nologging option, 126parameter setting size, 345system global area, 121, 125transferring contents to disk, 115
redo log files, 109after image records, 109alert log during database creation,
367analyzing instance before tuning,
1074arch administrative directory, 285archivelog mode, 632
backing up in, 673archivelog/noarchivelog modes,
110archiver process, 1058archiving, SQL*Plus, 524
■INDEX1256
backup and recovery architecture,134
backup guidelines, 635benefits of temporary tables, 183control file, 108database files, 286default file locations, 645defining format for archived, 347description, 107dynamic performance views,
1123–1125flash recovery area, 645how they work, 109information contained, 109making whole closed backups, 687multiplexing, 110, 635
sizing file system for database,331
naming conventions, 286noarchivelog mode, 632online redo logs, 855–858
see also online redo logsopen backups, 689optimal size, 331Oracle Managed Files, 802Oracle recommendations, 331Pre-Upgrade Information Tool, 317RESETLOGS option, 719sizing file system for database, 331space request, high values for,
1052transactions, 109using LogMiner to analyze,
735–736redundancy, 792
backup guidelines, 635REDUNDANCY keyword
creating ASM disk groups, 793REDUNDANCY option, RMAN, 665redundancy set, 636–637, 706REENABLE clause, SQL*Loader, 556REF CURSOR type
cursor variables, 1209mining web services data, 579table functions using, 577–578
referential integrity constraints, 205foreign keys enforcing, 36
REFRESH COMPLETE clause, 213REFRESH FAST ON COMMIT clause,
214refresh modes, materialized views,
211refresh types, materialized views, 211,
212REGEDIT command, Windows
registry, 921REGEXP_LIKE function, 1200REGEXP_XYZ functions, 1200REGISTER DATABASE command,
RMAN, 671registerDriver method,
DriverManager, 417registration
dynamic service registration, 117
registryDBA_REGISTRY view, 1085
registry keysHOMEID key, 921removing Oracle components, 930
regular expressions, 1200–1201pattern matching, UNIX, 65
Related Links section, DatabaseControl, 896
relational algebra, 21Cartesian product, 21difference, 21intersection, 21join operations, 22unary operations, 21union, 21
relational calculus, 22relational database model, 38
ORDBMS model, 39relational databases, 19–37
see also databases; OracleDatabase 10g
database schema, 21introduction, 19–20life cycle, 23–37
implementing physical design,37
logical database design, 24–34physical database design,
34–37requirements, 23–24
limitations, 38relational database model, 20–23
relationships (ER modeling), 25building entity-relationship
diagram, 28cardinality of, 25converting logical into physical
design, 35many-to-many (M:M)
relationship, 26one-to-many (1:M) relationship,
26one-to-one (1:1) relationship, 26recursive relationship, 28types, 25
relative distinguished names, 415relative path, UNIX
file locations, 47navigating directories, 62
Release Notes and Addendums, 280releases
upgrade paths, 315Reliaty, Oracle Backup, 680reload command, lsnrctl utility, 403reloads, library cache, 1009RELY constraints, 206remapping, Data Pump, 591REMAP_DATAFILE parameter, 618REMAP_SCHEMA parameter, 591,
618REMAP_TABLESPACE parameter, 618REMARK command, SQL*Plus, 518,
522
remote access to UNIX server, 77remote client authentication, 486REMOTE_LOGIN_PASSWORDFILE
parameter, 356, 473, 474REMOTE_OS_AUTHENT parameter,
483REMOVE procedure, DBMS_JOB,
1152removing files, UNIX, 59REMUSER command, iSQL*Plus, 534RENAME PARTITION clause, 191repeatable-read isolation level, 232repeating groups, normal forms, 31REPEAT_INTERVAL attribute
CREATE_JOB procedure, 868CREATE_WINDOW procedure, 878
REPFOOTER command, SQL*Plus,513
REPHEADER command, SQL*Plus,513
REPLACE clause, SQL*Loader, 544REPLACE function, 1191REPORT commands, RMAN, 662–663
REPORT NEED BACKUP, 662REPORT OBSOLETE, 662REPORT SCHEMA, 662, 671REPORT UNRECOVERABLE, 662
reports, AWR, 840, 844REPORT_TUNING_TASK procedure,
998, 1181requirements
estimating, 6relational database life cycle,
23–24RESETLOGS option, 719, 720–721RESIZE clause/command
altering bigfile tablespaces, 171data files and tablespaces, 154expanding tablespaces, 160
resource allocation methods, 432resource consumer groups
assigning users to, 438–440automatic assignment of, 439CONSUMER_GROUP parameter,
433creating, 433–435Database Resource Manager, 431default resource plans, Oracle, 435determining which groups exist,
434groups granted to users or roles,
441groups in Oracle databases, 435listing, 435OEM managing, 442sessions currently assigned to, 441SWITCH_CURRENT_CONSUMER
_GROUP procedure, 1156V$RSRC_CONSUMER_GROUP
view, 441resource management
dynamic resource management,818–820
■INDEX 1257
Resource ManagerDBMS_RESOURCE_MANAGER
package, 1176linking Oracle Scheduler to, 865
Resource Monitors page, 441resource plan directives
creating plan directives, 436–437Database Resource Manager, 432,
819including resource directive for
other_groups, 437Resource Plan Wizard, 433resource plans
changing using Schedulerwindows, 876–880
creating, 436Database Resource Manager, 431DBA_RSRC_PLANS view, 1098determining status of, 438OEM creating/editing/deleting,
442showing all plans in database, 441showing currently active plans,
441V$RSRC_CONSUMER_GROUP
view, 1134V$RSRC_PLAN view, 1134
resourcescontrolling allocation, 140controlling user’s use of, 426–430Database Resource Manager, 140,
431–442DBA, 13–14finding SQL that uses most,
992–994freeing resources from dead
processes, 116OEM Grid Control, 906parameters enforcing limits in
user profiles, 353caution: ensuring limits are
activated, 429default profile, 428determining limits, 430result of reaching limit, 430
parameters limiting resourceusage, 427
query optimization, 939resource management for users,
430severe contention for, 1060SQL Trace tool showing usage of,
984system usage problems, 1059tuning memory resources, 916
RESOURCE_CONSUMER_GROUPattribute, 875
RESOURCE_LIMIT parameter, 353,429
RESOURCE_MANAGER_PLANparameter, 440
RESOURCE_PLAN attribute, 877response files, 307–309RESTORE...PREVIEW command,
708–709
RESTORE...VALIDATE command, 708RESTORE command, RMAN, 709RESTORE DATABASE command,
RMAN, 712restore optimization, RMAN, 707restore points, 750–752RESTORE TABLESPACE command,
715restoring
performing hot restore withRMAN, 713
restoring vs. recovering, 703V$RESTORE_POINT view, 1127
RESTRICT command, SQL*Plus, 498restrict option (-R), SQL*Plus, 505restricted mode
database access, 382quiescing database, 385
Results for Task pageSQL Access Advisor, 218
ResultSet object, JDBC, 418RESUMABLE parameter, SQL*Loader,
550Resumable Space Allocation feature,
269–273ALTER SESSION command, 271common resumable errors, 270DBMS_RESUMABLE package,
1176enable session for, 271naming resumable operation, 272notification of suspended
operations, 273operation suspended alert, 273parameter enabling/disabling, 355resumable operation example, 272resumable operations, 270, 273RESUMABLE_TIMEOUT
parameter, 271TIMEOUT clause, 271
RESUMABLE_NAME parameter,SQL*Loader, 550
RESUMABLE_TIMEOUT parameter,SQL*Loader, 271, 355, 550
RESYNC CATALOG command,RMAN, 672
RETENTION GUARANTEE clause,252
RETENTION NOGUARANTEE clause,252
RETENTION parameter, AWR, 839,840
retention period, Oracle Backup, 686return codes, SQL*Loader, 553REUSE_DATAFILES parameter, Data
Pump, 616reverse-engineering databases, 38reverse key indexes, 199, 964Review page
SQL Access Advisor, 217REVOKE statement
revoking object privileges, 448revoking system privileges, 444
REVOKEROLE command, iSQL*Plus,535
rewrite integrity, 211REWRITE_OR_ERROR hint, 210Rios, Don, 1066Risk Matrix, 487rlogin command, UNIX, 78rm command, UNIX, 59, 62RMAN (Recovery Manager), 648–679
architecture, 649–652backup and recovery architecture,
134backup duration, specifying limits
for, 675backup formats, 657backup guidelines, 636backup optimization, 667backup piece, 655backup retention policy, 665backup set, 655backup tags, 657backup types, 672–675
backing up archived logs, 673backing up control file, 674backing up data files, 675backing up entire database, 672backing up tablespaces, 674online backups, 673–674
backup, restarting, 675backups, compressed, 678backups, fast incremental, 677backups, incrementally updated,
676benefits of, 648–649block change tracking, 677block media recovery (BMR), 705BLOCKRECOVER command, 753change tracking writer, 119channel configuration, 666channels, 656cloning a database using, 727commands
see RMAN commandsconfiguration parameters, 664–668
see also RMAN configurationparameters
connecting to, 651–653, 669control file parameters, 668converting data files to match
endian format, 629cross-checking backups, 679default device type, 666degree of parallelism, 667detecting physical/logical
corruption, 679image copy, 655–656image copy backups, 659incremental backups, 659–660large pool, 126logical check of backup files, 659managing/monitoring database,
144media recovery process, 704migrating database to ASM,
797–798MML (Media Management Layer),
651–652
■INDEX1258
monitoring and verifying RMANjobs, 678
open backups, 689performing backup and recovery
tasks, 710performing recovery with, 707–711
benefits of using RMAN, 707data file recovery, 716identifying backups available,
708–709identifying necessary files for
recovery, 709incomplete recovery, 717–721monitoring RMAN jobs, 710recovering a tablespace,
714–715recovering data file without
backup, 725–726recovering from loss of control
files, 722–723recovering with incrementally
updated backups, 710RMAN recovery procedures,
709validating if backup possible,
708validating RMAN backups, 708
physical database backups, 631proxy copy, 656recovering from data block
corruption, 753recovery catalog
see recovery catalog, RMANRMAN backups, 657–658RMAN client, 650RMAN executable, 650RMAN repository, 650–651scripting with, 653–655
checking syntax of RMANscripts, 654
converting RMAN scripts, 654creating and running scripts,
653–654creating global RMAN scripts,
654–655printing RMAN scripts, 655
starting database using, 712terminology, 655–656user-managed backups
alternative, 687V$RMAN_CONFIGURATION view,
1120whole database recovery using,
711–713performing hot restore with
RMAN, 713RMAN commands, 658–664
ALLOCATE CHANNEL, 660BACKUP, 659–660, 671BACKUP ARCHIVELOG ALL, 673BACKUP AS COMPRESSED
BACKUPSET, 678
BACKUP AS COPY, 659, 661LOGICAL keyword, 659
BACKUP CONTROLFILE TOTRACE, 680
BACKUP CURRENTCONTROLFILE, 674
BACKUP DATABASE, 672BACKUP DATABASE PLUS
ARCHIVELOG, 673BACKUP DATAFILE, 675BACKUP INCREMENTAL LEVEL,
659–660, 676BACKUP TABLESPACE USERS, 674BACKUP VALIDATE DATABASE
ARCHIVELOG ALL, 679CATALOG, 663CATALOG START WITH, 663CONFIGURE, 665CONFIGURE CHANNEL, 667CONFIGURE DEFAULT DEVICE
TYPE TO, 666CONFIGURE DEVICE, 667CONFIGURE RETENTION
POLICY, 665RECOVERY WINDOW option,
666REDUNDANCY option, 665
CONNECT CATALOG, 669COPY, 661, 671CREATE CATALOG, 670CROSSCHECK, 662, 664, 679DELETE, 661DELETE EXPIRED, 662DELETE OBSOLETE, 662DROP CATALOG, 670DUPLICATE, 727job commands, 660–662LIST ARCHIVELOG ALL, 664LIST BACKUP, 663LIST COPY, 664LIST GLOBAL SCRIPT NAMES, 664LIST INCARNATION, 720LIST SCRIPT NAMES, 664RECOVER COPY, 676RECOVER DATABASE, 712RECOVER TABLESPACE, 715REGISTER DATABASE, 671REPORT NEED BACKUP, 662REPORT OBSOLETE, 662REPORT SCHEMA, 662, 671REPORT UNRECOVERABLE, 662RESTORE DATABASE, 712RESYNC CATALOG, 672RUN, 660SHOW ALL, 664SWITCH, 660–661, 713VALIDATE BACKUPSET, 664
RMAN configuration parameters,664–668
backup optimization, 667backup retention policy, 665channel configuration, 666control file backups, 668default device type, 666
default values, 664viewing parameters changed
from, 665degree of parallelism, 667
rmdir command, UNIX, 62roles
controlling data access, 449–452creating, 450creating Database Control roles,
896data dictionary views, 1093–1095Data Pump utilities, 612, 614database security, 449–452DBA views for managing, 452DELETE_CATALOG_ROLE, 444disabling, 451, 487dropping, 452enabling, 452EXECUTE_CATALOG_ROLE, 444granting privileges alternative, 483granting privileges through, 487granting privileges to, 450granting role to another user, 451granting role WITH ADMIN
OPTION, 451granting roles to maintain/query
RMAN, 669PUBLIC user group and roles, 451,
483role authorization, 450–451SELECT_CATALOG_ROLE, 444SET_ROLE procedure, 1155
ROLE_ROLE_PRIVS view, 1093ROLE_SYS_PRIVS view, 1094ROLE_TAB_PRIVS view, 1094ROLLBACK command, 133rollback method, conn class
error handling in Java, 419executing SQL statements, JDBC,
418rollback segments
alert log during database creation,367
undo management, 133, 800using CTAS with large tables, 522
ROLLBACK statement, 227–228SAVEPOINT command, 228statement-level rollback, 228transaction control statements,
148transactions, 226
rolling backautomatic checkpoint tuning, 810transaction recovery, 701, 704
rolling forwardcache recovery, 701, 703
ROLLUP operatorGROUP BY clause, 1197
root directory, UNIX, 62ownership, 47
ROUND function, 1191ROUND_ROBIN method
resource consumer groups, 434
■INDEX 1259
row cachesee data dictionary cache
row data section, data blocks, 101row exclusive locks, 237row-level access
VPD (virtual private database), 453row-level granularity, 237row-level locking, 236row-level security
column-level VPD, 460DBMS_RLS package, 459dynamic-access predicates, 457
ROWCOUNT (%ROWCOUNT)attribute, 1208
ROWID accessCBO choosing access path, 948online data redefinition, 813
rowsFlashback Versions Query feature,
259INSERT/DELETE/UPDATE
statements, 147ROWS parameter, SQL*Loader, 548,
555ROWTYPE (%ROWTYPE) attribute,
PL/SQL, 1204, 1207RPAD function, 1191rule-based optimization, 943RULES keyword, 581–582Rules Manager, 1175RUN command, RMAN, 660RUN command, SQL*Plus, 515–516run queue length
evaluating CPU performance, 1025runInstaller file, OUI, 302–303runtime option
installing Oracle Client, 398RUN_CHAIN procedure, 873RUN_JOB procedure, 869RUN_TO_COMPLETION method,
434RVWR (Recovery Writer), 746rwx group, UNIX file permissions, 60
Ss (-s) silent option, SQL*Plus, 505salt, encryption algorithms, 482SAME (Stripe and Mirror Everything),
287guidelines for optimal disk usage,
1032sample data, 824, 949SAMPLE parameter, Data Pump, 605sar command, UNIX, 82
CPU performance, 1024measuring I/O performance,
1030–1031SAVE command, SQL*Plus, 499, 514saved metrics, 827SAVEPOINT command, 148, 228scalability
applications sharing sessions,1014
OEM, 885
Oracle Net Services features, 392parsing, 1013performance, 1013
Schedule page, 217Scheduler, 863–882
administering schedules, 871architecture, 865assigning priority levels for jobs,
865attributes
altering common componentattributes, 880
CREATE_JOB procedure, 867,874
CREATE_JOB_CLASSprocedure, 875
CREATE_WINDOW procedure,877
managing Scheduler attributes,880
unsetting componentattributes, 880
automatic optimizer statisticscollection, 781–782
automatic Segment Advisoroperation, 141
brief description, 823chains, 865, 871–873components, 864–865creating schedules, 870–871database, managing/monitoring,
139, 144DBA_SCHEDULER_ views, 1090DBMS_JOB package limitations,
863DBMS_SCHEDULER package, 863,
1178default operation windows, 782description, 864event-based schedules, creating,
874events, 864, 873–874gathering statistics, 943introduction, 863job classes, 865, 874–876jobs, 864, 867–869
default Scheduler jobs, 882linking to Oracle Resource
Manager, 865managing, 870–871monitoring Scheduler jobs,
881–882object naming, 866privileges, 866programs, 864, 869–870purging job logs, 882schedules, 864, 870–871window groups, 865, 880windows, 865, 876–880
Scheduler wait class, 1035scheduling
limits for backup duration, 675transaction concurrency control,
230UNIX jobs, 76
schema ownergranting object privileges, 447
schemas, 148–149CREATE SCHEMA statement, 148Database 10g sample schemas,
1183–1184database schema, 21logical database structures, 100shared schemas, LDAP, 477switching schema, 222
SCHEMAS parameter, Data Pump,600, 613, 617
SCN (system change number), 132consistent database backups, 633control file, 108converting between timestamps
and, 737Flashback Database example, 749Flashback Versions Query feature,
259, 261restore points, 750–752START_SCN column, 262
SCN_TO_TIMESTAMP function, 737scope, SPFILE, 377scott user, 471screens
clearing, SQL*Plus, 505scripts
executing in SQL*Plus, 514–516scripting with RMAN, 653–655updating shutdown/start-up
scripts, 310Second Normal Form (2NF), 31secondary indexes, 196, 962security
see also authentication; passwordsapplication security, 487auditing database usage, 461–471authenticating database users,
471–476backing up recovery catalog, 672centralized user authorization, 476column-level security, 208controlling data access, 442–461
privileges, 442–449roles, 449–452
data encryption, 477–482database authentication, 471–475database security, 421–490directory naming method, 412dos and don’ts, 482–490
Advanced Security option, 487altering profiles, 488application security, 487Critical Patch Updates, 486database auditing, 483denying remote client
authentication, 486determining SQL user currently
executing, 488disabling roles, 487granting privileges, 483granting privileges through
roles, 487killing user’s session, 489
■INDEX1260
listing user information, 488logging in as different user, 489managing users, 488MetaLink, 486multiple DBAs, 484operating system
authentication, 483passwords, 482protecting data dictionary, 484restricting SQL*Plus usage, 487securing listener, 485securing network, 485setting permissions, 484user accounts, 482
enterprise user security, 476–482external authentication, 475–476fine-grained data access, 453–461implementing physical database
design, 37logical database structures, 100OEM, 884Oracle and Windows features,
911–912Oracle DBA’s role, 3, 4–5
managing users, 4monitoring the system, 4protecting the database, 4
Oracle Internet Directory, 482permanently removing tables, 741Peter Finnegan’s Oracle security
web site, 485proxy authentication, 476PURGE clause, 741security-related parameters,
356–357stored procedures, 452underlying objective, 421value-based security, 208views, 208, 452
security policiescolumn-level VPD, 460context sensitive security policy,
459creating, fine-grained access
control, 458DBA_POLICIES view, 1096DBMS_RLS package, 1176dynamic security policy, 459integrating directories and
Windows security policies,911
making security policy functionspublic, 460
shared context sensitive securitypolicy, 459
shared static security policy, 459static security policy, 459
security, SQL*Plus, 496–499additional Oracle security
mechanism, 496controlling through SET ROLE
command, 498limiting use of commands, 498product_user_profile table, 496
pupbld.sql script, 496restricting use of operating system
commands, 498Segment Advisor, 143
advice levels, 808automatic performance tuning,
1004automatic Segment Advisor job,
809choosing candidate objects for
shrinking, 808–809comprehensive analysis mode, 808Database Control Segment
Advisor page, 809limited analysis mode, 808managing/monitoring database,
144modes, 808online data redefinition as
alternative, 813performance tuning, 974Segment Advisor
Recommendations page,810
segment space management,808–810
space-related advisors, 850using, 853
segment level wait statistics, 1045segment space management
adjusting HWM phase, 807compaction phase, 807manual segment shrinking,
807–808online segment shrinking, 806–807Segment Advisor, 808–810tablespace storage parameters,
157segments, 104
analyzing segment growth, 177automatic Segment Advisor
operation, 141automatic segment space
management, 152, 155DBA_SEGMENTS view, 175, 1101description, 100extent allocation/deallocation, 156extents and, 104
SELECT ANY DICTIONARY privilege,444
Select Configuration Optionswindow, 306
Select Installation Type window, 304SELECT statement, 1186–1187
data manipulation statements, 147ORDER BY clause, 1189PL/SQL, 1204WHERE clause, 1186
Selecting a Database Instancewindow, 320
selection operations, 21, 942selectivity, 957SELECT_CATALOG_ROLE, 444self join, 1196
semantic Web, 25semi structured database model, 41semicolon (:)
terminating SQL statements, 495turning off use of semicolon, 521
SEMMNS parameterpreinstallation checklist, 300tuning memory resources, 916
SEQUEL (structured English querylanguage), 22
sequence-based recovery, 718sequence privileges, 446sequences, 222–223
currval pseudo column, 222DBA_SEQUENCES view, 224, 1108gaps in sequence numbers, 223nextval pseudo column, 222SQL*Loader utility, 558
SEQUENTIAL_ORDERtransforming array data with rules,
582serializable isolation level, 232, 234serializable schedules
transaction concurrency control,230
server-executed commands,SQL*Plus, 496
server file, 374server-generated alerts, 142, 828–834
DBMS_SERVER_ALERT package,1180
default server-generated alerts,828–829
managing alerts, 829–832tablespace alerts, 832–833
Server Manager utility, 524server parameter file
see SPFILEserver processes, 113–114
dedicated server processes, 114RMAN, 650shared server processes, 114user processes and, 113
server-side access controlssecuring network, 485
server software, installing, 303servers
copying files with database server,860–862
service level agreements (SLAs), 354,637–638
service metrics, 827service names, 394service registration, 117services
Oracle Service, 922–924Oracle Service threads, 914Oracle services, Windows, 922–925Oracle Services for MTS, 911
services command, lsnrctl utility, 402Services Summary
checking listener status, 402SERVICE_NAME parameter, 338service_name parameter, 410
■INDEX 1261
SERVICE_NAMES parameter, 394,401
SERV_MOD_ACT_STAT_DISABLEprocedure, 1148
SERV_MOD_ACT_STAT_ENABLEprocedure, 1148
SERV_MOD_ACT_TRACE_ENABLEpackage, 990
session control statements, 146session metrics, 827session multiplexing, 114session sample data, ASH, 824session variables, SQL*Plus, 516sessions
Active Session History, 142,845–849
ACTIVE_SESSION_POOLparameter, 436
ACTIVE_SESS_POOL_MTHparameter, 436
altering properties of user’ssession, 146
automatic assignment of resourceconsumer group to, 439
creating session temporary table,183
DBA_HIST_ACTIVE_SESS_HISTORY view, 1113
DBMS_SESSION package,1155–1156
determining session-level CPUusage, 1026
discovering session information,454
dynamic performance views,1121–1123
GUI sessions, 918managing session locks, 242QUEUEING_MTH parameter, 436quiescing database, 386session-related parameters, 342Top Blocking Sessions section,
ASH reports, 848Top Sessions page, 1071Top Sessions section, ASH reports,
848UNIX session, 47V$SESSION view, 1131
SESSIONS parameter, 342SESSIONS_PER_USER parameter, 427SESSION_CACHED_CURSORS
parameter, 1012–1013SESSION_USER attribute, USERENV,
454–455SET command, SQL*Plus, 499SET commands/statements, 147
SET ROLE, 498SET SERVEROUTPUT, 501–502SET TRANSACTION, 148SET TRANSACTION USER
ROLLBACK SEGMENT, 253SET UNTIL, 717, 719
set operators, 1190set password clause, lsnrctl utility,
404
set theory operations, 21setAutoCommit method, JDBC, 418setenv command, UNIX, 54SETPASSWD command, iSQL*Plus,
534settings, SQL*Plus, 505, 506SETUID files, 484Setup page, Database Control, 894,
896SET_ATTRIBUTE procedure, 871, 881SET_ATTRIBUTES procedure, 879SET_ATTRIBUTE_NULL procedure,
880SET_BOOL_PARAM_IN_SESSION
procedure, 1158SET_CONSUMER_GROUP_
MAPPING package, 440SET_CONSUMER_MAPPING_
PRI package, 440SET_DEFAULT_TASK procedure, 770SET_DEFAULT_TASK_PARAMETER
procedure, 764, 770SET_EV procedure, 1158SET_IDENTIFIER procedure, 990SET_INT_PARAM_IN_SESSION
procedure, 1158SET_MODULE procedure, 1153–1154SET_ROLE procedure, 1155SET_SCHEDULER_ATTRIBUTE
procedure, 880SET_SESSION_LONGOPS procedure,
820SET_SQL_TRACE procedure, 1156SET_SQL_TRACE_IN_SESSION
procedure, 1158SET_TASK_PARAMETER procedure,
1180SET_THRESHOLD procedure, 831,
1180SGA (system global area), 120–127
ASM Cache, 788automatic shared memory
management, 127, 774–780allocating memory between
SGA components, 776benefits of, 774Database Control, 779–780enabling, 775init.ora file or SPFILE, 779Oracle recommendation, 779switching to manual mode, 777using, 343
caution: DBA under emphasis onPGA, 780
components, 121database buffer cache, 121Java pool, 126large pool, 126managing/monitoring database,
144memory requirements, 129redo log buffer, 125shared pool, 124SHOW SGA command, 507sizing buffer cache, 1016
Streams pool, 126V$SGA view, 1116V$SGASTAT view, 1116V$V$SGA_DYNAMIC_
COMPONENTS view, 1117SGA Memory Advisor, 143SGA parameters
automatically tuned, 775checking size of, 777–778
locking SGA into host memory,346
manually managed, 775memory configuration
parameters, 342–347PRIVATE_SGA parameter, 427setting SGA maximum size, 346setting SGA parameters, 775–779setting SGA parameters manually,
774SGA_MAX_SIZE parameter, 346
automatic shared memorymanagement, 774
caution: not using on some UNIXplatforms, 777
SGA_TARGET parameter, 121, 127,343, 776–777
affecting SGA components,777–779
allocating memory between SGAcomponents, 776
automatic memory management,140
caution: not usingSGA_MAX_SIZE, 777
default set to zero, 127enabling automatic shared
memory management, 775initial value for, 776sizing shared pool, 1014switching to manual mode, 777
sh (Bourne shell), 45, 55SH (sales history) schema, 1184shadow process, Data Pump, 598shadow processes, 914share lock mode, 131shared context-sensitive security
policy, 459shared libraries, 1061shared memory
caution: not usingSGA_MAX_SIZE, 777
checking shared memoryallocations, 778
components of Oracle process,1061
shared memory management, 127,774–780
shared poolauto tuned SGA parameters, 775data dictionary cache, 125DBMS_SHARED_POOL package,
1173–1174delays due to shared pool
problems, 1062dictionary cache, 1006–1007
■INDEX1262
flushing, 1007library cache, 125, 1005–1006parameter setting size of, 345pinning objects in shared pool,
1014–1015reducing parse time CPU usage,
1028sizing, 1014system global area, 121, 124tuning, 1005, 1007V$SHARED_POOL_ADVICE view,
1118shared schemas, LDAP, 477shared server architecture, 392shared static security policy, 459SHARED_POOL_SIZE parameter, 345,
775shell limits, changing preinstallation,
293shell scripts, UNIX, 68–74
analyzing example script, 70command-line arguments, 69evaluating expressions, 68flow control structures, 71making variables available to, 54
shell variables, UNIX, 54, 68shells, UNIX, 45
Bourne Again Shell (bash), 45Bourne shell (sh), 45C shell (csh), 45changing shell prompt, 51default shell, 46Korn shell (ksh), 45shell prompts, 47shell used in this book, 45
ship.db.cpio.gz file, 302SHMMAX parameter
preinstallation checklist, 300tuning memory resources, 916
SHOW ALL command, RMAN, 664SHOW commands, SQL*Plus, 506
SHOW ALL, 506SHOW ERRORS, 507SHOW PARAMETER, 358SHOW PARAMETER UNDO, 253SHOW PARAMETERS, 507SHOW RECYCLEBIN, 506SHOW SGA, 507SHOW USER, 507
shrinking segmentssee segment space management
shutdownmanaging Oracle on Windows and
UNIX, 917Oracle Administration Assistant
for NT, 929shutting down database with
Windows, 925–926updating scripts post-installation,
310SHUTDOWN commands, SQL*Plus
ORADIM utility, 927SHUTDOWN ABORT, 132, 384, 701SHUTDOWN IMMEDIATE, 384
SHUTDOWN NORMAL, 383SHUTDOWN TRANSACTIONAL,
383SID
see ORACLE_SID variableSIGTERM signal, 75silent mode
installing software using responsefiles, 307–308
upgrading with DBUA, 319silent option (-s), SQL*Plus, 505SILENT parameter, SQL*Loader, 549Simplified Recovery Through
Resetlogs, 720–721simulated backups and restores,
RMAN, 649Single Sign On feature, LDAP, 477site profile file, 502–503SIZES procedure, 1174sizing, database, 37SKIP parameter, SQL*Loader, 550SKIP_INDEX_MAINTENANCE
parameter, SQL*Loader,555, 556
SKIP_UNUSABLE_INDEXESparameter, SQL*Loader,555, 556
SLA (service level agreement),637–638
recovery time target, 354typical SLA for database
operations, 637slash symbol (/)
forward slash (/) command, 515terminating SQL statements, 495using comments in SQL*Plus, 518
SLAVETHR mode, 953smallfile tablespaces, 170, 171SMON (system monitor) process, 114,
117Oracle Service thread, 915timer idle events, 1052
SMTP (Simple Mail TransferProtocol), 1172–1173
SMTP_OUT_SERVER parameter, 1149snapshot interval variable, AWR, 764snapshot retention period variable,
AWR, 764“snapshot too old” errors, 244
automatic undo retention tuning,141
guaranteed undo retention, 252snapshot too old alert, 834undo tablespaces causing, 248
snapshotssee AWR snapshots
soft parsingdescription, 1007example, 1008latch contention, 1013
software installation and upgrade, 7sort command, UNIX, 67sort merge join, 948SORT parameter, TKPROF, 986
SORTED_INDEXES parameter,SQL*Loader, 555, 556
sorting dataon multiple columns, 1189ORDER BY clause, 1189ORDER BY command, 147
source command, UNIX, 56space
benefits of Data Pump, 591data dictionary views, 1100Data Pump estimating, 605–606DBA_FREE_SPACE view, 175, 1101DBMS_SPACE package, 177, 1163DBMS_SPACE_ADMIN package,
1164estimating space requirements,
177out of space errors, 270preinstallation checks, 289
temporary space, 300user space quota errors, 270
space managementADDM recommendations, 763automatic checkpoint tuning, 810automatic segment space
management, 152automatic space management,
799–810Automatic Undo Management,
800data block space management,
152locally managed tablespaces,
799–800managing flash recovery area, 647manual segment shrinking,
807–808monitoring resumable operations,
273online segment shrinking, 806–807Oracle Managed Files, 800–806performance tuning, 974permanently removing objects,
739recursive CPU usage, 1029Resumable Space Allocation
feature, 269Segment Advisor, 808–810segment space management, 157temporary tablespace groups, 165
Space Summary section, DatabaseControl, 891
SPACE_USAGE procedure, 1164Specify Home Details window, 304SPFILE (server parameter file)
backup guidelines, 635changing SPFILE values, 333comments, 377creating, 375–377creating new database, 110DB_WRITER_PROCESSES
parameter, 115default location, 374described, 333
■INDEX 1263
dynamic changes, 334dynamic initialization parameters,
110dynamic parameter changes, 374init.ora file as alternative, 779modifying, 376naming conventions, 374sample SPFILE, 376setting initialization parameters,
311setting scope of dynamic
parameter changes, 377specifying in STARTUP command,
376using, 374–377V$SPPARAMETER dynamic view,
375V$SPPARAMETER view, 1138viewing current parameter values,
357spindles, disk I/O, 1030split block problem, open backups,
689SPLIT PARTITION clause, 191SPOOL command, SQL*Plus, 499, 510spool files, SQL*Plus
creating/appending to/replacing,510
manual upgrade process, 323, 328SQL (structured query language)
ANSI standard, 145description of, 22determining SQL user currently
executing, 488dynamic performance views, 1131execution results of SQL query, 983finding inefficient SQL, 992–994library cache, 125processing through JDBC, 417–419recursive SQL, 106using SQL to generate SQL,
525–526XML and SQL, 146
SQL Access Advisor, 143, 214–219automatic performance tuning,
1004clearing cache, 216creating SQL cache, 216creating materialized views, 212getting recommendations from,
216granting privileges, 216implementing recommendations,
218index recommendations, 201invoking through
DBMS_ADVISOR, 219invoking through Database
Control, 215invoking through QUICK_TUNE,
219managing/monitoring database,
144reviewing recommendations, 218
tuning-related advisors, 850tuning SQL statements, 1000
SQL Access Mode, 1069SQL buffer
see buffersSQL functions, 1190–1194
AVG, 1191CASE, 1193COALESCE, 1193CONCAT, 1191COUNT, 1191DECODE, 1193INSTR, 1191LENGTH, 1191LOWER, 1191LPAD, 1191MAX, 1191MIN, 1191NVL, 1193RANK, 1193REPLACE, 1191ROUND, 1191RPAD, 1191SUBSTR, 1191SUM, 1191SYSDATE, 1192TO_CHAR, 1192TO_DATE, 1192TO_NUMBER, 1192TO_TIMESTAMP, 1192TRIM, 1191TRUNC, 1191
SQL mode, 892SQL Net Services, 391SQL performance tuning tools
see performance tuning tools, SQLSQL profiles
Automatic Tuning Optimizer,995–996
avoiding use of Optimizer hints,960
managing SQL tuning categories,998
stored execution plan compared,995
SQL Response Time chart, DatabaseControl, 891, 1068
SQL scripts@@commandfile notation, 518executing in SQL*Plus, 514–516executing SQL command scripts
consecutively, 518viewing script before executing,
518SQL statements, 145–148, 1186–1188
analyzing instance before tuning,1066
Automatic Tuning Optimizer, 996COMMIT, 226creating stored outlines for, 971data definition statements, 148data manipulation statements, 147DBA_SQLSET_STATEMENTS view,
1112DELETE, 1188
embedded SQL statements, 147executing, JDBC, 418–419identical statements, 1006identifying inefficiency in, 999identifying SQL with highest waits,
1042INSERT, 1187–1188object privileges granting use of,
445Oracle SQL transaction stages, 231performance tuning, approach to,
999–1000processing steps, 1005query processing optimization,
939ROLLBACK, 227SELECT, 1186–1187session control statements, 146SQL Tuning Sets (STS), 999system control statements, 146terminating in SQL*Plus, 495terminating SQL statement, 520TKPROF utility information on,
987Top SQL Command Types section,
ASH, 847Top SQL statements, 999Top SQL Statements section, ASH,
847transaction control statements,
148undo data changes, 262UPDATE, 1188using AWR reports for, 1055using similar SQL statements, 965wait events, 1034
SQL Trace files, udump, 285SQL Trace tool, 983–985
enabling, 985examining parse information,
1007–1008interpreting trace files with
TKPROF, 985–989monitoring index usage, 201note: tracing SQL statements, 990parameter turning on/off, 352setting trace initialization
parameters, 984–985MAX_DUMP_FILE_SIZE, 985STATISTICS_LEVEL, 984TIMED_STATISTICS, 984USER_DUMP_DEST, 985
SET_SQL_TRACE procedure, 1156SET_SQL_TRACE_IN_SESSION
procedure, 1158trackable variables using, 983
SQL transformation, 947SQL Tuning Advisor, 143, 999
automatic performance tuning,1004
Automatic Tuning Optimizer, 995DBMS_SQLTUNE package, 1181how Tuning Advisor works,
994–996managing SQL profiles, 998
■INDEX1264
managing SQL tuning categories,998
managing/monitoring database,144
OEM Database Control, 1070performing automatic SQL tuning,
997providing SQL statements to, 994tuning-related advisors, 850using DBMS_SQLTUNE package,
997–998using OEM Database Control to
run, 999views managing automatic tuning,
998SQL Tuning Sets (STS), 999
DBA_SQLSET view, 1112DBA_SQLSET_PLANS view, 1112
SQL*Loader, 139, 541–559capabilities summarized, 541data loading techniques, 557–559
dropping indexes before bulkdata loads, 558
loading data from table intoASCII file, 558
loading into multiple tables,559
loading large data fields into atable, 557
loading sequence number intoa table, 558
loading username into a table,557
loading XML data into OracleXML database, 559
trapping error codes fromSQL*Loader, 559
using WHEN clauses, 557direct path loading, 554–556disabling integrity constraints, 205external tables compared, 560generating data during data load,
551generating external table creation
statements, 567invoking, 551–552log files, 552–553optimizing use of, 556redo entries, 554resumable operations, 270return codes, 553types of data loading possible
using, 541SQL*Loader clauses
APPEND, 544BEGINDATA, 544CONCATENATE, 544CONTINUEIF, 545ENCLOSED BY, 547INSERT, 544INTO TABLE, 544LOAD DATA, 544OPTIONS, 547POSITION, 546REENABLE, 556
REPLACE, 544TERMINATED BY, 547
SQL*Loader control file, 542–550command-line parameters,
547–550data file specification, 544data transformation parameters,
547data types, 546delimiters, 547fixed record format, 545logical records, 544physical records, 544record formats, 545stream record format, 545table column name, 546variable record format, 545
SQL*Loader parametersBAD, 549BINDSIZE, 548COLUMNARRAYROWS, 555CONTROL, 548DATA, 548DATA_CACHE, 555DIRECT, 549, 555DISCARD, 549DISCARDMAX, 550ERRORS, 549EXTERNAL_TABLE, 567INFILE, 544LOAD, 549LOG, 549MULTITHREADING, 556PARALLEL, 550PARFILE, 552RESUMABLE, 550RESUMABLE_NAME, 550RESUMABLE_TIMEOUT, 550ROWS, 548, 555SILENT, 549SKIP, 550SKIP_INDEX_MAINTENANCE,
555SKIP_UNUSABLE_INDEXES, 555SORTED_INDEXES, 555STREAMSIZE, 556UNRECOVERABLE, 554, 555USERID, 548
SQL*Net message from client idleevents, 1052
SQL*Plus, 138actions of commands
archive logs, viewing detailsabout, 524
columns, listing, 509columns, showing properties
of, 512commands, listing, 518commands, viewing previous,
518comments, adding to scripts,
522connecting to Oracle database,
493
editing, making minorchanges, 519
editors, invoking, 519environment, setting, 499footer text, printing, 513formatting, specifying where
change occurs, 512header text, printing, 513help topics, showing, 499memory buffer, saving
contents of, 514message, sending to screen,
511operating system commands,
using from within, 509output, saving to operating
system, 510output, viewing screen by
screen, 511packages/procedures,
executing, 511prompt, showing instance
name in, 508recovering
database/files/tablespaces,524
redo log files, archiving, 524session variables, creating, 516session variables, deleting, 516session, exiting, 495settings, preserving, 506settings, removing current, 505specifications, listing, 509SQL script, viewing before
executing, 518statistics, calculating, 513tables, copying, 522–523text, adding to existing, 521text, deleting, 520text, inserting, 520title, placing on page, 513user input, saving in variable,
511variable values, displaying, 506web pages, creating, 524
command files, creating, 514–518command-line options, 504–505commands
ACCEPT, 511APPEND, 521ARCHIVE LOG, 524ARCHIVE LOG LIST, 524available commands, list of,
499BREAK, 512BTITLE, 513CHANGE, 519CLEAR, 505COLUMN, 512COMPUTE, 513CONNECT, 493COPY, 522–523DEFINE, 516DEL, 520DESCRIBE, 509
■INDEX 1265
ed command, 519EXECUTE, 511EXIT, 495GET, 518HELP INDEX, 499HOST, 509INPUT, 520LIST, 518MARKUP, 524PAUSE, 511PROMPT, 511QUIT, 495RECOVER, 524REMARK, 518, 522REPFOOTER, 513REPHEADER, 513RESTRICT, 498RUN, 515–516SAVE, 514SET, 499SHOW, 506SHUTDOWN, 132, 383, 384,
701SPOOL, 510SQLPROMPT, 508START, 499STARTUP, 324, 361, 378, 379STORE, 506TTITLE, 513UNDEFINE, 516
connecting to Oracle databasefrom command line, 492from Windows GUI, 494
connectionless SQL*Plus session,494
continuation characters, 495creating database using, 358–373
see also database creationcreating reports, 512–513creating web pages using, 524creating Windows batch script, 516database administration
commands, 524dropping database from, 386–387easy connect naming, 410editing within SQL*Plus, 519–524environment variables, 500–504
ARRAY[SIZE], 500AUTO[COMMIT], 500changing, 501COLSEP, 500COPY[COMMIT], 500DEF[INE], 500displaying all values, 506ECHO, 500EDITF[ILE], 500execution order of
glogin/login.sql files, 504FEED[BACK], 500FLUSH, 500global preferences (glogin.sql),
502–503HEA[DING], 500individual preferences
(login.sql), 503–504
LIN[ESIZE], 500LONG, 501NEWP[AGE], 501NUM[WIDTH], 501PAGES[IZE], 501PAU[SE], 501SERVEROUT[PUT], 501setting, 500–504setting Oracle environment,
492SQLP[ROMPT], 501table of variables, 500TERM[OUT], 501TIMI[NG], 501TI[ME], 501VER[IFY], 501
establishing Oracle connectivity,397
executing contents of SQL*Plusbuffer, 515
executing SQL command scriptsconsecutively, 518
executing SQL scripts, 514–516formatting output, 512iSQL*Plus
see iSQL*Pluslocal commands, 496making DML changes permanent,
523monitoring database status,
387–388predefined variables, 517privileged connections, 492prompts, 492quiescing database from, 385–386restricting SQL*Plus usage, 487security, 496–499server-executed commands, 496setting Oracle environment, 492shutting down database from,
383–385shutting down database with
Windows, 926starting session from command
line, 492–493starting SQL*Plus session, 491–495starting up database from,
378–383starting up database with
Windows, 926substitution variables, 516suspending database from, 386terminating SQL statement, 495,
521using comments in SQL*Plus, 517using SQL to generate SQL,
525–526web-based interface to SQL*Plus
see iSQL*PlusSQLException method, conn class
error handling in Java, 419SQLFILE parameter, Data Pump, 593,
615–616SQLJ, 1215SQLLDR command, 551
sqlnet.ora filebackup guidelines, 635local naming method, 406
Sqlpath variable, Windows registry,921
sqlplus commandNOLOG option, 494
SQLPLUS_RELEASE variable, 517SQLPROMPT command, 501, 508SQLTERMINATOR variable, 521SQLTUNE_CATEGORY parameter,
998SQL_TRACE parameter, 352, 985SREADTIM mode, 953SSH (secure shell), 78ssh command, UNIX, 78stacks
orastack utility, 916staging directory
installing software, 303staging element, Oracle Streams, 585standard auditing, 462–468standard deviations, SQL*Plus, 513standard error, UNIX, 56standard input, UNIX, 56standard output, UNIX, 56standby databases, 695–696start command, lsnrctl utility, 403start command, isqlplusctl, 528START command, SQL*Plus, 499start menu
removing Oracle entries, 931START WITH clause, 1194startup
managing Oracle on Windows andUNIX, 917
Oracle Administration Assistantfor NT, 929
starting up database withWindows, 925–926
updating scripts post-installation,310
STARTUP command, SQL*Plus, 361STARTUP MOUNT, 379STARTUP NOMOUNT, 378STARTUP OPEN, 379STARTUP UPGRADE, 324
START_DATE attributeCREATE_JOB procedure, 867CREATE_WINDOW procedure, 877
START_JOB command, Data Pump,611–612, 621
START_PROFILER procedure, 1167START_REDIF_TABLE procedure,
815, 816stateful alerts, 828stateless alerts, 828statement-level audit, 462statement-level read consistency, 234
undo data providing, 243–254statement-level rollback, 228Statement object, JDBC, 417statement timed out error, 271statements
see SQL statements
■INDEX1266
statement_types parameter, 469static parameters
changing parameter values, 334scope of changes, SPFILE, 377
static security policy, 459static views
see data dictionary viewsstatistics
analytical functions, 1194automatic optimizer statistics
collection, 141, 780–782,949–952
automatic performance tuning,1004
Automatic Tuning Optimizer, 995Automatic Workload Repository,
142, 834, 835calculating, SQL*Plus, 513collecting data dictionary
statistics, 954–955collecting fixed object statistics,
954collecting operating system
statistics, 952–954collecting real dictionary table
statistics, 954Database Control, 898database usage metrics, 898Database Usage Statistics property
sheet, 898database wait statistics, 1033–1035DBA_CPU_USAGE_STATISICS
view, 1105DBA_FEATURE_USAGE_STATISTI
CS view, 1088DBA_HIGH_WATER_MARK_STATI
STICS view, 1088DBA_SQLTUNE_STATISTICS view,
1112DBMS_STATS package, 949–952,
1175frequency of statistics collection,
955gathering statistics, 943–945, 950
Oracle recommendation, 956managing/monitoring database,
144manual collection of statistics
required, 950Oracle performance statistics,
823–828performance tuning, 972performance/diagnostics-related
parameters, 349–353problems due to bad statistics,
1062sampling data, 949statistics not collected, 955storing Optimizer statistics, 950system usage statistic, 1053time model statistics, 761TIMED_STATISTICS parameter,
353turning on statistics collection,
1038
using histograms, 972using OEM to collect Optimizer
statistics, 956V$BUFFER_POOL_STATISTICS
view, 1118V$SYSSTAT view, 1129
STATISTICS_LEVEL parameter, 349automatic optimizer statistics
collection, 781configuring ADDM, 763setting trace initialization
parameters, 984using automatic shared memory
management, 775V$STATISTICS_LEVEL view, 1139
Statspack utility, 834STATUS command, Data Pump, 612,
621status command, lsnrctl utility, 402status information, Grid Control, 906STATUS parameter, Data Pump, 607,
613, 617stop command, lsnrctl utility, 403stop command, isqlplusctl, 528STOP_JOB command, Data Pump,
597, 612, 621STOP_JOB procedure, 869STOP_PROFILER procedure, 1167storage, 92–95
see also ASMcreating database directories, 297disk storage requirements, 280flash recovery area, 640Hardware Assisted Resilient Data,
94implementing physical database
design, 37InfiniBand, 94Networked Attached Storage, 93Oracle Storage Compatibility
Program, 94physical database design, 37storage allocation to database
objects, 158Storage Area Networks, 93tablespace storage parameters,
156backup guidelines, 635data dictionary views, 1100DBMS_STORAGE_MAP package,
1182dynamic performance views,
1140–1143storage element, Oracle Backup, 685STORE command, SQL*Plus, 506
restriction levels, 499stored execution plan
SQL profile compared, 995stored outlines
caution: limiting dynamicchanges, 969
creating outlines, 970–971at database level, 970for specific statements, 971
DBMS_OUTLN package, 1162
DBMS_OUTLN_EDIT package,1162
editing outlines, 971implementing plan stability, 970OUTLN user, 970stabilizing CBO, 969–971USER_OUTLINES view, 1163USER_OUTLINE_HINTS view,
1163when to use outlines, 969
stored proceduressee also proceduresdatabase security, 452definer’s rights, 448displaying output on screen, 501inline stored functions, 966–967invoker’s rights, 448Java stored procedures, 1214
stored scriptsconverting RMAN scripts, 654
stream record format, SQL*Loader,545
streamingtable functions, 575
Streams poolauto-tuned SGA parameters, 775parameter setting size, 346system global area, 121, 126tuning, 1019
Streams, Oracle, 583–587Advanced Queuing, 584architecture, 584–585capture process, 584consumption, 585data protection, 584data replication, 584data warehouse loading, 584enhanced data protection for
disaster recovery, 695events, 583, 584setting up, 585–587staging element, 585
STREAMSIZE parameter,SQL*Loader, 556
STREAMS_POOL_SIZE parameter,126, 346
auto-tuned SGA parameters, 775setting up Oracle Streams, 585
stripingAutomatic Storage Management,
784, 792logical volume stripe sizes, 1030
structureslogical database structures,
100–107Oracle database structures, 99–112physical database structures,
107–112Student and Exchange Visitor
Information System, 1065subclasses
object database model, 39SUBMIT procedure, 1151–1152
■INDEX 1267
subqueries, 147correlated subqueries, 1200EXISTS operator, 1200multiple column subqueries, 1199multiple row subqueries, 1199NOT EXISTS operator, 1200single row subqueries, 1199Top-N analysis, 1199writing efficient SQL, 958writing subqueries, 1199–1200
substitution variables, SQL*Plus, 516SUBSTR function, 576, 1191SUM function, 1191super administrator account
(sysman), 895supplemental logging, 732–733suppressed mode
installing software using responsefiles, 307
suspended operations, 273suspending database, 822swap space
preinstallation checks, 291, 300virtual memory, 1029
swappinganalyzing instance before tuning,
1075swap ins/outs, 80system usage problems, 1059
SWITCH command, RMAN, 660–661performing hot restore, 713
SWITCH_CURRENT_CONSUMER_GROUP procedure, 1156
SWITCH_XYZ parametersplan directives, 819
symbolic links, UNIX, 58symbolic name, UNIX
accessing UNIX system, 47command to retrieve, 49
SYNC_INTERIM_TABLE procedure,817
synonyms, 220–222creating, 220DBA_SYNONYMS view, 224, 1108dropping, 221private synonyms, 220, 221public synonyms, 220, 221switching schema, 222
SYS parameter, TKPROF, 986SYS schema
accessing objects in, 444SYS super user
creating database, 364data dictionary tables, 136default password, 359Flashback to SYS user objects, 265
SYS.AUD$ table, 463, 471Sysaux tablespace, 106, 150, 172–173
alert log during database creation,367
benefits of, 172creating, 172–173
failure to create, 172manual upgrade process, 324using DBUA upgrade, 320
creating database, 365Pre-Upgrade Information Tool, 317removing tablespaces, 160, 173renaming tablespaces, 163, 173setting data file location, 173sizing file system for database, 331transporting tablespaces, 173upgrading with DBUA, 320usage restrictions for, 173V$SYSAUX_OCCUPANTS view,
1142Sysaux Tablespace window
upgrading with DBUA, 320sysctl.conf file, 292–293SYSDATE function, 1192SYSDBA privilege, 359, 445, 473sysman (super administrator
account), 895SYSOPER privilege, 445, 473SYSTEM account
creating database, 364default password, 359
System Activity Reportersee sar command, UNIX
system administratorpost-installation tasks, 309–310preinstallation checks, 289–297
system change numbersee SCN
system configuration files, UNIX, 62system control statements, 146system failures, 700system global area
see SGASystem I/O wait class, 1035system-level triggers
using for auditing, 466system management role, 5–6system metrics, 827system monitor process
see SMONsystem path
removing Oracle entries, 931system performance
see performancesystem plan
Oracle default resource plans, 435system privileges, 442–445
CONNECT privilege, 442granting, 443–444list of common, 443revoking, 444SELECT ANY DICTIONARY, 444SYSDBA and SYSOPER, 445types of Oracle privilege, 442user’s right to perform operations,
442System tablespace, 106, 150, 168
alert log during database creation,367
creating database, 365extent allocation/deallocation, 156failure to create, 172removing tablespaces, 160renaming tablespaces, 163
sizing file system for database, 331Sysaux tablespace and, 172using multiple block size feature,
159systems management, OEM, 886systemstate dump
database hangs, 1064sys_context
discovering session information,454
SYS_GROUP resource consumergroup, 435
SYS_TICKS system usage statistic,1053
Ttable compression, 968table functions
ETL components, 540parallel execution, 575pipelining, 575streaming, 575summary of tasks performed by,
575transform-while-loading method,
575using SQL to transform data,
575–579web services data, mining, 579
table locks, 238table lookups, 959TABLE parameter, TKPROF, 986table types
table functions, 577user-defined object types, 149
table versioning, Workspace Manager,274
tables, 175–196see also database objectsadding column to, 179clusters, 195
hash clusters, 195–196copying tables, SQL*Plus, 522–523creating, 178, 181data dictionary views, 192–195,
1108–1110database integrity constraints,
202–207DBA_TABLES view, 192, 224DBA_TAB_COLUMNS view, 224DBMS_REDEFINITION package,
1178designing different types, 35dropping columns from, 179dropping tables, 181
PURGE option, 182estimating size before creating,
176using Database Control to, 176using DBMS_SPACE package,
177external tables, 185extracting object DDL, 194Flashback Drop feature, 264
■INDEX1268
Flashback Table feature, 264–267full table scans, 948
avoiding unnecessary, 967index organized tables, 184–185
differences to regular tables,184
indexes, 196–202guidelines for use of indexes,
197maintaining indexes, 202separating table and index
data, 104keys, 20locking issues, 1060moving a table online, 812naming conventions, 36online table redefinition, 812,
814–818ordering of columns, 20partitioned tables, 185–192performance tuning, 973–974permanently removing tables,
741–742removing all data from, 180renaming columns, 180renaming tables, 180setting columns as unused, 179sizing file system for database, 330table structures, 36temporary tables, 182–184views, 207–214
TABLES parameter, Data Pump, 600,617
tablespace backups, 690tablespace metrics, 827tablespace point-in-time recovery
(TSPITR), 705, 730–731tablespace space usage alert, 828tablespaces, 104–107, 149–175
alerts, 832–833assigning tablespace quotas to
new users, 424automatic segment space
management, 152backing up with RMAN, 674backup guidelines, 636benefits of using, 105bigfile tablespaces, 107, 169–171changing default tablespace type,
171choosing size of, 104creating, 154–159
additional tablespaces,369–370
data files and tablespaces, 154extent allocation/deallocation,
156users creating tablespaces, 424with nonstandard block sizes,
159data block sizes and, 105data block space management,
152data dictionary views for
managing, 174–175
data files and, 112database creation using OMF, 805DBA_TABLESPACES view, 224,
1103DBMS_TTS package, 1181default extent storage, 151default permanent tablespace, 168default tablespaces, 104default type, 107description, 100, 282dictionary-managed tablespaces,
106, 150dictionary view for managing, 174expanding, 160–163extent management default, 151extent sizes, managing, 151locally managed tablespaces, 106,
150, 799–800migrating to, 153
moving tables between, 181multiple data block sizes, 123naming conventions, 286offline tablespaces, 164Oracle Managed Files, 173–174permanent tablespaces, 107Pre-Upgrade Information Tool, 317read-only tablespaces, 107, 163recovering tablespaces, 714–715
RMAN, 714–715SQL*Plus, 524user-managed recovery, 715
removing, 159–160renaming, 163revoking tablespace quotas to
users, 424separating table and index data,
105smallfile tablespaces, 107specifying flashback mode clause,
154storage allocation to database
objects, 158storage parameters, 156Sysaux tablespace, 106, 150,
172–173System tablespace, 106, 150, 168tablespace backup, 634Tablespace Point-in-Time
Recovery, 730–731tablespace quotas, 161tablespace space alerts, 161
setting alert thresholds, 162temporary tablespace groups,
165–168temporary tablespaces, 106, 107,
150, 164transportable tablespaces, 105,
623–630undo tablespaces, 106, 107, 150UNDO_TABLESPACE parameter,
245UNLIMITED TABLESPACE
privilege, 178unlimited tablespace usage rights,
424
user tablespaces, 161using multiple block size feature,
159V$TABLESPACE view, 1140
TABLESPACES parameter, DataPump, 600, 617
TABLESPACE_MIGRATE_FROM_LOCAL procedure, 1165
TABLESPACE_MIGRATE_TO_LOCALprocedure, 1165
TABLE_EXISTS_ACTION parameter,Data Pump, 617
TABLE_NAME column, 262TABLE_OWNER column, 262tags
backup tags, 657tail command, UNIX, 64tape backups
backup and recovery architecture,134
backup guidelines, 635physical database backups, 632RMAN, 648
tar command, UNIX, 76target database, RMAN, 650
using RMAN for TSPITR, 730targets tab, Grid Control, 906TCP/IP protocol
easy connect naming, 410establishing Oracle connectivity,
397TCP_INVITED_NODES parameter
securing network, 486telnet
accessing UNIX system, 46, 77TEMPFILE clause
temporary tablespaces, 164temporary files
directory storing, 62temporary space
preinstallation checklist, 300temporary tables, 182–184
benefits of, 183Flashback Versions Query feature,
260session temporary table, 183transaction temporary table, 183
temporary tablespaces, 106, 107, 150,164
alert log during database creation,367
allocating space to, 164AUTOALLOCATE clause, 165default temporary tablespaces,
165setting group as, 167
dropping, 165failure to assign, 165managing users, 422Oracle size recommendation, 165sizing file system for database, 331temporary tablespace groups,
165–168adding tablespace to, 167creating/altering users, 167
■INDEX 1269
TERMINAL attribute, USERENV,454–455
terminal emulators, UNIX, 46TERMINATED BY clause,
SQL*Loader, 547TERM[OUT] variable, SQL*Plus, 501test command, UNIX, 68, 70test databases, 9testing backups, 636text extraction, UNIX, 65text handling, SQL*Plus, 520, 521text manipulation, UNIX, 64TEXT pages, Oracle process, 1061text scripts
converting RMAN scripts, 654theta join, 22Third Normal Form (3NF), 33threads
Data Pump utilities, 609managing Oracle on Windows and
UNIX, 912Oracle Service threads, 914query showing shadow processes,
914threshold-based alerts, 828thresholds
critical threshold, 830, 832DBA_THRESHOLDS view, 834,
1112setting alert thresholds, 830setting for metrics, 828warning threshold, 830, 832
time-based recoveryFlashback Database example, 749RMAN incomplete recovery, 718user-managed incomplete
recovery, 721time model statistics
ADDM, 761–762data collected by AWR, 835DB time statistic, 760V$SESS_TIME_MODEL view, 1130V$SYS_TIME_MODEL view, 1130
TIMED_STATISTICS parameter, 353,984
TIMEOUT clauseALTER SESSION command, 271
TIMESTAMP data type, 1185timestamps
converting between timestampsand SCNs, 737
Flashback Database example, 749Flashback Versions Query feature,
259START_TIMESTAMP column, 262
TIMESTAMP_TO_SCN function, 737timing
clearing, SQL*Plus, 506CONNECT_TIME resource
parameter, 427IDLE_TIME resource parameter,
427PASSWORD_XYZ_TIME
parameters, 427
Time Model Statistics section,AWR reports, 843
TI[ME] variable, SQL*Plus, 501TIMI[NG] variable, SQL*Plus, 501
titlesplacing title on page, SQL*Plus,
513TKPROF utility, SQL
brief description, 983enabling, 985examining formatted output files,
986–989examining parse information,
1007–1008interpreting trace files with,
985–989parameters, 986parse/execute/fetch counts, 987reducing parse time CPU usage,
1029SQL statement information, 987
tmp (/tmp) directory, UNIX, 62tnsnames map file, 412tnsnames.ora file
backup guidelines, 635external naming method, 412installing Oracle Client, 399local naming method,
connectivity, 405modifying manually, 406–408modifying with NCA, 408–410typical file, 406
TNS_ADMIN variablelocating tnsnames.ora and
sqlnet.ora, 406setting, preinstallation, 298
TOAD software, 999Top Activity page, Database Control,
1070top command, UNIX, 83, 1057Top Sessions page, Database Control,
1071Top SQL statements, 999Top-N analysis, subqueries, 1199touch command, UNIX, 63touch count, 1018TO_XYZ functions, 1185, 1192trace files, 111
bdump administrative directory,285
collecting detailed wait eventinformation, 1045–1046
interpreting, TKPROF, 985–989parameter collecting timed
statistics during tracing, 353trace initialization parameters
setting, 984–985tracing
Autotrace utility, 979–983creating trace in user dump
directory, 1008enabling, 1007end-to-end tracing, 989–991SQL Trace tool, 983–985
training, DBA, 10–11
transaction control statements, 148transaction-level read consistency,
234transaction recovery, 701
Oracle media recovery process,704
transactions, 225–275ACID properties, 228analyzing instance before tuning,
1072atomicity, 228automatic checkpoint tuning, 810autonomous transactions,
267–269COMMIT statement, 226concurrency control, 229–230
implementing, 235–243schedules and serializability,
230consistency, 228creating transaction temporary
table, 183data concurrency problems, 229data consistency and, 130data dictionary views, 1104DBMS_FLASHBACK package,
256–257described, 225–228discrete transactions, 267durability, 229dynamic resource management,
819executing SQL statements, JDBC,
418flashback error correction using
undo data, 254–267Flashback Transaction Query,
261–264Flashback Versions Query, 258FLASHBACK_TRANSACTION_QU
ERY view, 267, 1089isolation, 228isolation levels, 232–235
ISO transaction standard, 231limiting long transactions, 819limiting maximum execution
times for, 819LOCK TABLE statement, 147locking and, summary of, 238making permanent in database
files, 115managing long transactions,
273–275monitoring performance with
Grid Control, 907naming, 229Oracle database transactions,
130–131Oracle SQL transaction stages, 231properties of, 228–229redo log files, 109Resumable Space Allocation
feature, 269–273ROLLBACK statement, 227SAVEPOINT command, 228
■INDEX1270
SHUTDOWN commands, 383, 384switching long-running
transactions, 819transferring contents of redo log
buffer to disks, 115undo data providing read
consistency, 243–254undo management, 133, 800unique transaction identifier, 259V$TRANSACTION view, 1134write ahead protocol, 132
TRANSFORM parameter, Data Pump,618–619
transform method, SQL/XML, 1212transform-then-load method, ETL,
540transform-while-loading method
ETL, 540table functions, 575
transforming data, 570–583see also ETLderiving data from existing tables,
570–571external tables, 560MERGE statement, 571–573MODEL clause, 580–583multitable inserts, 573–575Oracle Streams, 583–587SQL*Loader/external tables
compared, 560table functions, 575–579using SQL to transform data,
571–579transforming queries, 947transient files
flash recovery area, 641Transparent Application Failover
feature, 700transparent data encryption, 477–482
creating Oracle wallet, 478encrypting table columns, 481encryption algorithms, 482generating master encryption key,
480opening and closing Oracle wallet,
480transport tablespaces feature, 105
DBMS_TTS package, 1181transportable tablespaces, 623–630
Data Pump utilities, 623, 625–627ETL components, 541LOBs (large objects), 623metadata, 625, 627referential integrity constraints,
624self-contained criteria, 624transporting tablespaces across
platforms, 627–630converting data files to match
endian format, 629copying files to target system,
630determining endian format of
platform, 628
ensuring tablespaces are self-contained, 628
exporting metadata using DataPump, 628
making read-only, 628using Data Pump to import
metadata, 630transporting tablespace between
databases, 624–627copying export/tablespace files
to target, 626exporting dictionary
information (metadata), 625generating transportable
tablespace set, 625–626performing tablespace import,
626selecting tablespace to
transport, 624TRANSPORT_SET_CHECK
procedure, 624uses for, 624
TRANSPORTABLE_TABLESPACESparameter, Data Pump, 614
TRANSPORT_DATAFILES parameter,Data Pump, 617
TRANSPORT_FULL_CHECKparameter, Data Pump, 602,617, 625, 628
TRANSPORT_SET_CHECKprocedure, 624, 628
TRANSPORT_TABLESPACESparameter, Data Pump, 600,617, 626
treesB-tree index structure, 197
trial recovery, 753–754triggers, 223–224
creating, 223customizing database auditing
with, 465–468database triggers, 37DBA_TRIGGERS view, 224, 1108deriving data from existing tables,
571described, 465SQL*Loader direct-path loading,
556TRIM function, 1191TRUNC function, 1191TRUNCATE command, 180
rolling back, 1188TRUNCATED option
SET SERVEROUTPUT command,502
try...catch blocks, Java, 419TSPITR (Tablespace Point-in-Time
Recovery), 730–731complete and incomplete
database recovery, 705TTITLE command, SQL*Plus, 513TUNE_MVIEW procedure, 212tuning
see performance tuning
tuplesrelational database model, 20
TWO_TASK environment variable,399
type inheritance, 1203
Uudump administrative directory, 285umask command, UNIX, 295UMASK variable, UNIX, 61
setting permissions, 484uname command, UNIX, 49unary operations, 21
heuristic strategies for queryprocessing, 942
UNDEFINE command, SQL*Plus, 516Undo Advisor, 143, 854
automatic performance tuning,1004
space-related advisors, 850using OEM to manage undo data,
254undo data
active/committed, 248Automatic Undo Management,
244backup and recovery architecture,
134flashback error correction using,
254–267identifying SQL statements to
undo data changes, 262parameter storing, 348providing read consistency,
243–254time retained in undo tablespace,
247uses of, 244using OEM to manage undo data,
254undo management, 133
Automatic Undo Management,133, 800
creating plan directives, 436DBA_UNDO_EXTENTS view, 1104managing/monitoring database,
144manual mode, 133undo-related parameters, 347–348UNDO_MANAGEMENT
parameter, 245undo pool resource allocation
method, 432undo records
see undo dataundo retention
default, 250guaranteed undo retention, 251snapshot-too-old error, 248summary of automatic undo
retention, 249UNDO_RETENTION parameter,
247V$UNDOSTAT view, 248
■INDEX 1271
undo segmentsAutomatic Undo Management,
800data consistency, 131DBA_ROLLBACK_SEGS view, 250
undo space information, 244–245,253
undo tablespace, 106before image records, 109
undo tablespaces, 107, 150adding space to, 246alert log during database creation,
367automatic undo retention
summary, 249creating database, 365default choice of, 247managing, 252multiple undo tablespaces, 246parameter determining for undo
records, 348parameter specifying saved redo
information, 348sizing, 247, 250sizing file system for database, 330UNDO_TABLESPACE parameter,
245using Flashback features, 255, 263
UNDO_CHANGE column, 262UNDO_MANAGEMENT parameter,
133, 245, 250, 348UNDO_POOL parameter, 253UNDO_POOL resource plan directive,
820UNDO_RETENTION parameter, 133,
247, 348automatic undo retention tuning,
141Flashback features, 255
Flashback Query, 256Flashback Transaction Query,
261Flashback Versions Query, 258
guaranteed undo retention, 251setting up Oracle Streams, 585snapshot too old error, 253
UNDO_SQL column, 262UNDO_TABLESPACE parameter, 245,
348UNIFORM option
managing extent sizes, 151tablespace storage parameters,
157uninstalling Oracle, 312–313
on Windows, 930–931removing Oracle databases, 312removing Oracle software, 313
union, relational algebra, 21UNION ALL operator, 1190UNION operations
indexing strategy, 963UNION operator, 1190uniq command, UNIX, 67UNIQUE constraint, 204
unique identifierssee also keysdistinguished names, 415
unique indexes, 196unique transaction identifier
Flashback Versions Query feature,259
uniqueness of dataprimary keys enforcing, 36
UNIXsee also directories, UNIX; files,
UNIX; Linux; shell scripts,UNIX
accessing UNIX system, 46archiving, 76backup and restore utilities, 76changing shell prompt, 51choosing between Linux and
UNIX, 932command overview, 48copying files to/from another
system, 78DBA background and training, 12disk storage
availability and performance,86
configuration choices, 85disk partitioning, 87disk striping, 87logical volumes, 87monitoring disk usage, 85RAID systems, 88–92using file systems, 87
displaying environment variables,54
executing environment variables,55
file editors, 63, 65flow control structures, 71input/output redirection, 56introduction, 43kernel, 45login to another system, 78making variables available to child
processes, 54managing Oracle databases on
Linux systems, 933managing Oracle databases on
UNIX systems, 909Windows and UNIX
differences, 912–918Oracle Database 10g installation
on, 279performance monitoring, 79–85processes, 74remote access to UNIX server, 77scheduling jobs, 76session, 47shells, 45starting connectionless SQL*Plus
session, 494starting SQL*Plus session from,
492system administration and Oracle
DBA, 75
telnet, accessing server using, 77troubleshooting iSQL*Plus startup
on, 529using SSH (secure shell), 78variable types, 53
shell variables, 54user created variables, 53
vi editor, 63UNIX commands
basic commands, 48, 50at, 77batch, 77cat, 52, 58cd, 48, 62chgrp, 61chmod, 60–61, 70cp, 59cpio, 76crontab, 76cut, 66date, 48dd, 76df, 80, 86diff, 53du, 80, 86echo, 48egrep, 66env, 54export, 51, 53–54fgrep, 65find, 52ftp, 79get, 79glance, 84gpm, 85grep, 49, 65head, 64history, 49iostat, 82join, 67kill, 75link, 58ln, 58ls, 58, 60man, 50mkdir, 62more, 52, 59mv, 59nohup, 74page, 53passwd, 49paste, 66pipe (|), 52ps, 74, 81put, 79pwd, 49rcp, 78rlogin, 78rm, 59, 62rmdir, 62sar, 82setenv, 54sort, 67source, 56ssh, 78
■INDEX1272
tail, 64tar, 76telnet, 77test, 68top, 83touch, 63uname, 49uniq, 67vmstat, 81whereis, 49which, 49who, 50whoami, 50
batch mode, 54controlling output of, 52editing the previous command, 50help, 50interactive mode, 54overview, 48passing output in as input, 52retrieving the previous command,
50UNIX platforms
caution: not usingSGA_MAX_SIZE, 777
UNKEEP procedure, 1010, 1174UNKNOWN status, listener, 402UNLIMITED TABLESPACE privilege,
178unloading data
populating external tables, 564unrecoverable data files, 662UNRECOVERABLE parameter
backup guidelines, 635direct-path loading, 554SQL*Loader, 554, 555, 556
until-do-done loop, UNIX, 73unused block compression feature,
RMAN, 649UNUSED_SPACE procedure, 1164update anomaly, 29UPDATE statement, 147, 1188updates
Critical Patch Updates, 486updating columns
guidelines for use of indexes, 197updating data
dirty read problem, 229lost update problem, 230nonrepeatable read problem, 230
Upgrade Summary window, 321upgrades
see Oracle Database 10g upgradeupserts
ETL components, 540MERGE statement, 572transforming array data, 581
used_bytes, 198user accounts, 482user class, Oracle Backup, 685user-created variables, UNIX, 53user-defined object types, 149user-defined variables, UNIX, 54User I/O wait class, 1035user processes, 113
user profile file, SQL*Plus, 503–504user profiles, 426–430
altering, 429assigning, 429caution: not assigning profile to
user, 429default profile, 428–429described, 426dropping, 430FAILED_LOGIN_ATTEMPTS
parameter, 482parameters and limits, 426–429password-related security,
427–428resource management, 430resource usage limits, 427
caution: ensuring limits areactivated, 429
determining limits, 430result of reaching a limit, 430
USER variable, SQL*Plus, 517USER views, 1084user-managed backups
see under backupuseradd command, 295user’s space quota errors, 270USERENV application context
namespacepredefined attributes, 455predefined session attributes, 454
USERID parameter, SQL*Loader, 548users
altering properties of user’ssession, 146
altering users, 425assigning users to consumer
groups, 438centralized user authorization, 476changing passwords for default
users, 371changing user password, 425controlling use of resources,
426–430creating tablespaces, 424creating users, 422
assigning tablespace quotas,424
privileges, 423creating/altering temporary
tablespace groups, 167DBA security role, 4DBA views for managing, 452DBA_USERS view, 1091determining SQL user currently
executing, 488dropping users, 425–426dynamic performance views,
1121–1123enterprise user security, 476–482granting role to another user, 451identifying high CPU users, 1025killing user session, 489listing user information, 488logging in as different user, 489
managing Oracle on Windows andUNIX, 917
managing users, 422–430, 488default tablespaces, 422resource management, 430temporary tablespaces, 422
maximum number of, 348privileged users, 473profiles
see user profilesprogram global area, 128resource consumer groups, 433resource limits in user profile, 353retrieving current users, UNIX, 50retrieving own username, UNIX,
50revoking tablespace quotas, 424saving user input in variable,
SQL*Plus, 511SHOW USER command, 507sizing SQL work areas for, 353temporary tables, 183unlimited tablespace usage rights,
424users with most waits, 1042
USERS tablespaces, 367USER_ADVISOR_ACTIONS view, 219USER_DUMP_DEST parameter, 112,
340setting trace initialization
parameters, 985USER_OUTLINES view, 1163USER_OUTLINE_HINTS view, 1163USER_TICKS system usage statistic,
1053USE_STORED_OUTLINES parameter,
971utilities
DBMS_UTILITY package, 1181Oracle utilities, 139
utllockt.sql script, 241utlrp.sql script, 325utlu102i.sql script, 317utlu102s.sql script, 318utlxplan.sql script, 975, 976UTL_FILE_DIR parameter, 341, 484,
1169UTL packages
UTL_COMPRESS, 1148UTL_FILE, 1168–1172
setting permissions, 484UTL_MAIL, 1149UTL_RECOMP, 325UTL_SMTP, 1172–1173
VV$ views, 136, 835
V$ACCESS, 1123V$ACTIVE_SESSION_HISTORY,
845, 1131analyzing recent session
activity, 1057analyzing waits, 1041description, 1113
■INDEX 1273
identifying SQL with highestwaits, 1042
most important recent waitevents, 1042
objects with highest waits, 1041users with most waits, 1042using, 1041
V$ADVISOR_PROGRESS, 1123V$ALERT_TYPES, 833, 1135V$ARCHIVED_LOG, 691, 734, 1124V$ARCHIVE_DEST, 1125V$ARCHIVE_DEST_STATUS, 1125V$ASM_ALIAS, 1142V$ASM_CLIENT, 1142V$ASM_DISK, 1142V$ASM_DISKGROUP, 1142V$ASM_DISKGROUP_STAT, 1142V$ASM_DISK_STAT, 1142V$ASM_FILE, 1142V$ASM_OPERATION, 1142V$BACKUP, 691, 1120V$BACKUP_CORRUPTION, 678V$BACKUP_DEVICE, 1120V$BACKUP_FILES, 678V$BACKUP_PIECE, 1120V$BGPROCESS, 913, 915, 1140V$BUFFER_POOL, 1117V$BUFFER_POOL_STATISTICS,
1017, 1118V$CONTROLFILE, 1141V$CONTROLFILE_RECORD_
SECTION, 1141V$COPY_CORRUPTION, 678V$DATABASE, 388, 1137V$DATAFILE, 691, 1140V$DB_CACHE_ADVICE, 1017,
1118V$DB_OBJECT_CACHE, 1119V$DISPATCHER, 1137V$EVENT_NAME, 1128V$FILEMETRIC, 1136V$FILEMETRIC_HISTORY, 1136V$FILESTAT, 1140V$FIXED_TABLE, 1136V$FIXED_VIEW_DEFINITION,
1136V$FLASHBACK_DATABASE_LOG,
747, 1128V$FLASHBACK_DATABASE_STAT,
747, 1128V$FLASH_RECOVERY_AREA_
USAGE, 646, 1128V$INSTANCE, 387, 1131V$INSTANCE_RECOVERY, 331,
1126V$LATCH, 1133V$LATCHNAME, 1133V$LIBRARYCACHE, 1009, 1119V$LIBRARY_CACHE_MEMORY,
1010V$LICENSE, 1136V$LOCK, 241, 1132V$LOCKED_OBJECT, 1133V$LOCK_HOLDERS, 241V$LOG, 691, 858, 1123
V$LOGFILE, 857, 1124V$LOGMNR_CONTENTS, 732, 735V$LOG_HISTORY, 691, 720V$MAP_XYZ views, 863V$METRICNAME, 833, 1135V$MTTR_TARGET_ADVICE, 1126V$NLS_PARAMETERS, 1139V$OBJECT_USAGE, 202V$OBJECT_USAGE, 1140V$OPTION, 1137V$OSSTAT, 1053, 1140V$PARAMETER, 357, 777, 1138V$PGASTAT, 1021, 1119V$PGA_TARGET_ADVICE, 1020V$PROCESS, 1023, 1133V$PROCESS_MEMORY, 1023, 1134V$PWFILE_USERS, 1121V$RECOVERY_FILE_DEST, 646,
1127V$RECOVERY_PROGRESS, 1122V$RECOVER_FILE, 1127V$RESOURCE_PLAN, 876V$RESTORE_POINT, 751, 1127V$RMAN_CONFIGURATION, 1120V$RMAN_OUTPUT, 678V$RMAN_STATUS, 678, 710V$ROLLSTAT, 254V$ROWCACHE, 1119V$RSRC_CONSUMER_GROUP,
441, 1134V$RSRC_PLAN, 441, 1134V$SEGMENT_NAME, 1045V$SEGMENT_STATISTICS, 1045V$SEGSTAT, 1045V$SERVICEMETRIC, 827, 1135V$SERVICEMETRIC_HISTORY,
1135V$SERVICE_WAIT_CLASS, 1130V$SESSION, 241, 1122, 1131
analyzing waits, 1040current active session data, 845managing Database Resource
Manager, 441obtaining wait information,
1039showing wait information, 1037
V$SESSION_CONNECT_INFO,1121
V$SESSION_EVENT, 1037V$SESSION_LONGOPS, 622, 678,
1122V$SESSION_WAIT
analyzing waits, 1040, 1043columns in view, 1037monitoring resumable
operations, 273showing wait information, 1037wait classes of session waits,
1043V$SESSION_WAIT_CLASS, 1044,
1130V$SESSION_WAIT_HISTORY,
1131, 1040V$SESSTAT, 1027V$SESS_IO, 1122
V$SESS_TIME_MODEL, 762, 1076,1130
V$SGA, 776, 778, 1116V$SGASTAT, 778, 1116V$SGA_DYNAMIC_
COMPONENTS, 778, 1117V$SHARED_POOL_ADVICE, 1010,
1014, 1118V$SPPARAMETER, 110, 375, 1138V$SQL, 992–994, 1128V$SQLSTATS, 1129V$SQLTEXT, 1131V$SQL_PLAN, 994V$SQL_WORKAREA_HISTOGRAM,
1022V$STATISTICS_LEVEL, 1139V$SYSAUX_OCCUPANTS, 1142V$SYSMETRIC, 827, 1035, 1135V$SYSMETRIC_HISTORY, 1135V$SYSSTAT, 1027, 1129V$SYSTEM_EVENT, 1034,
1037–1038, 1039V$SYSTEM_PARAMETER, 1138V$SYSTEM_WAIT_CLASS, 1043,
1130V$SYS_TIME_MODEL, 761, 1076,
1130V$TABLESPACE, 1140V$TEMPFILE, 1140V$TEMPLATE, 1142V$TRANSACTION, 254, 1134V$TRANSPORTABLE_PLATFORM,
1142V$UNDOSTAT, 248, 253, 1134V$V$PGA_TARGET_ADVICE, 1119V$VERSION, 1137V$WAITCLASSMETRIC, 1044, 1135V$WAITSTAT, 1039V$WAIT_STAT, 1128V$XML_AUDIT_TRAIL, 1099
VALIDATE...RESTORE command, 708VALIDATE BACKUP command,
RMAN, 708VALIDATE BACKUPSET command,
RMAN, 664, 679VALIDATE command, RMAN, 679validating method, SQL/XML, 1211validation commands
RMAN commands, 664validating an object online, 812
value-based security, 208VARIABLE clause, 562variable record format, SQL*Loader,
545variables
creating session variables,SQL*Plus, 516
deleting session variables,SQL*Plus, 516
displaying values, SQL*Plus, 506predefined SQL*Plus variables, 517SQL*Plus environment variables
see environment variables,SQL*Plus
■INDEX1274
variables, UNIXshell variables, 54showing variable value, 53user-created variables, 53variable types, 53
varrays, 1202versions, 282
checking kernel version, 290checking operating system, 290fixing bugs, 1003Flashback Versions Query feature,
258locating product files, 286multiple names for same version,
284parameter enabling behavior of
previous, 350platform version, 288Pre-Upgrade Information Tool, 317retrieving version of command,
UNIX, 49upgrade paths, 315V$VERSION, 1137
VERSIONS clauseFlashback Versions Query feature,
258, 260VERSIONS_XYZ pseudo columns
Flashback Versions Query feature,259
VER[IFY] variable, SQL*Plus, 501vi editor, UNIX, 63, 64view privileges, 446viewing files, UNIX, 58, 59views, 207–214
see also DBA views; V$ viewsavoiding improper use of views,
967creating, 208data manipulation using, 208database security, 452DBA_VIEWS view, 1110definition storage, 207dropping, 208Flashback Versions Query feature,
260FLASHBACK_TRANSACTION_
QUERY view, 261materialized views, 209–214querying, 207reasons for using, 207security, 208tables and, 207
virtual memory, 1029virtual private database
see VPDvmstat utility, UNIX, 81
CPU performance, 1024examining system performance,
1053operating system memory
management, 1057volume identification sequence
Oracle Backup media, 686
VPD (virtual private database)application context and, 453column-level VPD, 460–461query rewriting method, 453row-level access, 453
Wwait classes, 1035
analyzing instance performance,1036
breakdown of waits by, 1043determining total/percentage
waits, 1036dynamic performance views,
1130–1131metric values of, 1044time spent in each type, 1044V$SESSION_WAIT view, 1043
Wait Event History, Database Control,1071
wait event information, 1045–1046key dynamic performance tables
showing, 1036obtaining wait information,
1038–1040wait event views, 1034wait events, 1035
analyzing instance before tuning,1076
ASH reports, 848complete listing of, 1047database wait statistics, 1034eliminating the contention, 1078important Oracle wait events,
1047–1052buffer busy, 1047–1048checkpoint completed, 1048db file scattered read, 1048db file sequential read, 1049direct path read, 1049direct path write, 1049enqueue, 1050free buffer, 1050idle, 1052latch free, 1050log buffer space, 1051log file switch, 1052log file sync, 1052
instance performance, 1054instance wide wait event status,
1039most important recent wait
events, 1042WAIT option
committing transaction, 227wait statistics
data collected by AWR, 835dynamic performance views
containing, 1034identifying SQL with highest waits,
1042measuring instance performance,
1033–1035
objects with highest waits, 1041segment-level statistics, 1045users with most waits, 1042
WAITS parameter, TKPROF, 986wallets
see Oracle Walletswarning threshold, 832warning_value attribute, 163Web Applications
connecting to Oracle, 393monitoring system with Grid
Control, 907web-based management, OEM, 884web pages
generating from SQL*Plus, 505,524
web services datatable functions mining, 579
webDba role, iSQL*Plus, 534whatis command, UNIX, 51WHEN clause, SQL*Loader, 557WHERE clauses
avoiding Cartesian joins, 960comparison operators, 1186filtering data, 1189guidelines for use of indexes, 197LIKE condition, 1187subqueries, 147writing efficient SQL, 957–959
whereis command, UNIX, 49which command, UNIX, 49WHICH_LOG attribute
PURGE_LOG procedure, 875WHILE loop, PL/SQL, 1206while-do-done loop, UNIX, 72who command, UNIX, 50whoami command, UNIX, 50whole database backups, 633, 634window groups, Oracle Scheduler,
865, 880Windows
at scheduling utility, 516creating Windows batch script, 516installing Oracle database 10g on,
919–920managing Oracle databases on,
921–929installing Oracle database 10g,
919–920Windows and UNIX
differences, 912, 918Windows registry, 920–921
Oracle Administration Assistantfor NT, 928–929
Oracle database 10g and, 909–912Oracle services, 922–925starting up and shutting down
database, 925–926uninstalling Oracle on, 930–931
Windows Active Directory, 912Windows GUI
connecting to SQL*Plus, 494
■INDEX 1275
Windows registry, 920–921ALL_HOMES subkey, 921HOMEID key, 921REGEDIT command, 921removing registry keys, 930
Windows services, 915windows, Oracle Scheduler
changing resource plans using,876–880
creating, 877–878description, 865maintenance window, 877managing, 878–879overlapping windows, 878, 880prioritizing jobs, 879purpose, 876window priorities, 880
WINDOW_PRIORITY attribute, 877WITH ADMIN OPTION
granting roles, 451WORD_WRAPPED option
SET SERVEROUTPUT command,502
WORKAREA_SIZE_POLICYparameter, 353
automatic PGA management, 129worker process, Data Pump, 598
workloadAutomatic Workload Repository
(AWR), 142workload mode
collecting operating systemstatistics, 953
Workload Source pagegetting SQL Access Advisor
recommendations, 217workloads
see AWRWorkspace Manager
benefits of using, 274DBMS_WM package, 1174managing long transactions,
273–275table versioning, 274workspaces, 274
WRAPPED optionSET SERVEROUTPUT command,
502write ahead protocol, 116
database writer (DBWn) process,132
durability of transactions, 229write permission, UNIX files, 59write-allowed period
Oracle Backup media, 686writing files, UNIX, 63
XX session, UNIX, 47X Window emulators, UNIX, 46X Window System emulation, 301X$ tables, 136XID column, 262XML (Extensible Markup Language )
creating relational view from XMLdocument, 1214
inserting XML document intoOracle table, 1212
Oracle XML DB, 1210–1214semistructured database model,
41setting up XML schema, 1213SQL*Loader utility, 559viewing XML data stored in Oracle
table, 1212XML and SQL, 146
XML schema, 149XML value
AUDIT_TRAIL parameter, 462XMLType data type, 1211
■INDEX1276