SlideShare a Scribd company logo
IBM Software Group
© 2005 IBM Corporation
DB2 UDB Intermediate
Day6
IBM Software Group
© 2005 IBM Corporation
Topics
 HADR
 Reorgchk and reorg
 Runstats
2
IBM Software Group
© 2005 IBM Corporation
HADR
High Availability Disaster Recovery
• The purpose oh HADR is to make sure for Business Continuity in
case of any disruptions.
• HADR is a database replication feature that provides a high
availability and disaster recovery solution.
• An HA system usually consists of a primary database and a
standby database.
• The database which is currently running is referred as Primary
database . The standby database is usually a mirror of Primary
database.
 If the primary database fails, the standby database takes over the
existing transactions and becomes the new primary database.
3
IBM Software Group
© 2005 IBM Corporation
Logshipping
 Log shipping is a method where transaction logs are automatically
copied from a primary database server to a standby database
server.
 Using log shipping, you can make the log files produced by the
primary database available to the secondary database and
continuously apply them.
 The ROLLFORWARD DATABASE command is used to apply log
files produced by the primary database on the standby database.
 Note that for log shipping to work, both systems must be running
the same version of DB2.
4
IBM Software Group
© 2005 IBM Corporation
Logshipping
5
IBM Software Group
© 2005 IBM Corporation6
On the standby database, set the LOGARCHMETH1 parameter to
the same value as that on the primary database. When a
ROLLFORWARD DATABASE command is issued on the standby
database, DB2 pulls the logs from this archival location and applies
them to the standby database.
IBM Software Group
© 2005 IBM Corporation
Overview of HADR
7
IBM Software Group
© 2005 IBM Corporation
HADR Setup
8
IBM Software Group
© 2005 IBM Corporation
HADR related dbcfg parameters
9
IBM Software Group
© 2005 IBM Corporation
HADR States
10
IBM Software Group
© 2005 IBM Corporation
HADR Synchronization Mode
 To indicate how log page shipping and writing is managed between
the primary and standby databases, a synchronization mode is
specified.
There are 3 synchronization modes for HADR
• SYNC mode
• Near Sync mode
• Async Mode
11
IBM Software Group
© 2005 IBM Corporation
SYNC Mode
In SYNC mode , Log writes are considered successfully only when:
 Log pages are written to log files on the primary database
 The primary database has received acknowledgement from the
standby database that log pages are successfully written to log
files on the standby database.
12
IBM Software Group
© 2005 IBM Corporation
SYNC
13
IBM Software Group
© 2005 IBM Corporation
NEARSYNC
14
IBM Software Group
© 2005 IBM Corporation
ASYNC
15
IBM Software Group
© 2005 IBM Corporation
HADR Commands Overview
HADR is managed by three simple commands:
• START HADR
• STOP HADR
• TAKEOVER HADR
 START HADR ON DATABASE database-alias [USER userid] [USING
password] AS PRIMARY | STANDBY [BY FORCE]
 STOP HADR ON DATABASE database-alias [USER userid] [USING
password]
 TAKEOVER HADR ON DATABASE database-alias [USER userid] [USING
password] [BY FORCE]
16
IBM Software Group
© 2005 IBM Corporation
Steps to initialize the HADR
17
IBM Software Group
© 2005 IBM Corporation
Sample of Standby DB parameters
18
 UPDATE DB CFG FOR test1 USING HADR_LOCAL_HOST
server2.torolab.ibm.com
 UPDATE DB CFG FOR test1 USING HADR_LOCAL_SVC 80000
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_HOST
server1.torolab.ibm.com
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_SVC 70000
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_INST db2inst1
 UPDATE DB CFG FOR test1 USING LOGINDEXBUILD on
IBM Software Group
© 2005 IBM Corporation
Sample of Primary db parameters
 UPDATE DB CFG FOR test1 USING HADR_LOCAL_HOST
server1.torolab.ibm.com
 UPDATE DB CFG FOR test1 USING HADR_LOCAL_SVC 70000
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_HOST
server2.torolab.ibm.com
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_SVC 80000
 UPDATE DB CFG FOR test1 USING HADR_REMOTE_INST db2inst1
 UPDATE DB CFG FOR test1 USING LOGINDEXBUILD on
