SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
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.

•            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
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');
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
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;
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;
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=?;
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
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>;
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
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
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
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
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;
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;
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;
Auditing
•   Oracle9i
•   FGA – Fine Grained Auditing
     –   Column level audit
     –   Audit condition (i.e balace >10000)
•   Captures “Who” not “What”
•   Triggers to capture “What”
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
Data Guard
RAC
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
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Presentation oracle net services
Presentation    oracle net servicesPresentation    oracle net services
Presentation oracle net servicesxKinAnx
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architectureMartin Berger
 
Backup and Recovery Procedure
Backup and Recovery ProcedureBackup and Recovery Procedure
Backup and Recovery ProcedureAnar Godjaev
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture pptDeepak Shetty
 
Oracle flashback
Oracle flashbackOracle flashback
Oracle flashbackCambodia
 
Sap basis administrator user guide
Sap basis administrator   user guideSap basis administrator   user guide
Sap basis administrator user guidePoguttuezhiniVP
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new featuresRemote DBA Services
 
Flashback - The Time Machine..
Flashback - The Time Machine..Flashback - The Time Machine..
Flashback - The Time Machine..Navneet Upneja
 
Oracle database 12c intro
Oracle database 12c introOracle database 12c intro
Oracle database 12c intropasalapudi
 
Oracle-L11 using Oracle flashback technology-Mazenet solution
Oracle-L11 using  Oracle flashback technology-Mazenet solutionOracle-L11 using  Oracle flashback technology-Mazenet solution
Oracle-L11 using Oracle flashback technology-Mazenet solutionMazenetsolution
 
Rman Presentation
Rman PresentationRman Presentation
Rman PresentationRick van Ek
 
DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)Gustavo Rene Antunez
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data miningYury Velikanov
 

Was ist angesagt? (20)

DBA oracle
DBA oracleDBA oracle
DBA oracle
 
Less01 Dba1
Less01 Dba1Less01 Dba1
Less01 Dba1
 
RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA RMAN – The Pocket Knife of a DBA
RMAN – The Pocket Knife of a DBA
 
Less05 Network
Less05 NetworkLess05 Network
Less05 Network
 
Presentation oracle net services
Presentation    oracle net servicesPresentation    oracle net services
Presentation oracle net services
 
Oracle RDBMS architecture
Oracle RDBMS architectureOracle RDBMS architecture
Oracle RDBMS architecture
 
Oracle architecture
Oracle architectureOracle architecture
Oracle architecture
 
Backup and Recovery Procedure
Backup and Recovery ProcedureBackup and Recovery Procedure
Backup and Recovery Procedure
 
Oracle architecture ppt
Oracle architecture pptOracle architecture ppt
Oracle architecture ppt
 
Oracle flashback
Oracle flashbackOracle flashback
Oracle flashback
 
Sap basis administrator user guide
Sap basis administrator   user guideSap basis administrator   user guide
Sap basis administrator user guide
 
Oracle database 12c new features
Oracle database 12c new featuresOracle database 12c new features
Oracle database 12c new features
 
Flashback - The Time Machine..
Flashback - The Time Machine..Flashback - The Time Machine..
Flashback - The Time Machine..
 
Oracle database 12c intro
Oracle database 12c introOracle database 12c intro
Oracle database 12c intro
 
Oracle-L11 using Oracle flashback technology-Mazenet solution
Oracle-L11 using  Oracle flashback technology-Mazenet solutionOracle-L11 using  Oracle flashback technology-Mazenet solution
Oracle-L11 using Oracle flashback technology-Mazenet solution
 
Rman Presentation
Rman PresentationRman Presentation
Rman Presentation
 
Analyzing awr report
Analyzing awr reportAnalyzing awr report
Analyzing awr report
 
DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)DBA 101 : Calling all New Database Administrators (WP)
DBA 101 : Calling all New Database Administrators (WP)
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
Oracle 12c Architecture
Oracle 12c ArchitectureOracle 12c Architecture
Oracle 12c Architecture
 

Ähnlich wie Oracle10g New Features I

