Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Bruno Bompar
Senior Manager Customer Support
Abstract
Agenda
Why backup and recovery?
Disaster scenarios
Ingres features
Housekeeping
Customisation
Issues to Consider
Tips and cautions
Scenarios to Consider
System Crash
Database Corruption
Lost Table
Accidental Transaction
System Crash
Automated Recovery
After a crash Ingres will
Scan the transaction log file
Rollback uncompleted transaction
Apply completed transactions
Database Corruption
Databases can be recovered
Only if valid Ingres backup is available!
ckpdb command to backup
rollforwarddb to recover
Backup Mechanisms
OS backup
invalid unless done with Ingres shut down cleanly
important for backing up Ingres installation, journals,
checkpoints, dumps
useless for backing up databases unless you can
guarantee a clean shutdown
unloaddb
an archiving or porting tool, not a backup tool
no way to ensure a consistent snapshot without locking out
Backup Mechanisms
Backup Mechanisms
Other DBMS's:
a checkpoint means a buffer flush
a backup is just called a backup
10
Database Checkpoints
Backup the whole database
Online or Offline
Enable / Disable journaling
Can be performed in parallel
Written to
Tape
Disk
Online
Users carry on working
No DDL statements
Slower than offline
Can cause transaction log file to fill
12
Online Checkpointing
13
Online Checkpointing
14
Online Checkpointing
15
Online Checkpointing
16
Checkpointing
17
Online Checkpointing
file-copying
an updated database config file
phase
18
Checkpointing
19
Journals
ckpdb +j
20
ckpdb dbname
Offline checkpoint enabling journaling
ckpdb -j dbname
21
22
Recovery
23
Recovery
24
Recovery
25
Recovery
26
Recovery
location
config file is renamed to aaaaaaaa.rfc
27
Stay calm!
you have practiced recovery, right?
haste makes mistakes
turn off the mobile phone, pager, etc
the database will be ready when it's ready
aaaaaaaa.cnf
28
Database Recovery
Point in time recovery
Last checkpoint only
Last checkpoint + 10 hours work
5 checkpoints ago
29
30
31
32
Recovery Scenarios
rollforwarddb
up-to-the-minute recovery should be possible
33
Recovery Scenarios
34
Recovery Scenarios
35
Recovery Scenarios
write journals
ckpdb +j to restart journaling
36
Recovery Scenarios
37
Accidental Transaction
AuditDB
Filter against
Table
Users
Time
38
Accidental Transaction
Ingres Journal Analyzer
Auditdb with Knobs on
Connect to remote servers
Force Log Flush
Point and Click
39
Accidental Transaction
40
Accidental Transaction
41
42
Recovery Scenarios
Disaster
Use OS backups to restore Ingres system
directories, all data, work, checkpoint, dump, journal
directories
rollforwarddb iidbdb
you have been checkpointing iidbdb, right?
restores users, locations, database privileges, etc
rollforwarddb databases
43
Recovery Scenarios
Rollforwarddb failure
restore the config or dump info you saved before
attempting rollforwarddb
rename aaaaaaaa.rfc back to aaaaaaaa.cnf if it exists
cure any other rollforwarddb complaints
try again
44
Lost Table
Table can be recovered
From table checkpoint only
Enforce logical consistency
Journaling must be enabled
45
46
47
Housekeeping Ingres
Infodb
Checkpoints
Dumps
Journals
48
Infodb / aaaaaaaa.cnf
Shows meta-data about database
Locations
Checkpoint sequence
Valid / Invalid
Dump / Journal sequence
Counters
Last table id
Last valid checkpoint
49
Infodb / aaaaaaaa.cnf
Info stored in aaaaaaaa.cnf
Three copies
50
II_DUMP
Checkpoint files
Stored in 1 location
II_CHECKPOINT
Database defined checkpoint area
51
Dump files
Changes during ONLINE checkpoint
Required for recovery
Single location
II_DUMP
Database defined dump area
52
Journal Files
Record of changes
Table configuration
53
ONLINE Checkpoint
All above
Dump files
54
Cleaning up
ckpdb d
All but the last checkpoint
Dump, journal files deleted as well
alterdb delete_oldest_ckp
Oldest checkpoint only
Maintain set of checkpoints
Dump, journal files deleted as well
55
Customisation
cktmpl.def
Defines actions
ingsetenv only
II_CKTMPL_FILE
$II_SYSTEM/ingres/files
56
add compression/decompression
use a different utility (eg star instead of tar)
wild and crazy stuff
Issues To Consider
Files
Ingres supports large files
OS archiver utility may not
POSIX standard
tar
cpio
57
58
moment"
RAID 5, mirroring, whatever
you aren't protected against software failures
you aren't protected against human failures
you aren't protected against disasters
you may not be protected against multiple hardware
failures
you are putting all your eggs in one basket
59
60
61
available
practice on production at least occasionally
clean Ingres shutdown
OS backup everything in sight
practice
62
recovery
63
64
More Information
Ingres DBA guide
Chapter 15 (2.6)
65
Summary
Backups deserve more than lip service
Ensuring 100% recoverable backups takes time,
effort, and money
Ingres checkpoint and rollforward capabilities are
simple yet powerful and customisable
With proper practice and procedures, a recovery is
nothing to be afraid of
66
67