You are on page 1of 31

Oracle 10 Database Engine New Features For Techies

ORACLE 10g

Agenda
Whats behind the 10g buzzwords Manageability enhancements Performance tuning enhancements Exp/imp with Data Pump Parameters, views SQL and PL/SQL Recovery and Flashback Wrap-up Questions
2

Simplicity vs Flexibility
Automatic statistics gathering Advisories Automatic tuning Less than 30 basic (init.ora) parameters
Basic, advanced, hidden parameters

Easier operations
alter tablespace rename flashback queries undrop table etc..
3

Manageability
SGA_TARGET
Sets total size for all SGA components Buffer Cache, Shared Pool, Large Pool, Java Pool Dynamically and automatically adjustable Automatic changes persist in SPFILE

PGA_AGGREGATE_TARGET
Available since 9i Sets total size target for all server processes sort_area_size, sort_area_retained_size, hash_area_size, bitmap_merge_area_size Contents automatically managed
4

Basic Parameters
COMPATIBLE CONTROL_FILES DB_BLOCK_SIZE DB_CREATE_FILE_DEST DB_CREATE_ONLINE_LOG_DEST DB_DOMAIN DB_NAME DB_RECOVERY_FILE_DEST DB_RECOVERY_FILE_DEST_SIZE INSTANCE_NUMBER JOB_QUEUE_PROCESSES LOG_ARCHIVE_DEST_n LOG_ARCHIVE_DEST_STATE_n NLS_LANGUAGE NLS_TERRITORY OPEN_CURSORS PROCESSES REMOTE_LISTENER REMOTE_LOGIN_PASSWORDFILE ROLLBACK_SEGMENTS SESSIONS SHARED_SERVERS STAR_TRANSFORMATION_ENABLED UNDO_MANAGEMENT UNDO_TABLESPACE

Manageability
SYSAUX tablespace for system utilities
Module SYS objects Oracle Data Mining OEM Repository Oracle OLAP Oracle interMedia Oracle Spatial Oracle Ultra Search RMAN Recovery Catalog Sample Schemas Workspace Manager Oracle XML DB Auto. Workload Repository Tablespace SYSTEM (includes AUD$ and FGA_LOG$ tables) ODM OEM_REPOSITORY CWMLITE SYSTEM SYSTEM DRSYS TOOLS Example SYSTEM XDB_RESINFO New in 10g
6

SYSAUX

Online Operations
Some functionality there already in 8i, 9i
Online index build, rebuild Online index organized table rebuild Analyze/validate structure online

Online table redefinition


dbms_redefinition package starting from 9i change table physical structure online allows adding, changing, removing columns online

Rolling database upgrade


Requires Logical Standby database
7

Online Segment Shrink


Can be recommended by Segment Advisor
TABLE HEADER 10111101 11001101 10101111 11101101 00001101 11001101 00001101 10111101 01010101 11011010

High Water Mark

Free Space

alter table enable row movement; alter table t1 shrink space cascade;
TABLE HEADER 11001101 10101111 11101101 00001101 11001101 10101111 11101101 00001101 11001101 00001101

High Water Mark

Free Space
8

Rename Tablespace
Useful in Transportable Tablespace scenarios ALTER TABLESPACE prod RENAME to arc1;
Cant rename SYSTEM or SYSAUX Tablespace and all datafiles must be online Can also rename READ ONLY tablespaces

PROD

ARC1

Temporary Tablespace Groups


Can create several temporary tablespaces and assign them to a tablespace group Can assign the tablespace group as users temporary tablespace Parallel Query and Parallel execution slaves can spread temporary segments on different tablespaces
alter tablespace temp1 tablespace group t; create temporary tablespace temp2 tempfile 'temp2_01.dbf' size 100m tablespace group t; alter tablespace temp1 tablespace group '';
10

