search
HomeDatabaseMysql Tutorial DB2在线增量备份失败的案例分析

公司有一台DB2服务器在线增量备份失败,使用的备份软件为NETBACKUP7.5。具体报错如下:nbu报4号错误,在赛门铁克的官网上,对4号错误的描述是给出的解决方案是验

  公司有一台DB2服务器在线增量备份失败,使用的备份软件为NETBACKUP 7.5。具体报错如下:

1327.jpg

nbu报4号错误,在赛门铁克的官网上,对4号错误的描述是

1328.jpg

给出的解决方案是验证权限,是否可删除文件。如果你从这个思路去找原因解决问题,,就会很困惑。因为即使你把权限设成777,也还是会报这个错误。

换一个思路,还是看看DB2的db2diag.log日志吧。日志里有这样一段描述:

2013-06-19-15.22.29.980017-360 E437909183A905     LEVEL: Severe
PID     : 798772               TID  : 1           PROC : db2agent (idle) 0
INSTANCE: db2inst2             NODE : 000         DB   : PORTALDB
APPHDL  : 0-490                APPID: *LOCAL.db2inst2.130619212231
AUTHID  : DB2INST2
FUNCTION: DB2 UDB, database utilities, sqlubInitCheck, probe:310
MESSAGE : SQL2426N  The database has not been configured to allow the
incremental backup operation. Reason code = "".

这个信息告诉我们数据库没有配置允许增量备份的功能,在DB2中需要开启。在ORACLE中,则可以通过RMAN实现比较方便的增量和差异备份。

接下来我们查一下TRACKMOD参数

$ db2 get db cfg for portaldb|grep -i trackmod
Track modified pages                         (TRACKMOD) = OFF

发现此参数为OFF,这显然是导致DB2增量备份失败的最主要的原因。

因为db2的增量备份需要设置tracemod为on,这样数据库将在物理页上记录更改的部分页,做dirty标记。开启了增量备份意味着,不需要每次备份一个超大的数据库.同时意味着你可以将数据库恢复到崩溃前的状态,而不是你最后一次备份时的状态,最大可能的减少数据损失.

正确设置增量备份需要注意三个参数:

db2 update db cfg using logretain on(或者recovery); 启用归档日志
db2 update db cfg using trackmod on; 启用增量备份功能
db2 update db cfg using userexit on; 启用用户出口

对于这些配置参数,必须在所有应用程序都与此数据库断开连接之后(db2 force applications all),更改才会生效。另外在更改参数后,数据库处于backup pending状态,在执行增量、在线备份之前必须执行离线全备份一次,以使状态正常。

补充:如何进行在线备份、增量备份、差异备份?

db2 backup db testdb online to 备份路径(在线全备份) include logs
db2 backup db testdb online incremental to 备份路径(增量备份)
db2 backup db testdb online incremental delta to 备份路径(delta备份)

如何使用备份文件进行恢复?

1.查看备份文件的完整性,并验证是否可用

db2ckbkp -h /db2logs/PORTALDB.0.db2inst2.NODE0000.CATN0000.20130619001007.001

2.执行db2ckrst命令返回建议的必需的恢复操作命令。

db2ckrst -d portaldb -r database -t 20130619001007

3.执行上个命令给出的命令序列

db2 restore db portaldb incremental from /backup taken at 20130619001007 buffer 100

将会将数据库还原到备份的时刻,之后应该执行日志前滚(此时数据库处于前滚暂挂状态,将无法使用)

db2 rollforward db portaldb to end of logs and complete

当然如果你认为不需要前滚(这样将丢失最后一次备份之后的更改),也可以

db2 rollforward db portaldb stop

当你了解了这些知识,就能够正确有序的执行备份恢复,快速高效的解决问题。

 以上就是 DB2在线增量备份失败的案例分析的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version