Chapter 59
Getting a Quick Start with Oracle8i
Roman Kab
This chapter focuses on a few very powerful Oracle8i features. Oracle8i is packed with new features and enhancements to the existing, but not fully developed, features introduced in Oracle8. If you are a veteran database administrator who transitioned from Oracle version 6 to Oracle 7.0 and then to 7.1, you will quickly see a trend in feature and functionality introductions. Oracle 7.0 was dramatically different from version 6, but 7.1 really brought Oracle into a new level of relational database management systems (RDBMS). This chapter does not attempt to address new Java Virtual Machine (JVM) support in Oracle8i.
Transportable Tablespaces
The first feature is TRANSPORTABLE TABLESPACES. This option enables tablespace(s) to be copied and plugged into another database. This eliminates long-running, error-prone exports/imports to move operational data to the data warehouse. It is possible to archive large tablespaces faster and with much easier restore. The restore process could be applied to any database, providing more flexibility.
Here are some steps to follow to unplug/transport/plug tablespace(s):
- Identify tablespaces that will not introduce orphans when moved (i.e., indexes without tables). Run:
execute dbms_tts.transport_set_check(‘ts1,ts2’, TRUE); select * from transport_set_violations;
- Make the target tablespace READ ONLY.
- EXP sys/change_on_install TRANSPORT_TABLESPACE=y TABLESPACES=t1,t2 TRIGGERS=y CONSTRAINTS=y GRANTS=y FILE=tt.dmp
- Copy corresponding data files.
- Import entries for the transported tablespaces — a very quick import.
IMP TRANSPORT_TABLESPACE=y DATAFILES=‘/db/t1_jan’,‘/db/t2_feb’ TABLESPACES=t1,t2,... TTS_OWNERS=scott FROMUSER=scott TOUSER=scott FILE=tt.dmp
Transportable tablespaces can be used to distribute data to other databases as well as to consolidate data (see Exhibit 59.1).
Optimizer Plan Stability
If you work at a vendor that builds applications on Oracle databases or an information technology (IT) development shop that needs the application to perform as well at the client site as during system testing, you need to use stored outlines.
Oracle8i offers stored outlines to ensure that the optimizer generates the same execution plan regardless of changes to the system configuration, init parameters, or object statistics.
This feature also benefits high-end Online Transaction Processing (OLTP) sites by having Structured Query Language (SQL) execute without having to invoke the cost-based optimizer at each SQL invocation.
Using CREATE OUTLINE, the command user will create a stored outline that contains an execution plan for each SQL statement. The execution plan remains the same for all SQL statements associated with this outline name. There may be a need to create multiple outlines for the same SQL statements, depending on the time of day they execute (i.e., batch versus daily OLTP reports). This dynamic switching between outlines provides great flexibility and ensures proper application executions. See Appendix 59.1 for an example.
Exhibit 59.1 Data Distribution with Portable Tablespaces
Exhibit 59.2 Oracle Transparently Rewrites SQL Statements to Utilize Materialized Views
Materialized View
Oracle8i introduces many powerful features designed especially for large data warehouses. One of them is summary management using materialized views.
A materialized view is implemented by existing Oracle8 replication technologies. If you have worked with replication, the concept of materialized views will seem familiar. It features a snapshot-like setup with tables storing precomputed summary results. The power of the materialized views comes from transparent access to the views. The Oracle8i database server automatically rewrites queries to use the summary data, rather than retrieving data from detail tables by doing expensive joins and aggregate operations. As shown in Exhibit 59.2, this query rewrite facility is totally transparent to the application, which is not aware of the materialized view. The rewrite capability will appear in other features of the Oracle8i engine.
The CREATE MATERIALIZED VIEW statement is used to create a materialized view. This statement includes a subquery, typically a join or a data aggregation (GROUP BY), the results of which comprise the materialized view. Once created, the view is maintained much like snapshots. The refresh process either completely or incrementally refreshes the data.
Like the replication set of Application Program Interface (API), Oracle provides a collection of materialized view analysis and advisory functions that are callable from any PL/SQL program. These are packaged in the DBMS_OLAP package. See Appendix 59.2 for an example.
Logminer
The ability to analyze data in an online redo or archived redo log file may not appear at the top of a DBA’s list. But when logical data corruption occurs, UNDO SQL statements can be constructed to remedy the problem.
Logminer can enhance application auditing by tracking specific changes to the tables based on username, table name, time, or transaction. Logminer can analyze log files from other databases, as long as they were created on the same operating system and use the same version. See Appendix 59.3 for an example.
Virtual Private Database
Today’s applications and databases require server-enforced and granular access control because clients are connecting from local desktops and external Internet sessions. This new, powerful feature provides the means to access application data from many sources. The virtual private database feature has two components: fine-grained access control and application context. Here is how they work together to implement a safe and consistent security policy across applications.
Fine-Grained Access Control
Access control is implemented by attaching security policies to individual tables. These policies are created using PL/SQL stored packages or functions. The Oracle-supplied DBMS_RLS package is used to associate the security policy functions with the table or view. O...