B35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezB35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezInsight Technology, Inc.
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG PresentationBiju Thomas
 
br_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docbr_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docLucky Ally
 
Optimizing applications and database performance
Optimizing applications and database performanceOptimizing applications and database performance
Optimizing applications and database performanceInam Bukhary
 
Aioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_featuresAioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_featuresAiougVizagChapter
 
SQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershellSQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershellITProceed
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneEnkitec
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionTanel Poder
 
Analyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxAnalyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxssuserbad8d3
 
Discard inport exchange table & tablespace
Discard inport exchange table & tablespaceDiscard inport exchange table & tablespace
Discard inport exchange table & tablespaceMarco Tusa
 
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdfDatabase & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdfInSync2011
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015Yury Velikanov
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 

Ähnlich wie Oracle10g New Features I (20)

B35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezB35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarez
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation
 
br_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.docbr_test_lossof-datafile_10g.doc
br_test_lossof-datafile_10g.doc
 
Oracle ORA Errors
Oracle ORA ErrorsOracle ORA Errors
Oracle ORA Errors
 
Optimizing applications and database performance
Optimizing applications and database performanceOptimizing applications and database performance
Optimizing applications and database performance
 
Aioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_featuresAioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_features
 
SQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershellSQL Track: Restoring databases with powershell
SQL Track: Restoring databases with powershell
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry OsborneIn Memory Database In Action by Tanel Poder and Kerry Osborne
In Memory Database In Action by Tanel Poder and Kerry Osborne
 
Oracle Database In-Memory Option in Action
Oracle Database In-Memory Option in ActionOracle Database In-Memory Option in Action
Oracle Database In-Memory Option in Action
 
Overview of Oracle database12c for developers
Overview of Oracle database12c for developersOverview of Oracle database12c for developers
Overview of Oracle database12c for developers
 
Analyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptxAnalyzing SQL Traces generated by EVENT 10046.pptx
Analyzing SQL Traces generated by EVENT 10046.pptx
 
Discard inport exchange table & tablespace
Discard inport exchange table & tablespaceDiscard inport exchange table & tablespace
Discard inport exchange table & tablespace
 
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdfDatabase & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
Database & Technology 1 _ Tom Kyte _ SQL Techniques.pdf
 
Beginbackup
BeginbackupBeginbackup
Beginbackup
 
AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015AWR DB performance Data Mining - Collaborate 2015
AWR DB performance Data Mining - Collaborate 2015
 
Rmoug ashmaster
Rmoug ashmasterRmoug ashmaster
Rmoug ashmaster
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 

Mehr von Denish Patel

Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres MonitoringDenish Patel
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Denish Patel
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Denish Patel
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDSDenish Patel
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talkDenish Patel
 
Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Denish Patel
 
Two Elephants Inthe Room
Two Elephants Inthe RoomTwo Elephants Inthe Room
Two Elephants Inthe RoomDenish Patel
 
Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDenish Patel
 
Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDenish Patel
 
P90 X Your Database!!
P90 X Your Database!!P90 X Your Database!!
P90 X Your Database!!Denish Patel
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci CompliaceDenish Patel
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionDenish Patel
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepDenish Patel
 

Mehr von Denish Patel (18)

Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDS
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talk
 
Scaling postgres
Scaling postgresScaling postgres
Scaling postgres
 
Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2
 
Two Elephants Inthe Room
Two Elephants Inthe RoomTwo Elephants Inthe Room
Two Elephants Inthe Room
 
Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQL
 
Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQL
 
P90 X Your Database!!
P90 X Your Database!!P90 X Your Database!!
P90 X Your Database!!
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci Compliace
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparition
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRep
 

Oracle10g New Features I

  • 1. Oracle10g New Features – I Denish Patel Database Administrator OmniTi Computer Consulting Inc. à
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Auditing • Oracle9i • FGA – Fine Grained Auditing – Column level audit – Audit condition (i.e balace >10000) • Captures “Who” not “What” • Triggers to capture “What”
  • 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
  • 20. RAC
  • 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