Home Database Mysql Tutorial DB2的归档模式设置方法

DB2的归档模式设置方法

Jun 07, 2016 pm 05:33 PM
db2 o database

DB2的日志使用通常有两种方式,既称之为循环日志,也就是不采用归档日志模式,另外一种就是归档日志模式,默认是循环日志模式,也

DB2的日志使用通常有两种方式,既称之为循环日志,也就是不采用归档日志模式,另外一种就是归档日志模式,默认是循环日志模式,也就是无法进行日志归档或在线备份。通常来说决定DB2日志配置的几个database级别的参数如下:
当前的数据库版本为:
[db2inst1@localhost ]$ db2level
DB21085I  Instance "db2inst1" uses "32" bits and DB2 code release "SQL09075"
with level identifier "08060107".
Informational tokens are "DB2 v9.7.0.5", "s111017", "IP23291", and Fix Pack
"5".
Product is installed at "/opt/ibm/db2/V9.7".


[db2inst1@localhost ]$ db2 get db cfg|grep -i log
Log retain for recovery status                          = NO
User exit for logging status                            = YES
Log buffer size (4KB)                        (LOGBUFSZ) = 256
Log file size (4KB)                        (LOGFILSIZ) = 2000
Number of primary log files                (LOGPRIMARY) = 20
Number of secondary log files              (LOGSECOND) = 30
Changed path to log files                  (NEWLOGPATH) =
Path to log files                                      = /home/db2inst1/db2inst1/NODE0000/SQL00001/SQLOGDIR/
Overflow log path                    (OVERFLOWLOGPATH) =
Mirror log path                        (MIRRORLOGPATH) =
First active log file                                  = S0000001.LOG
Block log on disk full                (BLK_LOG_DSK_FUL) = NO
Block non logged operations            (BLOCKNONLOGGED) = NO
Percent max primary log space by transaction  (MAX_LOG) = 0
Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0
Percent log file reclaimed before soft chckpt (SOFTMAX) = 100
Log retain for recovery enabled            (LOGRETAIN) = OFF
User exit for logging enabled                (USEREXIT) = OFF
HADR log write synchronization mode    (HADR_SYNCMODE) = NEARSYNC
First log archive method                (LOGARCHMETH1) = DISK:/db2src/TS/backup/
Options for logarchmeth1                  (LOGARCHOPT1) =
Second log archive method                (LOGARCHMETH2) = OFF
Options for logarchmeth2                  (LOGARCHOPT2) =
Failover log archive path                (FAILARCHPATH) =

如上常用的参数介绍如下:
LOGPRIMARY+LOGSECOND是日志文件的个数,而每个日志文件的大小由LOGFILSIZ参数设定,如上当前的日志文件大小为2000 pages,而page大小为4K,所以每个日志文件为8M,总共的日志空间为400M,NEWLOGPATH参数决定了日志文件存放目录路径,修改后可以动态生效。
First active log file就是指DB当前使用的活动日志文件名称
MAX_LOG 指定单个事物可以使用主日志空间的百分比,当达到这个百分比后,这个事物就得被回滚,默认设置为0,也就是单个事务日志空间使用不受限制,可以使用主附日志的所有空间。
SOFTMAX 指定软检查点频率和范围,单位为一个日志文件大小的百分比,100也就是一个日志文件,当发生数据库崩溃恢复时,需要保持一致状态,就会发生崩溃恢复,需要使用指定日志文件数来做恢复,当然日志量越小恢复就越快,通常保持默认值。
LOGARCHMETH1 这个即设置归档的方式,可以指定DISK、TSM等参数。
上面大概介绍了参数设置,那么如何配置DB2归档呢?
其实DB2的归档配置比较简单,只需要需要修改LOGARCHMETH1参数即可如下:
[db2inst1@localhost backup]$ db2 update db cfg using LOGARCHMETH1 'disk:/db2src/TS/backup'
DB20000I  The UPDATE DATABASE CONFIGURATION command completed successfully.
SQL1363W  One or more of the parameters submitted for immediate modification
were not changed dynamically. For these configuration parameters, all
applications must disconnect from this database before the changes become
effective.

但是修改了这个参数还是无法生效的,需要执行重启数据库这里直接重启实例:
[db2inst1@localhost backup]$ db2stop force
11/25/2013 22:17:02    0  0  SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.
[db2inst1@localhost backup]$ db2start
11/25/2013 22:17:07    0  0  SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.
[db2inst1@localhost backup]$ db2 connect to sample
SQL1116N  A connection to or activation of database "SAMPLE" cannot be made
because of BACKUP PENDING.  SQLSTATE=57019
发现重启后还是不能连接,这时数据库状态为BACKUP PENDING,需要做一个备份,,记住是离线备份。

更多详情见请继续阅读下一页的精彩内容:

推荐阅读:

DB2数据库性能调整和优化(第1、2版) PDF

DB2数据库性能优化介绍

linux

Statement of this Website
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

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

Video Face Swap

Video Face Swap

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

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

Top 10 global digital currency trading apps recommended (2025 currency trading software ranking) Top 10 global digital currency trading apps recommended (2025 currency trading software ranking) Mar 12, 2025 pm 05:48 PM

This article recommends the top ten digital currency trading apps in the world, including Binance, OKX, Huobi Global, Coinbase, Kraken, Gate.io, KuCoin, Bitfinex, Gemini and Bitstamp. These platforms have their own characteristics in terms of transaction pair quantity, transaction speed, security, compliance, user experience, etc. For example, Binance is known for its high transaction speed and extensive services, while Coinbase is more suitable for novices. Choosing a platform that suits you requires comprehensive consideration of your own needs and risk tolerance. Learn about the world's mainstream digital currency trading platforms to help you conduct digital asset trading safely and efficiently.

How to install and register the btc trading app? How to install and register the btc trading app? Feb 21, 2025 pm 07:09 PM

This article will provide a detailed introduction to how to install and register a Bitcoin trading application. The Bitcoin trading app allows users to manage and trade cryptocurrencies such as Bitcoin. The article guides users through the installation and registration process step by step, including downloading applications, creating accounts, performing identity verification, and first deposit. The goal of the article is to provide beginners with clear and easy-to-understand guidelines to help them easily enter the world of Bitcoin trading.

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Ouyi Exchange Download Official Portal Ouyi Exchange Download Official Portal Feb 21, 2025 pm 07:51 PM

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

See all articles