Bigfile Tablespaces
Support for sizes up to 8 Exabytes!
8 000 000 Terabytes Max 65535 files in database SYSTEM & SYSAUX cant be bigfile tablespaces
8 000 000 000 000 000 000 bytes

CREATE BIGFILE TABLESPACE bigtbs DATAFILE '/u02/oracle/data/bigtbs01.dbf SIZE 50G EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
11

Who Needs This?!


Who could possibly outgrow previous database size limits? 9i limits 65534 files per database 22 2 -1=4,194,303 blocks per datafile 32kB max blocksize (not on all platforms) Total max size of 9i database:
65534*4194303*32 kB8055 TB8 Petabytes! 38000*4194303*16 kB2.5 Petabytes! Practical size limit in reality is even smaller

CERN in Switzerland: 5-8 PB data per year


12

Crossplatform Transportable TS
RMAN> CONVERT TABLESPACE sales_1,sales_2 2> TO PLATFORM Microsoft Windows NT 3> FORMAT /temp/%U; ... Transporting Tablespaces Between Databases input datafile fno=00004 name=/u01/oracle/oradata/salesdb/sales_101. dbf converted datafile=/temp/data_D-10_I3295731590_TS-EXAMPLE_FNO-4_06ek24vl channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:45
13

Data Pump
A server-managed data transportation tool Direct load/extract capabilities Very high performance/efficient with large data sets Data Replacement for exp/imp Pump
old exp/imp remain supported
Client Data Pump Client

Data Pump

Data Pump

Data Warehouse

PROD

14

Data Pump
Commands expdp/impdp Can use files or direct network transfer Dynamic configuration, resumable operations Client can detach and reconnect Can be parallelized using PARALLEL
Even loads to/from external text files Parallelization level can be changed on the fly for long running jobs

Monitored through DBA_DATAPUMP_JOBS


15

Data Pump Options


Fine-Grained Object Selection
exclude=function exclude=procedure exclude=package:like PAYROLL% include=table content=metadata_only | data_only | both query=modify_date > sysdate-1

DDL Transformations, DDL extract table_exists_action


skip, append, truncate, replace
16

FlashBack Database
Flash Recovery Area must be configured
Flashback logs are stored there Consisting of old database block images Fast rollback of database, no redologs required
Server Process Server Process Server Process

DB

Flashback Log
17

FlashBack Database
Configuration parameters: DB_RECOVERY_FILE_DEST DB_RECOVERY_FILE_DEST_SIZE DB_FLASHBACK_RETENTION_TARGET Commands: ALTER DATABASE FLASHBACK ON; ALTER DATABASE FLASHBACK OFF; ALTER TABLESPACE test1 FLASHBACK OFF; ALTER TABLESPACE test1 FLASHBACK ON;
18

FlashBack Options
Flashback Query: exec dbms_flashback.enable_at_time(); select * from table; exec dbms_flashback.disable; select * from table AS OF timestamp ; Flashback Table: FLASHBACK TABLE t1 TO SCN 12345; FLASHBACK TABLE t1 TO TIMESTAMP '2003-03-03 12:05:00';
19

Flashback Row History


SELECT versions_xid XID, versions_startscn START_SCN, versions_endscn END_SCN, versions_operation OPERATION, empname, salary FROM hr.employees_demo VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE where empno = 111; XID START_SCN END_SCN OPERATION EMPNAME SALARY --- --------- ------- --------- ------- -----0004000700000058 113855 I Tom 927 000200030000002D 113564 D Mike 555 000200030000002E 112670 113564 I Mike 555 3 rows selected

Useful for auditing


20

Flashback Transaction History


