Download Data Pump

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Concurrency control wikipedia , lookup

Functional Database Model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Ingres (database) wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

SQL wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Oracle Database wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
OUGF Seminar
Autumn 2003
g
Oracle 10 Database Engine
New Features
Tanel Poder
independent technology consultant
http://integrid.info
06-Nov-03
Tanel Poder
OUGF 2003
1/30
Agenda
•
•
•
•
•
•
•
•
•
What’s behind the 10g buzzwords
Manageability enhancements
Performance tuning enhancements
New export-import tool Data Pump
Parameters, views
SQL and PL/SQL
Recovery and Flashback
Wrap-up
Questions
Tanel Poder
OUGF 2003
2/30
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
– “undrop” table
– etc..
Tanel Poder
OUGF 2003
3/30
Manageability
• SGA_TARGET
– Sets total size for all SGA components
– Buffer Cache, Shared Pool, Large Pool, Java Pool
– Dynamically and automatically adjustable
• PGA_AGGREGATE_TARGET
– Available since 9i
– Sets total size for all server processes
– sort_area_size, sort_area_retained_size,
hash_area_size, bitmap_merge_area_size
– Contents automatically managed
Tanel Poder
OUGF 2003
4/30
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
Tanel Poder
NLS_LANGUAGE
NLS_TERRITORY
OPEN_CURSORS
PROCESSES
REMOTE_LISTENER
REMOTE_LOGIN_PASSWORDFILE
ROLLBACK_SEGMENTS
SESSIONS
SHARED_SERVERS
STAR_TRANSFORMATION_ENABLED
UNDO_MANAGEMENT
UNDO_TABLESPACE
OUGF 2003
5/30
Manageability
• SYSAUX tablespace for system utilities
Tanel Poder
Module
Tablespace
SYS objects
SYSTEM
Oracle Data Mining
ODM
OEM Repository
OEM_REPOSITORY
Oracle OLAP
CWMLITE
Oracle interMedia
SYSTEM
Oracle Spatial
SYSTEM
Oracle Ultra Search
DRSYS
RMAN Recovery Catalog
TOOLS
Sample Schemas
Example
Workspace Manager
SYSTEM
Oracle XML DB
XDB_RESINFO
Workload Repository
New in 10g
OUGF 2003
SYSAUX
6/30
Online Rebuilds
• Some functionality since already in 8i, 9i
– Online index build, rebuild
– Online index organized table rebuild
– Analyze/validate structure online
• Online table redefinition
– dbms_redefinition package in 9i
– change table physical structure online
– allows adding, changing, removing columns
online
– Enhanced in 10g
Tanel Poder
OUGF 2003
7/30
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
Tanel Poder
Free Space
OUGF 2003
8/30
Rename Tablespace
• Useful in Transportable Tablespace
scenarios
• ALTER TABLESPACE user RENAME to u1;
– Can’t rename SYSTEM or SYSAUX
– Tablespace and all datafiles must be online
– Can also rename READ ONLY tablespaces
PROD
Tanel Poder
ARCHIVE
OUGF 2003
9/30
Tablespaces and Groups
• Huge tablespaces could be separated for
maintenance (backup&recovery) reasons
• Users still have single point for storing data
– CREATE TABLESPACE TS DATAFILE ‘xx’ SIZE 1M
TABLESPACE GROUP G1;
– ALTER TABLESPACE NEWTS TABLESPACE GROUP
G1;
– ALTER TABLESPACE NEWTS TABLESPACE GROUP
‘’;
– CREATE TABLE T(…) TABLESPACE G1;
Tanel Poder
OUGF 2003
10/30
Bigfile Tablespaces
• Support for sizes up to 8 Exabytes!
– 8 000 000 Terabytes
– Max 65535 files in database
– SYSTEM & SYSAUX can’t 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;
Tanel Poder
OUGF 2003
11/30
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
Tanel Poder
OUGF 2003
12/30
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
Data
Warehouse
Tanel Poder
Data Pump
Client
Data
Pump
Client
Data Pump
PROD
OUGF 2003
13/30
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
• Monitored through DBA_DATAPUMP_JOBS
Tanel Poder
OUGF 2003
14/30
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
Tanel Poder
OUGF 2003
15/30
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
Flashback
Log
DB
Tanel Poder
OUGF 2003
16/30
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;
Tanel Poder
OUGF 2003
17/30
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';
Tanel Poder
OUGF 2003
18/30
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
Tanel Poder
OUGF 2003
19/30
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
Tanel Poder
OUGF 2003
20/30
Table Recovery using Flashback
• DROP TABLE X;
– Table is renamed, not dropped
– Indexes & other structures remain
• 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;
Tanel Poder
OUGF 2003
21/30
Performance Tuning
• RBO is dead, long live the CBO!
– Even data dictionary, SYS tables under CBO
• Optimizer able to use run-time statistics
– exec dbms_stats.gather_system_statistics(…)
– OPTIMIZER_DYNAMIC_SAMPLING
• Multiple Advisors
–
–
–
–
SQL Access & Tuning Advisor
Memory Advisors (SGA, Shared Pool, etc..)
Segment Advisor (Fragmentation, etc..)
Undo Advisor
Tanel Poder
OUGF 2003
22/30
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
Tanel Poder
OUGF 2003
23/30
Performance Troubleshooting
• Automatic Workload Repository
– MMON background process flushes stats to disk
• V$SQL_BIND_CAPTURE
– Captures bind variables for all sessions
– Faster that sql_trace (10046 trace on level 4)
• Event, P1, P2, P3 columns in V$SESSION
for quick diagnosis
– the same information that in V$SESSION_WAIT
• trcsess tool for gathering sessions SQL from
in shared server environment
Tanel Poder
OUGF 2003
24/30
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
Tanel Poder
OUGF 2003
25/30
SQLPLUS Changes
Improvements
• SPOOL CREATE | REPLACE | APPEND
• SHOW RECYCLE BIN
• SQLPROMPT runtime variable substitution
• glogin.sql and login.sql scripts are executed
also on CONNECT
Deimprovements
• No graphical sqlplusw.exe in Windows
• COPY command deprecated
Tanel Poder
OUGF 2003
26/30
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
– like default temporary tablespace in 9i
Tanel Poder
OUGF 2003
27/30
Conclusion
• Lot’s of new features = lot’s of new bugs
• Automatic for small to medium systems
• Big & heavily loaded systems still need care
Tanel Poder
OUGF 2003
28/30
g
Oracle 10 Database Engine
New Features
Questions?
Tanel Poder
integrid.info
OUGF 2003
29/30
g
Oracle 10 Database Engine
New Features
Tanel Poder
Thank you!
http://integrid.info
[email protected]
Tanel Poder
integrid.info
OUGF 2003
30/30