START HADR ON DB test1 AS STANDBY
START HADR ON DB test1 AS PRIMARY
19
IBM Software Group
© 2005 IBM Corporation
Stopping the HADR
 STOP HADR ON DB test1
 If we want to stop HADR completely, We need to use the above
command on both server.
20
IBM Software Group
© 2005 IBM Corporation
Reorgchk
REORGCHK is a data maintenance utility that has an option to
retrieve current database statistics or update the database
statistics. It generates a report on the statistics with indicators
identifying tables and indexes that should be reorganized.
db2 reorgchk current statistics on table db2inst1.larsen
db2 reorg indexes all for table larsen
21
IBM Software Group
© 2005 IBM Corporation
Output of Reorgchk
Output of Reorgchk: (i) Table Statics (ii) Index Statics
Table statistics:
F1: 100 * OVERFLOW / CARD < 5
F2: 100 * (Effective Space Utilization of Data Pages) > 70
F3: 100 * (Required Pages / Total Pages) > 80
SCHEMA.NAME CARD OV NP FP ACTBLK TSIZE F1 F2 F3 REORG
----------------------------------------------------------------------------------------
Table: DB2INST1.LARSEN
5 0 1 1 - 165 0 - - *100 --*
----------------------------------------------------------------------------------------
22
IBM Software Group
© 2005 IBM Corporation
Index statistics:
F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80
F5: 100 * (Space used on leaf pages / Space available on non-empty
leaf pages) > MIN(50, (100 - PCTFREE))
F6: (100 - PCTFREE) * (Amount of space available in an index with
one less level / Amount of space required for all keys) < 100
F7: 100 * (Number of pseudo-deleted RIDs / Total number of RIDs) <
20
F8: 100 * (Number of pseudo-empty leaf pages / Total number of leaf
pages) < 20
23
IBM Software Group
© 2005 IBM Corporation24
IBM Software Group
© 2005 IBM Corporation
REORG
 If from the REORGCHK command , “*” is being found in Reorg
colums of Table or Index Statics. Then we will find that reorg is
required for the specific table or indexes.
 To reorganize the table or indexes, we are using REORG command.
 DB2 provides the option of performing this online or offline. By
default, offline REORG lets other users read the table.
 Online REORG (also called inplace REORG) does not support read
or write access to the table.
 Since data pages are rearranged, concurrent applications have to
wait for REORG to complete with the current pages.
25
IBM Software Group
© 2005 IBM Corporation
REORG Commands
 reorg table db2user.employee index db2user.idxemp inplace allow write
access
 reorg table db2user.employee index db2user.idxemp inplace pause
 reorg index db2user.idxemp for table db2user.employee allow write access
 reorg index db2user.idxemp for table db2user.employee cleanup only
26
IBM Software Group
© 2005 IBM Corporation
RUNSTATS Command
The REORG utility rearranges the data physically but does not
update the database statistics. Therefore, it is important to always
execute a RUNSTATS upon completion of a REORG.
 The RUNSTATS utility updates statistics about the physical
characteristics of a table and the associated indexes.
Characteristics include the number of records (cardinality), the
number of pages, the average record length, and so on.
27
IBM Software Group
© 2005 IBM Corporation
• This command collects statistics on the table db2user.employee while
letting readers and writers access the table while the statistics are being
calculated.
runstats on table db2user.employee allow write access
 This command collects statistics on the table db2user.employee, as well as
on the columns empid and empname with distribution statistics. While the
command is running, the table is only available for read-only requests.
runstats on table db2user.employee with distribution on columns ( empid,
empname ) allow read access
 The following command collects statistics on the table db2user.employee
and detailed statistics on all its indexes.
runstats on table db2user.employee and detailed indexes all
28
IBM Software Group
© 2005 IBM Corporation
Thank You
29

More Related Content

What's hot

IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
IBM
 
Solving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration DilemmaSolving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration Dilemma
Randy Goering
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizer
terraborealis
 
DB2 Accounting Reporting
DB2  Accounting ReportingDB2  Accounting Reporting
DB2 Accounting Reporting
John Campbell
 
High Availability Options for DB2 Data Centre
High Availability Options for DB2 Data CentreHigh Availability Options for DB2 Data Centre
High Availability Options for DB2 Data Centre
terraborealis
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
Ravikumar Nandigam
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
David Yahalom
 
DB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and PlanningDB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and Planning
John Campbell
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
Cuneyt Goksu
 
DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stability
dmcmichael
 
