810 likes | 819 Views
Archiving & Restoring. John F. Miller III. TOC. Term & History Disaster Recovery Planning Backup & Restore Procedures Architecture (XPS differences) The grab bag. Terminology. Serial Backup Archives the entire system at a single point in time using only one data stream Parallel Backup
E N D
Archiving & Restoring John F. Miller III
TOC • Term & History • Disaster Recovery Planning • Backup & Restore Procedures • Architecture (XPS differences) • The grab bag
Terminology • Serial Backup • Archives the entire system at a single point in time using only one data stream • Parallel Backup • Archives the requested dbspace one at a time to N data streams • External Backup • Allows a third party application to backup the database server while maintain logical consistency
Terminology • Cold Restore • Restoring the server when the database engine is offline • Warm Restore • Restores of dbspaces which occur while the database engine is online • Mixed Restore • A cold restore of set dbspaces followed by a warm restore of other dbspaces
Terminology • Imported Restore • Transferring an archive taken on one computer and restoring it on a second computer • Point-in-Time Restore • Restoring the entire system to a single point it time • Restartable Restore • Allows the DBA to pickup the restore from the failure point
Early Backup and Restore History • 1.X Turbo • Only Quiescent mode archives • 4.X named OnLine for advanced archiving technology • 5.X same core technology • limitation revealed (scalability & extensibility)
DSA Backup and Restore History • 6.0 new client/server model developed • 7.1 & 7.20 same core technology • 7.21 new client (onbar) • 7.3 server API re-write • 9.2 onbar usability features added
Pre-DSA Archive Bad Grammar Archive • Archive Checkpoint (get timestamp) • Free extents recorded • Reserve pages saved • Chunks backed-up by ascending chunk number • Pages modified during archive are placed in physical log • tbtape routinely scans physical log for unarchived before-images • Pages placed directly to tape
Pre-DSA Restore • Begins with OnLine off-line • Reads configuration file, matches params to config params of archive tape • Zero out logs (physical & logical) • Validate size of all chunks • Read tape, copying pages based on their address directly to disk
DSA Archive ArchitectureMajor Differences • True client-server architecture • Archived pages logically grouped by dbspaces • Granularity of creations • Granularity of restores • Warm restores • Physical log pages kept in temp tables
Server Algorithm ChangesGood Grammar Archive • List is made of all pages that should be archived • Cost vs Benefit • Before images are queued by the modifier • A new thread is responsible for the before image handling
Disaster Recovery • Goals • Planning
What is a Successful Recovery? • “Successful” recovery is defined by your business needs
Goals For Recovery • Determine acceptable recovery time • How long can your business function without the data? • How long can your production system be down during a restore?
Determine Acceptable Data Loss Type Time Quantity Distribution
Recovery Strategy Plan Recovery Goals Tune the Strategy Select Tools Analyze/Test the Strategy Implement The Strategy
Data Layout • Poor data layout can hurt BAR performance • Isolating the different types of data can facility restore priority • Example • 8 dbspaces each with 2 chunk, but one dbspace has 68 chunk
Data Layout Examples • Important frequently modified in its own dbspaces • important data such as orders should dbspace_orders • dbspace containing zipcodes and other lightly modified data can be backed up with less frequency
Right, Fast or Cheap? Choose Two!
Backup Utilities ontape ON-Bar External Backup/Restore Fault Tolerance Mechanisms Mirroring High Availability Data Replication (HDR) Enterprise Data Replication (DR) Select Tools Load/Unload High Performance Loader (HPL) dbexport/dbimport dbschema SQL load/unload onload/onunload dbload Customer ESQL programs
Ontape Backup Features • Backup at the Server level • Support for incremental backups • Manual or continuous logical log backup • Restore entire system or single dbspace • Backup is self describing
On-Bar Backup Features • Parallel backup and restore • System and dbspace level backup and restore • Support for incremental backups • Manual or automatic backup of logical logs • Instance point-in time recovery • Open interface for communication with storage managers (XBSA)
External Backup Features • EBR allows administrators to make a consistent copy of their dbspaces using external tools • Used with many 3rd party backup products • Allows for both cold and warm restores
EBR - Examples • Planned uses: • File system snapshots • Breaking of mirrors • Third party “raw” backup • Basic Steps • Block coserver(s) at checkpoint • Backup dbspaces using third party tools • Unblock coserver(s)
Restoring • Logical Logs required • Restore looks hung, nothings happening • Handling unanticipated problems
Logical Logs Required for a Restore • Cold Parallel Restore • Starting log is the log that contains the begin of the oldest active transaction when the first archive checkpoint occurred • At least the logical log that contains the last archive checkpoint • Cold Whole System (Non-Parallel) • No logical logs required • Logs included with archive
Logical Logs Required for a Restore • Warm Restore • Starting log is the log that contains the begin of the oldest active transaction when the first archive checkpoint • All logs to the current point in time • If you are using DR then you must include the replay point
Example of Logical Logs Required for a Restore Log 10 Log 11 Log 12 Log 13 B B B Archive Checkpoint B Oldest Begin Work Logs Required Cold restore all Logs 10-12 Optional 13 Warm restore Logs 11-> No Optional Logs
Restartable vs. Suspended Restored • Restartable Restore • When the database engine prematurely shuts down the engine may be restarted in recovery mode • Suspended Restore • When the archive client receives an error which is restartable and the database engine does not shutdown
Restartable Restore • Turned OFF by default • What can restart when? • Whole system • Partial Restore • Logical Recovery from a cold restore • Only available with On-BAR • onbar -RESTART
Architecture • Overview • Archive Clients • Moving Data • IDS • XPS • Server Threads • XPS Architecture
What Pages are Sent to the Archive • If page’s timestamp is older than maxstamp and newer than minstamp, it is put to tape • If a page is greater than current stamp, but older than minstamp, it is put to tape, and it’s timestamp is updated to maxstamp-1 • Pages newer than max, but older than current are considered to be modified after the archive started, and are ignored.
Understanding Timestamps 0 Max-Stamp Not Archived Current Stamp
OnLine Wheel-O-Death 0 Min-Stamp Max-Stamp The timestamp 50% away from Max-Stamp ie Max-Stamp - 2GB The timestamp at the start of the archive Not Archived All Pages in the red region have their timestamp updated along with being archived Current Stamp The timestamp at the current point in time
Archive Clients EBR SMV Onbar Common Archive Code XBSA XBSA Ontape
DSA Client Server Model SQLI/ASF Network Connection Archive Client Archive BE Streams Local Connection
Moving Data between Client and Server ONINIT SQLI Requests Archive Data Buffer SQLI Returns Shared Memory Address Archive Client Shared Memory
Moving Data between Client/Server • The size of the buffers used to transmit data • ontape - control by onconfig’s TAPEBLOCK • onBar - BAR_XFER_BUFSIZE - maximum size is one online page smaller than 64kb • The number of buffers: • ontape • onbar - BAR_XPORT_COUNT min 3 max 99 • Monitoring the data transfer • onstat -g stq
What Data is Shipped to the Archive Client • Server sends raw online pages just like they exist on disk
Example of onstat -g stq Stream Queue: (session 11 cnt 10) 0:ad91400 1:ada1400 2:adb1400 3:adc1400 4:add1400 5:ade1400 6:adf1400 7:ae01400 8:ae11400 9:ae21400 Full Queue: (cnt 0 waiters 0) 0:0 1:ada1400 2:adb1400 3:adc1400 4:add1400 5:ade1400 6:adf1400 7:ae01400 8:ae11400 Empty Queue: (cnt 0 waiters 1) Stream Queue: (session 10 cnt 10) 0:ac8d400 1:ac9d400 2:acad400 3:acbd400 4:accd400 5:acdd400 6:aced400 7:acfd400 8:ad0d400 9:ad1d400 Full Queue: (cnt 9 waiters 0) 0:ac9d400 1:acad400 2:0 3:accd400 4:acdd400 5:aced400 6:acfd400 7:ad0d400 8:ad1d400 Empty Queue: (cnt 0 waiters 1)
Server Threads • ontape • Scanner • Before Image Processor
Ontape Thread • Always called ontape regardless of archive client • Responsible for all communication to archive client
Scanner Thread (arc_backup1) • The “dummy” thread, geared for I/O performance and not thinking • Handed a list of pages to backup • Scans data from disk into shared memory buffers • Makes NO decisions about the data • Ensures the page address is correct
Before Image Processor Thread (arc_backup2) • Monitors the before image queues • Determines if the before image needs to be saved or discarded • Drains the before image memory queue, by storing the page images into temp tables • Creates multiple temp tables if required
XPS Difference & Architecture Overview • Basic XPS Architecture • Client Sub-Systems • Server Sub-Systems • Differences • sysutils • configuration
Basic XPS Architecture Storage Manager 1 Coserver 4 Storage Manager 2 Coserver 3 OnLine XPS Coserver 2 Coserver 1 onbar
Client Sub-Systems Storage Manager 1 onbar_w Coserver 4 Coserver 3 OnLine XPS Coserver 2 Coserver 1 onbar onbar_d
ASF/local streams Send/Receive commands and data buffers Backup Scheduler (BUS) distributes tasks to workers XBAR communicates between coservers RSAM only sees a single coserver manages all I/O to disk (dbspaces/chunks) Server Sub-Systems New New
XBAR • Interfaces with both BUS and RSAM • Manages distributed execution of backup and restores • transfers data from the object’s coserver (coserver where the dbspace/chunk exists) to onbar_w’s coserver (output coserver) • Uses XMF between coservers • Uses local stream between onbar_w and output coserver