db2的日志模式和备份归档、恢复解析
DB2的日志分为两种模式,日志循环与归档日志,也就是非归档和归档模式。下面就具体介绍一下这两种方式以及和备份归档设置的关系。一、日志循环这是默认方式,也
DB2的日志分为两种模式,日志循环与归档日志,也就是非归档和归档模式。下面就具体介绍一下这两种方式以及和备份归档设置的关系。
一、日志循环
这是默认方式,也就是非归档模式,这种模式只支持(backup offline)脱机备份,在备份过程中需要DB2停止服务。
并适当调整日志文件大小和主辅日志的文件个数。
最后就是要注意这两个参数的设置
Options for logarchmeth1 (LOGARCHOPT1) =
Second log archive method (LOGARCHMETH2) =
有以下几种情况:
1、Logarchmeth1设置为LOGRETAIN,Logarchmeth2设置为OFF
这时归档日志位置就是DB2数据库日志的位置,需要人工干预归档日志的转移和空间维护工作
2、Logarchmeth1设置为USEREXIT,Logarchmeth2设置为OFF
这时归档日志的管理交由USEREXIT来处理,通过设置编译USEREXIT可以实现相对复杂一些的归档管理方式
3、Logarchmeth1设置为指定目录
归档日志的工作将会自动进行,需要归档日志将会被自动归档到
4、Logarchmeth1设置为
归档日志的工作将会自动进行,需要归档日志将会被自动归档到
注意:设置Logarchmeth1和Logarchmeth2后,数据库会进入backup pending状态,必须进行一次脱机备份,数据才会进入recovery模式并且正常工作。
三、备份与恢复
1、简单的冷备与恢复
$ db2 backup db [dbname] to 路径
$ db2 restore db [dbname] from 路径 taken at 时间戳
2、在线热备与恢复
$ db2 backup db dbname online to 路径 include logs
$ db2 restore db dbname from 路径 taken at 时间戳
$ db2 "rollforward db dbname to 2013-02-31-20.00.00.000000 using local time and complete overflow log path (/backup/logs)" 前滚日志恢复至指定时间点
3、查看备份记录
$ db2 list history backup all for dbname 可以看到备份的纪录
附:DB2数据库备份恢复的概念和知识点
备份类型:脱机备份(也称冷备份或离线备份)、联机备份(也称热备份或在线备份)、完全备份、增量备份(也称累积备份)、差异备份
数据库备份文件结构
恢复类型:崩溃恢复、版本恢复、前滚恢复(任意时间点恢复,恢复到最近时间点)
恢复情形:完全恢复、不完全恢复
手动恢复数据库的顺序
日志类型:循环日志(默认)、归档日志(活动日志、在线归档日志、离线归档日志)
日志类型与恢复类型:循环日志只支持崩溃恢复和版本恢复,归档日志支持所有类型的恢复
凡是联机备份产生的备份集在恢复时都需要使用归档日志,归档日志方式是是允许用户执行前滚(rollforward)恢复的唯一方法。
前滚的时间要在最小恢复时间点之后,最后的事务提交时间点之前。
本文出自 “滴水穿石” 博客,请务必保留此出处

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The logs of win10 can help users understand the system usage in detail. Many users must have encountered log 6013 when looking for their own management logs. So what does this code mean? Let’s introduce it below. What is win10 log 6013: 1. This is a normal log. The information in this log does not mean that your computer has been restarted, but it indicates how long the system has been running since the last startup. This log will appear once every day at 12 o'clock sharp. How to check how long the system has been running? You can enter systeminfo in cmd. There is one line in it.

The function is to provide engineers with feedback on usage information and records to facilitate problem analysis (used during development); because users themselves do not often generate upload logs, they are useless to users. The logging buffer is a small, temporary area used for short-term storage of change vectors for redo logs to be written to disk. A log buffer write to disk is a batch of change vectors from multiple transactions. Even so, the change vector in the log buffer is written to disk in near real-time, and when the session issues a COMMIT statement, the log buffer write operation is performed in real time.

The logs of win10 can help users understand the system usage in detail. Many users must have seen a lot of error logs when looking for their own management logs. So how to solve them? Let’s take a look below. . How to solve win10 log event 7034: 1. Click "Start" to open "Control Panel" 2. Find "Administrative Tools" 3. Click "Services" 4. Find HDZBCommServiceForV2.0, right-click "Stop Service" and change it to "Manual Start "

With the rapid development of the Internet and Web applications, log management is becoming more and more important. When developing web applications, how to find and locate problems is a very critical issue. A logging system is a very effective tool that can help us achieve these tasks. ThinkPHP6 provides a powerful logging system that can help application developers better manage and track events that occur in applications. This article will introduce how to use the logging system in ThinkPHP6 and how to utilize the logging system

iPhone lets you add medications to the Health app to track and manage the medications, vitamins and supplements you take every day. You can then log medications you've taken or skipped when you receive a notification on your device. After you log your medications, you can see how often you took or skipped them to help you track your health. In this post, we will guide you to view the log history of selected medications in the Health app on iPhone. A short guide on how to view your medication log history in the Health App: Go to the Health App>Browse>Medications>Medications>Select a Medication>Options&a

Differences in syntax between db2 and oracle: 1. SQL syntax differences. Although db2 and oracle both use structured query language, they have some differences in syntax; 2. db2 and oracle have different data types; 3. Foreign key constraint definition, db2 can be defined when creating the table or added after using the "ALTER TABLE" statement. Oracle needs to be defined together when creating the table; 4. There are also some differences in the syntax of db2 and oracle stored procedures and functions.

In Linux systems, you can use the following command to view the contents of the log file: tail command: The tail command is used to display the content at the end of the log file. It is a common command to view the latest log information. tail [option] [file name] Commonly used options include: -n: Specify the number of lines to be displayed, the default is 10 lines. -f: Monitor the file content in real time and automatically display the new content when the file is updated. Example: tail-n20logfile.txt#Display the last 20 lines of the logfile.txt file tail-flogfile.txt#Monitor the updated content of the logfile.txt file in real time head command: The head command is used to display the beginning of the log file

The logs of win10 have a lot of rich content. Many users must have seen the event ID455 display error when looking for their own management logs. So what does it mean? Let’s take a look below. What is event ID455 in the win10 log: 1. ID455 is the error <error> that occurred in <file> when the information store opened the log file.
