Oracle10g New Features – I

          Denish Patel

     Database Administrator
OmniTi Computer Consulting Inc.
 à
Flashback Query
•            Oracle9i
                  –             We can see the value of the column at specific time....
Flashback Query
•      Oracle10g
         –     FLASHBACK_TRANSACTION_QUERY
         –     Transaction ID gives more detai...
Flashback Table
•       Reinstating an accidentally dropped table
SQL> select * from tab;
TNAME                      TABTY...
Flashback Table
•              Recyclebin
SQL> show recyclebin

ORIGINAL NAME              RECYCLEBIN NAME               O...
Flashback Table
•            Bewarned
               –        Flashback table does not flash back
                        ...
Rollback Monitoring
•   How long will it take to rollback the transaction ?
•   Oracle9i
      SELECT USED_UREC FROM v$TRA...
SQL> set serveroutput on size 999999

SQL> exec print_table('select * from v$session_longops where sid = 9')
SID          ...
Tablespace Management
•   Advantages of Tablespace:
     –    Limited database segment maintenance using
          online ...
Data Pump
•   EXPORT/IMPORT
    –   INSERT INTO

•   Data Pump
    –   Proprietary APIs to load and unload data
    –   Al...
Data Pump
•   Normal Operation (single thread)
     –   SQL > create directory dpdata1 as 'C:dpdata1';
     –   SQL > gran...
Data Pump
•   Normal Operation (single thread)
     –   SQL > create directory dpdata1 as 'C:dpdata1';
     –   SQL > gran...
Export Monitoring
                                      Data Pump
                                       Select sid,serial...
RMAN
•   Incremental backup
    –   Oracle9i
          •   Scans all blocks
    –   Oracle10g
          •   Analogous to j...
RMAN
•   Incremental Merge
•   Let's say you have the following backup schedule:
     –    Sunday - Level 0 (full), with t...
RMAN
•       Compressed Files
    –    RMAN> backup as compressed backupset incremental level 1
         database;
    –  ...
