Академический Документы
Профессиональный Документы
Культура Документы
Barrier
• Basic Components
• Terminology Differences
• Storage Management
• Object Comparisons
• Administrative Differences
1
Components of DB2
z/OS LUW
• Subsystem
• Instance
• VCAT/Volume
• Container
• Stogroup
• N/A
• Database
• Tablespace • Database
• Creator (Owner/ Schema) • Tablespace
• Table • Schema
• Alias • Table
• Synonym • Alias
• Index • Index
• View • View
• Package • Package
• Plans
2
Installation
z/OS LUW
3
System Catalog
z/OS LUW
• SYSIBM.xxxx
• SYSIBM.xxxx
– optimizer related fields are • SYSCAT
updateable – Read-only views defined for
catalog base tables
• SYSSTAT
– Updateable set of views
– Primarily used for access path
manipulation
4
Accessing DB2
z/OS LUW
• DB2I • Control Center
– DB2 tool set (3270 based) – Basic administration
• SPUFI – Command center
• DCLGEN – Command line processor
• Bind/Rebind – Command window
• Command Processor – Script center
• Utilities – Visual Explain
• Defaults
• Health Center
• Control Center – Storage
– Memory
• Visual Explain
– Maintenance
• Data Studio • Data Studio
– Stored procedure management
– UDF manager
– SQL Builder
5
Common Terms, Different Meanings
z/OS LUW
• SMS • SMS
– System Managed Storage
– System Managed Space
• Software for managing disk
allocation on System z • Type of space management for
TS
• Extent
– Physical extension of a dataset
based on a secondary • Extent
allocation. – A block of pages within a
tablespace
– Similar to SEGSIZE in z/OS
6
Different Terms, Similar Meanings
z/OS LUW
7
Bufferpools
z/OS LUW
8
Databases
z/OS LUW
9
Subsystem vs. Instance
z/OS LUW
D Instance_1
D
B
DB2PROD S Catalog
Catalog N
M DBCONFIG
C PRODDB1
PRODDB1 Z Log
O BPs
P
Log N
A Catalog DBCONFIG
F PRODDB2
PRODDB2 R
I
M Log
BP’s G BPs
D
D
DB2TEST S
B Instance_2
Catalog M
N Catalog
C DBCONFIG
TESTDB1 Z TESTDB1
O
Log P
N
Log
A BPs
TESTDB2 F
R Catalog DBCONFIG
I TESTDB2
BP’s M
G
Log
BPs
10
Storage Management
z/OS LUW
• Volume • Container
– Device – Device
• Storage Group – Directory
– Group of volumes – File
11
Volumes
Terminology
– DASD – Direct Access Storage Device
• logical disk drives
– VolSer – Volume serial. This is a name identifying the disk pack
i.e. DB2001.
– Storage Group
• Defined object
– A logical grouping of volumes or SMS “*”
– Can be used by more than one TS or IS
– N/A on LUW.
12
Containers
13
Table spaces: z/OS
14
Table spaces: z/OS
VCAT.DSNDBC.DBNAME.TSNAME.I0001.A001
VCAT.DSNDBD.DBNAME.TSNAME.I0001.A001
Where:
VCAT – Typically the subsystem name
DBNAME – Database name
TSNAME – Tablespace name
I0001 – Instance number changes with cloned tables
A001 – Partition or dataset number (A001, A002, etc.)
15
Tablespaces: DB2 LUW
16
Tablespaces: DB2 LUW
SMS DMS
• System Managed Add containers to TS X
– No finite storage specified
• Operating System’s file manager Separate indexes from data X
allocates space as needed
• Good for small tables Space allocated as needed X
• Cannot Add/delete containers after
creation
High performance in heavy OLTP X
• Database Managed
– Space is pre-allocated High performance in decision support X
– Better suited for large tables
– LOBs must be DMS
Ease of administration for small tables X
– ALTER to add containers
Flexibility of administration X
17
Partitioning
z/OS LUW
18
Tables
z/OS
• 1 to many tables defined in non-partitioned table spaces
– Typically 1 to 1 however for performance, easier management
– Tables and Indexes are independent of each other
• Except for PK which requires unique IX definition
LUW
• 1 to many tables can be defined within a tablespace
– Indexspace directly tied to table definition and can exist in same tablespace
19
Indexes
z/OS LUW
• Unique • Unique
• Non-unique • Non-unique
• Clustering • Clustering
• Partitioning • Multi-Dimensional Clustering
20
Indexes: z/OS
21
Indexes: DB2 LUW
22
Administration
23
Optimizer
z/OS LUW
24
Optimizer Class
• DB2 Optimizer Class
– Values are between 0 and 9, default is 5
• Determines the intensity used by the DB2 SQL Compiler when rewriting SQL
• Dynamic SQL can’t spend time optimizing, use lower class
• Static SQL optimizes once, use a higher class
• “dft_queryopt” database setting
• SET CURRENT QUEREY OPTIMIZATION n
Level Recommendation
0 Minimal amount of optimization. Only recommended for very simple SQL accessing well indexed tables. Only
nested loop joins and IX scans enabled.
26
Parallelism: z/OS
z/OS SYSPLEX
CPU1 CPU2
Workfile Workfile
DB Coupling DB
Facility
BSDS BSDS
DASD
Parallelism: DB2 LUW
DB DB DB DB
Part 0 Part 1 Part 2 Part 3
z/OS LUW
• I/O • I/O
– Partitioned TS – Multi-container TS
• CPU • Query
– Intra-partition (SMP)
– Most common
• Parallelism within single
– Query processed in multiple partition
tasks in parallel across – Inter-partition (DPF/MPP)
machines or LPARs • Parallelism across
• SYSPLEX multiple partitions
29
Performance Monitoring
z/OS LUW
• Instrumentation Facility • Snapshot Monitor
Component (IFC) – Show status of database for an
– Statistics instant in time
• Global statistical data
– Accounting • Event Monitor
• Detail info for specific application – Historical status over time
– Audit
– 3 types
• Table access audits
• Requires AUDIT keyword on table • Activity
definition • Threshold Violations
– Performance
• Statistics
• Most detailed $$$
• Only use for short periods
– Monitor
• Makes trace data available for
monitoring applications
30
Automated Monitoring - LUW
31
Backup and Recovery
32
Backups
z/OS LUW
• BACKUP SYSTEM • Database
• Tablespace • Tablespace
• Index • Components
– Backup Image
• Components – Incremental Copy
– Full Image copy
– Backup History File
– Incremental Image Copy
– Active Logs
– Copy to Copy
– Archive Logs
– Active/Archive Logs
– BSDS
– SYSLGRNX
33
Recovery Information
z/OS LUW
SYSCOPY Recovery History File
• Updated
• Updated – Backup of full DB or TS
– Full IC – Restore of full DB or TS
– Incremental IC – Load of a table
– Quiesce – Quiesce TS
– LOAD • Contains
– REBUILD IX – Part of DB which was copied
– RECOVER TOCOPY – When DB was copied
– RECOVER TOLOGPOINT – Location of the copy
– Time of last restore
– Reorg
• Contains
– Full/Incr copy
– Log RBA
– Copy to Copy
34
Logging
z/OS LUW
• Logs apply to entire subsystem • Defined at database
– Circular
– Active
• No roll-forward recovery
– Archive
– Archival
• Active logs are automatically • Fully recoverable
archived when full • Similar to z/OS
• 3 log files
• Dual Logging – Active
– Online Archived
– Offline Archived
• On Demand Archiving
– Close and archive an active log at
any time
• Dual Logging
35
Circular Logging: DB2 LUW
• Non-recoverable databases
• Log files are reused 1
• Uses active logs only S
– Secondary used for overflow E
“n” Primary 2
• Roll-forward recovery not 1 C
O
possible N
36
Archival Logging
Online Archival -
Contains information for
• Log files not reused committed and externalized
13
14
Offline Archival 15
Files moved from active
Log subdirectory. Active –
Usually offline media. Contains information
For non-committed or
Non-externalized 16
Transactions.
37
Types of Recovery
z/OS LUW
• RESTORE SYSTEM • Crash
– When BACKUP SYSTEM used – Uses logs to recover from
power interrupts or application
• Crash ABENDS
– DB2 restart
• Roll-Forward
• Roll-Forward – Image copy plus log apply
– IC plus log apply – LOCAL TIME
– LOGONLY • More flexible than TORBA
• Point in Time • Version
– IC only (TOCOPY) – Image copy (TOCOPY)
– TOLASTCOPY
– TOLASTFULLCOPY
– TOLOGPOINT
– TORBA 38
Common Utilities
z/OS LUW
• DSNTIAUL/Fast Unload • EXPORT
• LOAD • LOAD/IMPORT
• REORG • REORG
• RUNSTATS • RUNSTATS
• QUIESCE
• QUIESCE
• CHECK DATA
• Set Integrity
39
Unloading Data
z/OS LUW
• DSNTIAUL • EXPORT
– IBM sample program – Accessed via Control
Center or CLP
• REORG UNLOAD – Rename columns
PAUSE – Multiple output formats
• UNLOAD Utility
– Table
– Image Copy
40
Loading Data
z/OS LUW
• Load Utility • Load
– Locks single table in TS
– Resume/Replace
– Insert/Replace
– Log YES/NO – RUNSTATS
– Runstats/Copy – Good for large amounts of data
– Enforce Constraints – READ ACCESS for rows not being
loaded Load directly from a SQL
• ONLINE query
– SHRLEVEL CHANGE
• ONLINE
– Allow Read Access
• Import
– Insert process
• Update
• Replace
– Good for small amounts of data 41
Reorganizing Data
z/OS LUW
• Tablespace • Table
– Log Yes/No • Index
– Unload Pause
• REORGCHK
– Shrlevel
– Determines when Reorg is
• Index required
• Automated Reorganization
– Automated REORGCHK
42
Statistics
z/OS LUW
• RUNSTATS • RUNSTATS
– Tablespace – Table
– Index • Statistics Profile
• Real Time Statistics – Customized parameters for
individual tables
– Stored Procedure
• DNACCOX • Automated statistics
– V9 collection
• DSNACCOR – DB2 schedules RUNSTATS via
– V8 maintenance policy
– Monitor for
• REORG
• RUNSTATS
• Image Copy
43
Quiesce
z/OS LUW
• Establishes point of • Instance or Database
consistency in log level
– Flushes all changed pages – Used for administering
to disk maintenance
– Used to avoid RI violations – All objects in “Quiesced
Mode”
– Only authorized users can
access objects
– Similar to ACCESS(MAINT)
in z/OS
• UNQUIESCE
– Removes Quiesce Mode
44
Checking Referential Integrity
z/OS LUW
• Check Data • Set Integrity
– Removes “Check Pending” flag – Removes “Set Integrity Pending”
• Exception Tables state
– Standalone • Invocation
– Load Utility “Enforce Constraints” – Embedded in Application
– Dynamic SQL
45
Summary
46
Thank you