33
The most comprehensive Oracle applications & technology content under one roof The most comprehensive Oracle applications & technology content under one roof Why Use Oracle Data Guard? Milina Ris7c TelstraClear, New Zealand

Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof The most comprehensive Oracle applications & technology content under one roof

Why  Use  Oracle  Data  Guard?  

Milina  Ris7c  TelstraClear,  New  Zealand  

Page 2: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Data  Guard  Func,ons  

•  High  availability  •  Data  protec,on  •  Disaster  recovery  •  Repor,ng  •  Backup  and  recovery    

Page 3: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Data  Guard  Configura,ons  

•  Physical  Standby  – block  for  block  iden,cal  copy  of  primary  database  

•  Logical  Standby  – same  logical  informa,on  as  primary  database  

Page 4: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Data  Guard  11g  

Snapshot  Standby  •  fully  updateable  standby  database  •  tes,ng  on  produc,on  like  data  •  easily  resynchronised  with  produc,on  

Page 5: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Data  Guard  11g  

Ac,ve  Data  Guard  •  Real-­‐,me  repor,ng  •  Fast  incremental  backups  •  Automa,c  correc,on  of  corrupted  blocks  

NB:  Requires  separate  license  

Page 6: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Ac,ve  Data  Guard  

Read-­‐only  applica,on  can  perform:  •  Selects  •  Alter  session  •  Call  stored  procedures  •  Call  remote  procedures  via  DB  links  •  DB  links  to  write  to  remote  databases  

Page 7: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Apply  Lag  Management  11g  

ALTER  SESSION  SET  STANDBY_MAX_DATA_DELAY=600;  

 ORA-­‐03172:  STANDBY_MAX_DATA_DELAY  of  600  seconds  exceeded  

Page 8: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Physical  Standby  

Primarydatabase

Standbydatabase

Database Database copy

Redotransport

Page 9: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Benefits  of  Physical  Standby  

•  Switchover  •  Failover  •  Repor,ng  •  Backup  

Page 10: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Running  Backup  on  Physical  Standby  

Primary  •  4-­‐node  RAC  •  NetApp  Filers  •  No  ASM  •  RMAN  •  TSM  with  TDPO  

Standby  •  4-­‐node  RAC  •  SAN  •  ASM  •  RMAN  •  TSM  with  TDPO  

Page 11: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Filesystem  to  ASM  and  Back  

How  to  duplicate  a  controlfile  when  ASM  is  involved  [ID  345180.1]    

How  to  move  a  datafile  from  a  file  system  to  ASM  [ID  390274.1]    

How  to  move  a  datafile  from  ASM  to  the  file  system  [ID  390416.1]    

Page 12: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Primary RAC database

Standby RAC database Primary Recovery Catalog

Secondary Recovery Catalog

backup

resy

nc

Page 13: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Alterna,ves  for  DR  

Complex  systems  e.g.  Sybase  database  Oracle  Transparent  Gateway  for  Sybase  Third  party  applica,ons  

may  require  alterna,ve  technologies:  •    SAN  replica,on  •    snapshot  technology  

Page 14: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Logical  Standby  Primary

databaseStandbydatabase

Log Transport Services

Log Apply Services

Oracle N

et

Archived Redo Log Files

Archived Redo Log Files

Page 15: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

SQL  Apply  –  Log  Mining  

•  READER  –  reads  archived  redo  logs  •  PREPARER  –  generates  logical  change  records  •  BUILDER  –  groups  LCRs  into  transac,ons    

Page 16: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

SQL  Apply  –  Apply  Processing  

•  ANALYZER  –  iden,fies  dependencies  •  COORDINATOR  –  assigns  transac,ons  •  APPLIER  –  applies  transac,ons    

Page 17: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Benefits  of  Logical  Standby  

•  Switchover  •  Failover  •  Repor,ng  •  Addi,onal  objects  

Page 18: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Importance  of  NOT  NULL  

TABLE1  ID      NUMBER(5)  NAME  VARCHAR2(20)    TABLE2  ID      NOT  NULL    NUMBER(5)  NAME            VARCHAR2(20)  

Page 19: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Importance  of  NOT  NULL  

UPDATE  SQL  on  standby  database    UPDATE  table1  SET  name  =  'Smith'  WHERE  (id  =  :b1  OR  id  IS  NULL)  AND                                (name  =  :b2  OR  name  IS  NULL)      

Page 20: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Tracing  APPLIER  

SELECT  PID,  TYPE,  STATUS,  HIGH_SCN  FROM  V$LOGSTDBY    oradebug  setospid  <APPLIER  pid>  oradebug  unlimit  oradebug  event  10046  trace  name  context  forever,  level  12  

Page 21: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Tracing  APPLIER  

oradebug  setospid  <APPLIER  pid>  oradebug  event  10046  trace  name  context  off    Trace  file  will  be  generated  in  bdump    tkprof  <fn>  tkprof.out  explain=  \"/  as  sysdba\"    

Page 22: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Data  Guard  Modes  

ALTER  DATABASE  GUARD  {ALL|STANDBY|NONE}    ALL  –  read  only  STANDBY  –  read  only  for  maintained  objects  NONE  –  fully  updateable  

Page 23: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Bulk  Updates  

Primary  Single  update  of  million  rows    Standby  Million  updates  on  standby  

Page 24: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Reinstan,a,ng  Tables  

DBMS_LOGSTDBY.INSTANTIATE_TABLE                                ('HR',  'EMPLOYEES',  'primary_dblink');    

 •  Log  apply  needs  to  be  stopped  •  Table  is  dropped  and  recreated  •  Addi,onal  grants  and  indexes  are  lost  

Page 25: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

To  Skip  or  Not  to  Skip  

•  Temporary  and  audit  tables  •  User  crea,on  •  Schemas  •  Index  rebuilds  •  Par,,on  maintenance  

Page 26: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Par,,on  Maintenance  

Produc7on    •  Keep  12  months  •  Archive  older  data  •  Drop  older  par,,ons    

Repor7ng    •  Keep  24  months  •  Drop  older  par,,ons  

Page 27: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Skipping  Transac,ons  

execute  dbms_logstdby.skip    ('SCHEMA_DDL',  'HR',  'DEPT');  ('DML',  'HR',  '%TEMP');  ('ALTER  INDEX',  '%',  '%');      

Page 28: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Skipping  Drop  Par,,on  

execute  dbms_logstdby.skip    ('ALTER  TABLE',  '<schema  name>',                        '<object  name>',  '<procedure  name>');  

Page 29: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Skipping  Drop  Par,,on  

IF  upper(statement)  like  '%DROP%PARTITION%'  THEN          skip_ac,on  :=  sys.dbms_logstdby.SKIP_ACTION_SKIP;  ELSE          skip_ac,on  :=  sys.dbms_logstdby.SKIP_ACTION_APPLY;  

END  IF;  

Page 30: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Hints  –  What  to  Watch  Out  For  

•  Explicitly  using  inappropriate  indexes  •  Hin,ng  full  table  scan  •  Using  too  high  parallel  degree  

Page 31: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Unsupported  Opera,ons  

Table  compression  up  to  11gR2    workaround  –  triggers  

 Segment  shrinking    workaround  –  move  

   

Page 32: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Logical  Standby  Tips  

•  Sound  primary  database  data  model  •  Beware  bulk  updates  •  Know  the  limits  •  Op,mise  long  running  processes  

Page 33: Database & Technology 1 _ Milina Ristic _ Why use oracle data guard.pdf

The most comprehensive Oracle applications & technology content under one roof

Q&A  

[email protected]