Auditing
•   Oracle9i
•   FGA – Fine Grained Auditing
     –   Column level audit
     –   Audit condition (i.e balace >10...
Auditing
•   Oracle10g
•   Possible to Audit What
     –   Supports bind variables
     –   audit_trail=db_extended
•   AU...
Data Guard
RAC
References

•   Oracle10g New Features Guide
      –    http://www.oracle.com/technology/pub/articles/10gdba/index.html
• ...
Questions?
Upcoming SlideShare
Loading in …5
×

Oracle10g New Features I

2,436 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,436
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
36
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Oracle10g New Features I

  1. 1. Oracle10g New Features – I Denish Patel Database Administrator OmniTi Computer Consulting Inc. à
  2. 2. Flashback Query • Oracle9i – We can see the value of the column at specific time. • Oracle10g – We can see value of data changes in a period – Let's look at the Foreign Exchange Application: RATES (Currency,rate) SQL> select versions_starttime as v_starttime, versions_endtime as v_endtime, versions_xid as v_xid , versions_operation as v, rate from rates versions between timestamp minvalue and maxvalue order by VERSIONS_STARTTIME ; V_STARTTIME V_ENDTIME V_XID V RATE ----------------------------- ----------------------------- ----------------------- --- --------------- 26-JAN-09 11.58.37 AM 26-JAN-09 11.58.39 AM 0700190030030000 I 1.23183 26-JAN-09 11.58.37 AM 26-JAN-09 11.58.52 AM 02000F0039030000 U 1.23184 26-JAN-09 11.58.52 AM 26-JAN-09 11.59.01 AM 0700110031030000 U 1.23 26-JAN-09 11.59.01 AM 09000B00F2030000 D 1.23 26-JAN-09 11.59.16 AM 26-JAN-09 11.59.33 AM 04000E0041030000 I 1.23111 26-JAN-09 11.59.33 AM 0100190041030000 U 1.23112
  3. 3. Flashback Query • Oracle10g – FLASHBACK_TRANSACTION_QUERY – Transaction ID gives more detailed SQL statement – SQL > SELECT UNDO_SQL FROM FLASHBACK_TRANSACTION_QUERY WHERE XID = '04000E0041030000'; UNDO_SQL --------------------------------------------------------------------------- insert into "DENISH"."RATES"("CURRENCY","RATE") values ('CAD','1.23111');
  4. 4. Flashback Table • Reinstating an accidentally dropped table SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------ ------- ---------- RECYCLETEST TABLE Now, we accidentally drop the table: SQL> drop table recycletest; Table dropped. Let's check the status of the table now. SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE
  5. 5. Flashback Table • Recyclebin SQL> show recyclebin ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME ---------------- ------------------------------ ------------ ------------------ RECYCLETEST BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE 2009-02-06:16:13:31 • Flash back table SQL> FLASHBACK TABLE RECYCLETEST TO BEFORE DROP; FLASHBACK COMPLETE. SQL> SELECT * FROM TAB; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- RECYCLETEST TABLE – Purge Recycle bin to free up space: • PURGE RECYCLEBIN; – Permanently drop table : • DROP TABLE RECYCLETEST PURGE;
  6. 6. Flashback Table • Bewarned – Flashback table does not flash back associated objects like indexes and triggers SELECT OBJECT_NAME, ORIGINAL_NAME, TYPE FROM USER_RECYCLEBIN WHERE BASE_OBJECT = (SELECT BASE_OBJECT FROM USER_RECYCLEBIN WHERE ORIGINAL_NAME = 'RECYCLETEST') AND ORIGINAL_NAME != 'RECYCLETEST'; OBJECT_NAME ORIGINAL_N TYPE ------------------------------ ---------- -------- BIN$04LhcpnianfgMAAAAAANPw==$0 IN_RT_01 INDEX BIN$04LhcpnganfgMAAAAAANPw==$0 TR_RT TRIGGER • Recover associated objects – ALTER INDEX "BIN$04LhcpnianfgMAAAAAANPw==$0" RENAME TO IN_RT_01; – ALTER TRIGGER "BIN$04LhcpnganfgMAAAAAANPw==$0" RENAME TO TR_RT;
  7. 7. Rollback Monitoring • How long will it take to rollback the transaction ? • Oracle9i SELECT USED_UREC FROM v$TRANSACTION; You can calculate it by running above SQL multiple times and manually calculating the rate of release of undo records. • Oracle10g, SELECT time_remaining FROM V$SESSION_LONGOPS WHERE SID=?;
  8. 8. SQL> set serveroutput on size 999999 SQL> exec print_table('select * from v$session_longops where sid = 9') SID :9 SERIAL# : 68 OPNAME : Transaction Rollback TARGET : TARGET_DESC : xid:0x000e.01c.00000067 SOFAR : 10234 TOTALWORK : 20554 UNITS : Blocks START_TIME : 01-jan-2009 16:20:07 LAST_UPDATE_TIME : 01-jan-2009 16:21:24 TIME_REMAINING : 77 ELAPSED_SECONDS : 77 CONTEXT :0 MESSAGE : Transaction Rollback: xid:0x000e.01c.00000067 :10234 out of 20554 Blocks done USERNAME : DENISH SQL_ADDRESS : 00000003B719ED08 SQL_HASH_VALUE : 1430203031 SQL_ID : 306w9c5amyanr QCSID :0
  9. 9. Tablespace Management • Advantages of Tablespace: – Limited database segment maintenance using online and offline tablespaces – Transportable Tablespaces – Allocation of extents per objects per tablespaces • Oracle 10g Features... – Default tablespace management ALTER DATABASE DEFAULT TABLESPACE <tsname>; – Renaming a Tablespace ALTER TABLESPACE <oldname> RENAME TO <newname>;
  10. 10. Data Pump • EXPORT/IMPORT – INSERT INTO • Data Pump – Proprietary APIs to load and unload data – All I/O done on server! – 10-15 Times Faster than Export – 5 times faster than Import – Extract Specific Types: INCLUDE, EXCLUDE • expdp denish/pass directory=DPDATA1 dumpfile=expprocs.dmp include=PROCEDURE • expdp denish/pass directory=DPDATA1 dumpfile=expprocs.dmp include=PROCEDURE:"='PROC1'",FUNCTION:"='FU NC1'" • impdp denish/pass directory=DPDATA1
  11. 11. Data Pump • Normal Operation (single thread) – SQL > create directory dpdata1 as 'C:dpdata1'; – SQL > grant read, write on directory dpdata1 to denish; – C:>expdp denish/password tables=TEST directory=DPDATA1 dumpfile=expTEST.dmp job_name=TEST_EXPORT • Parallel Operation (Multi Thread) – expdp ananda/abc123 tables=CASES directory=DPDATA1 dumpfile=expCASES_%U.dmp parallel=4 job_name=Cases_Export
  12. 12. Data Pump • Normal Operation (single thread) – SQL > create directory dpdata1 as 'C:dpdata1'; – SQL > grant read, write on directory dpdata1 to denish; – C:>expdp denish/password tables=TEST directory=DPDATA1 dumpfile=expTEST.dmp job_name=TEST_EXPORT • Parallel Operation (Multi Thread) – expdp ananda/abc123 tables=CASES directory=DPDATA1 dumpfile=expCASES_%U.dmp parallel=4 job_name=Cases_Export
  13. 13. Export Monitoring Data Pump Select sid,serial#,sofar,totalwork Export> status Job: CASES_EXPORT from v$session_longops Operation: EXPORT where opname='TEST_EXPORT' Mode: TABLE State: EXECUTING and sofar!=totalwork; Degree: 1 Job Error Count: 0 Dump file: C:dpdata01expTEST.dmp bytes written = 2048 Worker 1 Status: State: EXECUTING Object Schema: DENISH Object Name: TEST Object Type: TABLE_EXPORT/TBL_TABLE_DATA/TABLE/TABLE_DATA Completed Objects: 1 Total Objects: 1 Completed Rows: 4687818
  14. 14. RMAN • Incremental backup – Oracle9i • Scans all blocks – Oracle10g • Analogous to journals in filesystems • Tracks changed blocks – alter database enable block change tracking using file 'c:rman_bkupschange.log'; • Disable Tracking – alter database disable block change tracking; • Verify Tracking is Enabled? – Select filename, status from v$block_change_tracking;
  15. 15. RMAN • Incremental Merge • Let's say you have the following backup schedule: – Sunday - Level 0 (full), with tag level_0 – Monday - Level 1 (incremental) with tag level_1_mon – Tuesday - Level 1 (incremental) with tag level_1_tue • Oracle9i – If database fails on Saturday – Apply level_0 and apply all 6 incrementals • Oracle10 – RMAN> backup incremental level_1 for recover of copy with tag level_0 database;
  16. 16. RMAN • Compressed Files – RMAN> backup as compressed backupset incremental level 1 database; – RMAN can read the files without uncompressing. • Recovery Preview – Ability to see backups • RMAN> restore database preview; • RMAN> restore tablespace users preview;
  17. 17. Auditing • Oracle9i • FGA – Fine Grained Auditing – Column level audit – Audit condition (i.e balace >10000) • Captures “Who” not “What” • Triggers to capture “What”
  18. 18. Auditing • Oracle10g • Possible to Audit What – Supports bind variables – audit_trail=db_extended • AUDIT update on SCOTT.EMP by access; • View DBA_AUDIT_TRAIL • Additional info i.e SCN, XID • Lots of rollback transactions? – Use Trigger
  19. 19. Data Guard
  20. 20. RAC
  21. 21. References • Oracle10g New Features Guide – http://www.oracle.com/technology/pub/articles/10gdba/index.html • Oracle10g – 2 Day DBA – http://download.oracle.com/docs/cd/B19306_01/server.102/b14196/toc.htm • Oracle10g Online Books – http://www.oracle.com/pls/db102/homepage
  22. 22. Questions?

×