Best Practices For Optimizing DB2 Performance Final
Best Practices For Optimizing DB2 Performance FinalBest Practices For Optimizing DB2 Performance Final
Best Practices For Optimizing DB2 Performance Final
Datavail
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Cuneyt Goksu
 
DB2 utilities
DB2 utilitiesDB2 utilities
DB2 utilities
Udayakumar Suseendran
 
ALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARMALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARM
IBM
 
A First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM ChangesA First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM ChangesWillie Favero
 
Dbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyDbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easy
Franck Pachot
 
Episode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
Episode 2 DB2 pureScale Installation, Instance Management &amp; MonitoringEpisode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
Episode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
Laura Hood
 

What's hot (20)

IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
 
Solving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration DilemmaSolving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration Dilemma
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizer
 
DB2 Accounting Reporting
DB2  Accounting ReportingDB2  Accounting Reporting
DB2 Accounting Reporting
 
High Availability Options for DB2 Data Centre
High Availability Options for DB2 Data CentreHigh Availability Options for DB2 Data Centre
High Availability Options for DB2 Data Centre
 
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guruIBM DB2 LUW UDB DBA Online Training by Etraining.guru
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
DB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and PlanningDB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 for z/OS Real Storage Monitoring, Control and Planning
 
Db2 for z os trends
Db2 for z os trendsDb2 for z os trends
Db2 for z os trends
 
DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stability
 
Best Practices For Optimizing DB2 Performance Final
Best Practices For Optimizing DB2 Performance FinalBest Practices For Optimizing DB2 Performance Final
Best Practices For Optimizing DB2 Performance Final
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
DB2 utilities
DB2 utilitiesDB2 utilities
DB2 utilities
 
D02 Evolution of the HADR tool
D02 Evolution of the HADR toolD02 Evolution of the HADR tool
D02 Evolution of the HADR tool
 
ALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARMALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARM
 
Les 18 space
Les 18 spaceLes 18 space
Les 18 space
 
A First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM ChangesA First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM Changes
 
Dbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easyDbvisit replicate: logical replication made easy
Dbvisit replicate: logical replication made easy
 
Episode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
Episode 2 DB2 pureScale Installation, Instance Management &amp; MonitoringEpisode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
Episode 2 DB2 pureScale Installation, Instance Management &amp; Monitoring
 

Viewers also liked

Aprendizaje basado en proyectos.
Aprendizaje basado en proyectos.Aprendizaje basado en proyectos.
Aprendizaje basado en proyectos.
yoyimita
 
Sídrome de burnout
Sídrome de burnoutSídrome de burnout
Sídrome de burnout
Celso Frederico Lago
 
[Infographic] 4 Problems with Using Excel for Analytics
[Infographic] 4 Problems with Using Excel for Analytics[Infographic] 4 Problems with Using Excel for Analytics
[Infographic] 4 Problems with Using Excel for Analytics
3C Software
 
Carlos
CarlosCarlos
Carloscarl7e
 
El bombillo
El bombilloEl bombillo
El bombilloCascorbo
 
Empreendedorismo
EmpreendedorismoEmpreendedorismo
Empreendedorismo
Celso Frederico Lago
 
Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
 Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
benamor belgacem
 
Linha Especial de Sinalização - Unidades de Conservação
Linha Especial de Sinalização - Unidades de ConservaçãoLinha Especial de Sinalização - Unidades de Conservação
Linha Especial de Sinalização - Unidades de Conservação
Ecoview
 
Bradford
BradfordBradford
Bradford
sgmboro
 
Game Design Document - Bog
Game Design Document - BogGame Design Document - Bog
Game Design Document - Bog
Gottschall
 
Clase v bloque ii fotosintesis i parte i fase luminosa envio
Clase v bloque ii fotosintesis i parte i fase luminosa envioClase v bloque ii fotosintesis i parte i fase luminosa envio
Clase v bloque ii fotosintesis i parte i fase luminosa envio
clauciencias
 
Bloque i biologia i ag 2016
Bloque i biologia i ag 2016 Bloque i biologia i ag 2016
Bloque i biologia i ag 2016
clauciencias
 
Clase ix bloque iv división celular herencia 2015
Clase ix bloque iv división celular herencia 2015Clase ix bloque iv división celular herencia 2015
Clase ix bloque iv división celular herencia 2015
clauciencias
 