select xid, start_scn, commit_scn, operation, undo_sql, table_name from dba_transaction_query where xid = 000200030000002D; XID START_SCN COMMIT_SCN OPERATION UNDO_SQL --- --------- ---------- --------- ------------------------000200030000002D 112670 113565 D insert into "SCOTT"."EMP" ("EMPNO","EMPNAME","SALARY") values ('111','Mike','655') 000200030000002D 112670 113565 I delete from "SCOTT"."DEPT" where "DEPTNO" = '20' and "DEPTNAME" = 'Finance' 000200030000002D 112670 113565 D update SCOTT.EMP set SALARY = 555 where EMPNO = 111 and EMPNAME = Mike and SALARY = 655 3 rows selected
21

Table Recovery using Flashback


DROP TABLE X;
Table is renamed internally, not dropped Indexes & other structures remain Table is purged when out of free space or quota

SELECT * FROM RECYCLEBIN;


Systemwide recyclebin DBA_RECYCLEBIN Or show recyclebin command in sqlplus

FLASHBACK TABLE RB$$3560$TABLE$1 TO BEFORE DROP RENAME TO scott.emp; PURGE RECYCLEBIN; DROP TABLE X PURGE; 22

Performance Tuning
RBO is dead, long live the CBO!
Even data dictionary, SYS tables using CBO However, RBO is gone nowhere, its available

Optimizer able to use run-time statistics


exec dbms_stats.gather_system_statistics() OPTIMIZER_DYNAMIC_SAMPLING (default: 2)

Multiple Advisors
SQL Access & Tuning Advisor Memory Advisors (SGA, Shared Pool, etc..) Segment Advisor (Fragmentation, etc..) Undo Advisor
23

Advisor Information
DBA_ADVISOR_FINDINGS DBA_ADVISOR_RECOMMENDATIONS DBA_ADVISOR_RATIONALE And many more All the information is accessible through DBA_ and V$ data dictionary views The reasons and rationale behind recommendations can be seen

24

Performance Troubleshooting
Automatic Workload Repository
Runtime execution statistics are gathered in memory MMON background process flushes stats to disk

V$SQL_BIND_CAPTURE
Samples bind variables for all sessions Faster than sql_trace (10046 trace on level 4) But doesnt capture all variable types And doesnt capture occurences of bindings
_cursor_bind_capture_interval defaults to 900 seconds

Good for getting samples of database operations


25

Performance Troubleshooting (2)


Event, P1, P2, P3 columns in V$SESSION for quick diagnosis
the same information that in V$SESSION_WAIT

dbms_monitor package
set tracing and statistics gathering in sessions based on sessionid, client_id, module and action attributes RAC aware, monitoring remains active until explicitly disabled

trcsess tool for gathering sessions SQL from in shared server environment
Sql trace (10046) reports module, action, client_id information to trace file
26

Improved Timing and Statistics


Old methods
V$SESSION_EVENT, V$SYSTEM_EVENT V$SYSSTAT, V$SESSTAT, V$FILESTAT, Contained cumulative information since startup

New opportunities
V$EVENTMETRIC, V$SESSMETRIC, V$SYSMETRIC, V$FILEMETRIC V$SYSMETRIC_HISTORY, V$SESSION_WAIT_HISTORY Contain same statistics, but sampled over interval, also history views
27

SQLPLUS Changes
Improvements SPOOL CREATE | REPLACE | APPEND
also works for SAVE command

SHOW RECYCLE BIN SQLPROMPT runtime variable substitution


SET SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER >"

glogin.sql and login.sql scripts are executed also on CONNECT Deimprovements No graphical sqlplusw.exe in Windows COPY command deprecated
28

Other
dbms_scheduler
calendar Expressions: Yearly, Monthly, Weekly, Daily, Hourly, Minutely, Secondely

alter system flush buffer_cache; drop database;


database must be closed mounted exclusively restricted

default user tablespace


specifies default tablespace for new users, similar to default temporary tablespace in 9i
29

Conclusion
This was probably < 1% of all new features Lots of new features = lots of new bugs Automatic for small to medium systems Big & heavily loaded systems still need care

30

Oracle 10 Database Engine

Thank you!

31

You might also like