Epigenetica la-esencia-del-cambio.-como ves-pdf
Epigenetica la-esencia-del-cambio.-como ves-pdfEpigenetica la-esencia-del-cambio.-como ves-pdf
Epigenetica la-esencia-del-cambio.-como ves-pdf
clauciencias
 
Clase I bloque II composicion celular parte ii blog
Clase I bloque II composicion celular parte ii blogClase I bloque II composicion celular parte ii blog
Clase I bloque II composicion celular parte ii blog
clauciencias
 
Trabalho em equipe
Trabalho em equipeTrabalho em equipe
Trabalho em equipe
Celso Frederico Lago
 
Gestão de dividas
Gestão de dividasGestão de dividas
Gestão de dividas
Geraldo Souza
 

Viewers also liked (18)

Aprendizaje basado en proyectos.
Aprendizaje basado en proyectos.Aprendizaje basado en proyectos.
Aprendizaje basado en proyectos.
 
Sídrome de burnout
Sídrome de burnoutSídrome de burnout
Sídrome de burnout
 
[Infographic] 4 Problems with Using Excel for Analytics
[Infographic] 4 Problems with Using Excel for Analytics[Infographic] 4 Problems with Using Excel for Analytics
[Infographic] 4 Problems with Using Excel for Analytics
 
Carlos
CarlosCarlos
Carlos
 
El bombillo
El bombilloEl bombillo
El bombillo
 
Empreendedorismo
EmpreendedorismoEmpreendedorismo
Empreendedorismo
 
Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
 Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
Benamor.belgacemالكاشف في شرح نظام المرافعات الشرعية السعودي
 
Linha Especial de Sinalização - Unidades de Conservação
Linha Especial de Sinalização - Unidades de ConservaçãoLinha Especial de Sinalização - Unidades de Conservação
Linha Especial de Sinalização - Unidades de Conservação
 
Bradford
BradfordBradford
Bradford
 
Game Design Document - Bog
Game Design Document - BogGame Design Document - Bog
Game Design Document - Bog
 
Clase v bloque ii fotosintesis i parte i fase luminosa envio
Clase v bloque ii fotosintesis i parte i fase luminosa envioClase v bloque ii fotosintesis i parte i fase luminosa envio
Clase v bloque ii fotosintesis i parte i fase luminosa envio
 
Bloque i biologia i ag 2016
Bloque i biologia i ag 2016 Bloque i biologia i ag 2016
Bloque i biologia i ag 2016
 
Clase ix bloque iv división celular herencia 2015
Clase ix bloque iv división celular herencia 2015Clase ix bloque iv división celular herencia 2015
Clase ix bloque iv división celular herencia 2015
 
Epigenetica la-esencia-del-cambio.-como ves-pdf
Epigenetica la-esencia-del-cambio.-como ves-pdfEpigenetica la-esencia-del-cambio.-como ves-pdf
Epigenetica la-esencia-del-cambio.-como ves-pdf
 
Blog
BlogBlog
Blog
 
Clase I bloque II composicion celular parte ii blog
Clase I bloque II composicion celular parte ii blogClase I bloque II composicion celular parte ii blog
Clase I bloque II composicion celular parte ii blog
 
Trabalho em equipe
Trabalho em equipeTrabalho em equipe
Trabalho em equipe
 
Gestão de dividas
Gestão de dividasGestão de dividas
Gestão de dividas
 

Similar to DB2UDB_the_Basics Day 6

A DBA’s guide to using TSA
A DBA’s guide to using TSAA DBA’s guide to using TSA
A DBA’s guide to using TSA
Frederik Engelen
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMorgan Tocker
 
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
Surekha Parekh
 
IBM Analytics Accelerator Trends & Directions Namk Hrle
IBM Analytics Accelerator  Trends & Directions Namk Hrle IBM Analytics Accelerator  Trends & Directions Namk Hrle
IBM Analytics Accelerator Trends & Directions Namk Hrle
Surekha Parekh
 
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
Insight Technology, Inc.
 
Ibm db2update2019 continuous delivery-update
Ibm db2update2019   continuous delivery-updateIbm db2update2019   continuous delivery-update
Ibm db2update2019 continuous delivery-update
Gustav Lundström
 
Data Guard 19c Data Guard 19c Data Guard 19c
Data Guard 19c Data Guard 19c Data Guard 19cData Guard 19c Data Guard 19c Data Guard 19c
Data Guard 19c Data Guard 19c Data Guard 19c
ssuser0284a2
 
SAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSitesh Patel
 
Always on high availability best practices for informix
Always on high availability best practices for informixAlways on high availability best practices for informix
Always on high availability best practices for informix
IBM_Info_Management
 
Informix HA Best Practices
Informix HA Best Practices Informix HA Best Practices
Informix HA Best Practices
Scott Lashley
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Andrejs Prokopjevs
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Laura Hood
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Rodrigo Almeida
 
Developing and Deploying Reliable DB2 Applications
Developing and Deploying Reliable DB2 ApplicationsDeveloping and Deploying Reliable DB2 Applications
Developing and Deploying Reliable DB2 Applications
softbasemarketing
 
MAINVIEW for DB2.ppt
MAINVIEW for DB2.pptMAINVIEW for DB2.ppt
MAINVIEW for DB2.ppt
Sreedhar Ambatipudi
 
Advantages of migrating to db2 v11.1
Advantages of migrating to db2 v11.1Advantages of migrating to db2 v11.1
Advantages of migrating to db2 v11.1
Rajesh Pandhare
 
Automate DG Best Practices
Automate DG  Best PracticesAutomate DG  Best Practices
Automate DG Best Practices
Mohsen B
 
Ibm db2 analytics accelerator high availability and disaster recovery
Ibm db2 analytics accelerator  high availability and disaster recoveryIbm db2 analytics accelerator  high availability and disaster recovery
Ibm db2 analytics accelerator high availability and disaster recovery
bupbechanhgmail
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Cuneyt Goksu
 

Similar to DB2UDB_the_Basics Day 6 (20)

A DBA’s guide to using TSA
A DBA’s guide to using TSAA DBA’s guide to using TSA
A DBA’s guide to using TSA
 
MySQL 5.7: Core Server Changes
MySQL 5.7: Core Server ChangesMySQL 5.7: Core Server Changes
MySQL 5.7: Core Server Changes
 
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle IBM DB2 Analytics Accelerator  Trends & Directions by Namik Hrle
IBM DB2 Analytics Accelerator Trends & Directions by Namik Hrle
 
IBM Analytics Accelerator Trends & Directions Namk Hrle
IBM Analytics Accelerator  Trends & Directions Namk Hrle IBM Analytics Accelerator  Trends & Directions Namk Hrle
IBM Analytics Accelerator Trends & Directions Namk Hrle
 
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
[db tech showcase Tokyo 2018] #dbts2018 #B17 『オラクル パフォーマンス チューニング - 神話、伝説と解決策』
 
Ibm db2update2019 continuous delivery-update
Ibm db2update2019   continuous delivery-updateIbm db2update2019   continuous delivery-update
Ibm db2update2019 continuous delivery-update
 
Data Guard 19c Data Guard 19c Data Guard 19c
Data Guard 19c Data Guard 19c Data Guard 19cData Guard 19c Data Guard 19c Data Guard 19c
Data Guard 19c Data Guard 19c Data Guard 19c
 
Hadr db2express
Hadr db2expressHadr db2express
Hadr db2express
 
SAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business ObjectsSAP SQL Anywhere High Availability Tutorial for Business Objects
SAP SQL Anywhere High Availability Tutorial for Business Objects
 
Always on high availability best practices for informix
Always on high availability best practices for informixAlways on high availability best practices for informix
Always on high availability best practices for informix
 
Informix HA Best Practices
Informix HA Best Practices Informix HA Best Practices
Informix HA Best Practices
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2
 
Developing and Deploying Reliable DB2 Applications
Developing and Deploying Reliable DB2 ApplicationsDeveloping and Deploying Reliable DB2 Applications
Developing and Deploying Reliable DB2 Applications
 
MAINVIEW for DB2.ppt
MAINVIEW for DB2.pptMAINVIEW for DB2.ppt
MAINVIEW for DB2.ppt
 
Advantages of migrating to db2 v11.1
Advantages of migrating to db2 v11.1Advantages of migrating to db2 v11.1
Advantages of migrating to db2 v11.1
 
Automate DG Best Practices
Automate DG  Best PracticesAutomate DG  Best Practices
Automate DG Best Practices
 
Ibm db2 analytics accelerator high availability and disaster recovery
Ibm db2 analytics accelerator  high availability and disaster recoveryIbm db2 analytics accelerator  high availability and disaster recovery
Ibm db2 analytics accelerator high availability and disaster recovery
 
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
Understanding IBM Tivoli OMEGAMON for DB2 Batch Reporting, Customization and ...
 

DB2UDB_the_Basics Day 6

  • 1. IBM Software Group © 2005 IBM Corporation DB2 UDB Intermediate Day6
  • 2. IBM Software Group © 2005 IBM Corporation Topics  HADR  Reorgchk and reorg  Runstats 2
  • 3. IBM Software Group © 2005 IBM Corporation HADR High Availability Disaster Recovery • The purpose oh HADR is to make sure for Business Continuity in case of any disruptions. • HADR is a database replication feature that provides a high availability and disaster recovery solution. • An HA system usually consists of a primary database and a standby database. • The database which is currently running is referred as Primary database . The standby database is usually a mirror of Primary database.  If the primary database fails, the standby database takes over the existing transactions and becomes the new primary database. 3
  • 4. IBM Software Group © 2005 IBM Corporation Logshipping  Log shipping is a method where transaction logs are automatically copied from a primary database server to a standby database server.  Using log shipping, you can make the log files produced by the primary database available to the secondary database and continuously apply them.  The ROLLFORWARD DATABASE command is used to apply log files produced by the primary database on the standby database.  Note that for log shipping to work, both systems must be running the same version of DB2. 4
  • 5. IBM Software Group © 2005 IBM Corporation Logshipping 5
  • 6. IBM Software Group © 2005 IBM Corporation6 On the standby database, set the LOGARCHMETH1 parameter to the same value as that on the primary database. When a ROLLFORWARD DATABASE command is issued on the standby database, DB2 pulls the logs from this archival location and applies them to the standby database.
  • 7. IBM Software Group © 2005 IBM Corporation Overview of HADR 7
  • 8. IBM Software Group © 2005 IBM Corporation HADR Setup 8
  • 9. IBM Software Group © 2005 IBM Corporation HADR related dbcfg parameters 9
  • 10. IBM Software Group © 2005 IBM Corporation HADR States 10
  • 11. IBM Software Group © 2005 IBM Corporation HADR Synchronization Mode  To indicate how log page shipping and writing is managed between the primary and standby databases, a synchronization mode is specified. There are 3 synchronization modes for HADR • SYNC mode • Near Sync mode • Async Mode 11
  • 12. IBM Software Group © 2005 IBM Corporation SYNC Mode In SYNC mode , Log writes are considered successfully only when:  Log pages are written to log files on the primary database  The primary database has received acknowledgement from the standby database that log pages are successfully written to log files on the standby database. 12
  • 13. IBM Software Group © 2005 IBM Corporation SYNC 13
  • 14. IBM Software Group © 2005 IBM Corporation NEARSYNC 14
  • 15. IBM Software Group © 2005 IBM Corporation ASYNC 15
  • 16. IBM Software Group © 2005 IBM Corporation HADR Commands Overview HADR is managed by three simple commands: • START HADR • STOP HADR • TAKEOVER HADR  START HADR ON DATABASE database-alias [USER userid] [USING password] AS PRIMARY | STANDBY [BY FORCE]  STOP HADR ON DATABASE database-alias [USER userid] [USING password]  TAKEOVER HADR ON DATABASE database-alias [USER userid] [USING password] [BY FORCE] 16
  • 17. IBM Software Group © 2005 IBM Corporation Steps to initialize the HADR 17
  • 18. IBM Software Group © 2005 IBM Corporation Sample of Standby DB parameters 18  UPDATE DB CFG FOR test1 USING HADR_LOCAL_HOST server2.torolab.ibm.com  UPDATE DB CFG FOR test1 USING HADR_LOCAL_SVC 80000  UPDATE DB CFG FOR test1 USING HADR_REMOTE_HOST server1.torolab.ibm.com  UPDATE DB CFG FOR test1 USING HADR_REMOTE_SVC 70000  UPDATE DB CFG FOR test1 USING HADR_REMOTE_INST db2inst1  UPDATE DB CFG FOR test1 USING LOGINDEXBUILD on
  • 19. IBM Software Group © 2005 IBM Corporation Sample of Primary db parameters  UPDATE DB CFG FOR test1 USING HADR_LOCAL_HOST server1.torolab.ibm.com  UPDATE DB CFG FOR test1 USING HADR_LOCAL_SVC 70000  UPDATE DB CFG FOR test1 USING HADR_REMOTE_HOST server2.torolab.ibm.com  UPDATE DB CFG FOR test1 USING HADR_REMOTE_SVC 80000  UPDATE DB CFG FOR test1 USING HADR_REMOTE_INST db2inst1  UPDATE DB CFG FOR test1 USING LOGINDEXBUILD on START HADR ON DB test1 AS STANDBY START HADR ON DB test1 AS PRIMARY 19
  • 20. IBM Software Group © 2005 IBM Corporation Stopping the HADR  STOP HADR ON DB test1  If we want to stop HADR completely, We need to use the above command on both server. 20
  • 21. IBM Software Group © 2005 IBM Corporation Reorgchk REORGCHK is a data maintenance utility that has an option to retrieve current database statistics or update the database statistics. It generates a report on the statistics with indicators identifying tables and indexes that should be reorganized. db2 reorgchk current statistics on table db2inst1.larsen db2 reorg indexes all for table larsen 21
  • 22. IBM Software Group © 2005 IBM Corporation Output of Reorgchk Output of Reorgchk: (i) Table Statics (ii) Index Statics Table statistics: F1: 100 * OVERFLOW / CARD < 5 F2: 100 * (Effective Space Utilization of Data Pages) > 70 F3: 100 * (Required Pages / Total Pages) > 80 SCHEMA.NAME CARD OV NP FP ACTBLK TSIZE F1 F2 F3 REORG ---------------------------------------------------------------------------------------- Table: DB2INST1.LARSEN 5 0 1 1 - 165 0 - - *100 --* ---------------------------------------------------------------------------------------- 22
  • 23. IBM Software Group © 2005 IBM Corporation Index statistics: F4: CLUSTERRATIO or normalized CLUSTERFACTOR > 80 F5: 100 * (Space used on leaf pages / Space available on non-empty leaf pages) > MIN(50, (100 - PCTFREE)) F6: (100 - PCTFREE) * (Amount of space available in an index with one less level / Amount of space required for all keys) < 100 F7: 100 * (Number of pseudo-deleted RIDs / Total number of RIDs) < 20 F8: 100 * (Number of pseudo-empty leaf pages / Total number of leaf pages) < 20 23
  • 24. IBM Software Group © 2005 IBM Corporation24
  • 25. IBM Software Group © 2005 IBM Corporation REORG  If from the REORGCHK command , “*” is being found in Reorg colums of Table or Index Statics. Then we will find that reorg is required for the specific table or indexes.  To reorganize the table or indexes, we are using REORG command.  DB2 provides the option of performing this online or offline. By default, offline REORG lets other users read the table.  Online REORG (also called inplace REORG) does not support read or write access to the table.  Since data pages are rearranged, concurrent applications have to wait for REORG to complete with the current pages. 25
  • 26. IBM Software Group © 2005 IBM Corporation REORG Commands  reorg table db2user.employee index db2user.idxemp inplace allow write access  reorg table db2user.employee index db2user.idxemp inplace pause  reorg index db2user.idxemp for table db2user.employee allow write access  reorg index db2user.idxemp for table db2user.employee cleanup only 26
  • 27. IBM Software Group © 2005 IBM Corporation RUNSTATS Command The REORG utility rearranges the data physically but does not update the database statistics. Therefore, it is important to always execute a RUNSTATS upon completion of a REORG.  The RUNSTATS utility updates statistics about the physical characteristics of a table and the associated indexes. Characteristics include the number of records (cardinality), the number of pages, the average record length, and so on. 27
  • 28. IBM Software Group © 2005 IBM Corporation • This command collects statistics on the table db2user.employee while letting readers and writers access the table while the statistics are being calculated. runstats on table db2user.employee allow write access  This command collects statistics on the table db2user.employee, as well as on the columns empid and empname with distribution statistics. While the command is running, the table is only available for read-only requests. runstats on table db2user.employee with distribution on columns ( empid, empname ) allow read access  The following command collects statistics on the table db2user.employee and detailed statistics on all its indexes. runstats on table db2user.employee and detailed indexes all 28
  • 29. IBM Software Group © 2005 IBM Corporation Thank You 29

Editor's Notes

  1. This presentation will discuss DB2 UDB Fundamentals.