博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NBU备份DB2
阅读量:5929 次
发布时间:2019-06-19

本文共 3324 字,大约阅读时间需要 11 分钟。

查看状态

$ db2 list database directory
$ db2 get db cfg for BZDB
$ db2 list tablespaces
$ db2 list tables
$ db2 select * from table
· 创建数据库
$db2 create database BZDB
· 连接数据库
$db2 connect to BZDB
· 创建表
$ db2 create table test (name char(8) not null primary key,depid smallint,pay bigint)
· 插入数据
$ db2 insert into test values('li',1,1)
· 创建实例
DB2_install=/usr/opt/db2_08_01/instance
./db2icrt -u db2test db2test
· 删除数据库
db2 drop db db2test
db2stop
· 删除实例
cd DB2_install
./db2idrop -f db2test # -f参数一定要添加否则删除完了会报错!
· 删除用户
smitty user
选择Remove a User

  • User NAME [db2test] +
    Remove AUTHENTICATION information? yes
    删除用户目录
    rm -rf db2test
    vx:j8517870727
    NBU备份DB2
    · 查看归档
    [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)
    ###########################################################################################
    · 关闭第二归档方式
    $ db2 update db cfg for BZDB using LOGARCHMETH2 OFF
    · 将LOGARCHMETH1设为VENDOR
    $ db2 update database configuration for BZDB using LOGARCHMETH1 VENDOR:C:\progra~1\Veritas\NetBackup\bin\nbdb2.dll
    · 修改logretain状态为recovery
    $ db2 update db cfg for BZDB using userexit on
    · 修改userexit状态为on
    $db2 update db cfg for BZDB using logretain on
    · 使数据库能够增量备份
    $ db2 update db cfg for BZDB using trackmod yes
    · 执行离线备份,使归档日志模式生效
    $ db2 force application all
    win:
    $ db2 backup database nbutest to c:\db2_log
    linux:
    $ db2 backup database nbutest to /backup
    1、nbu配置
    创建db策略
    Attributes
    Policy type: DB2
    Schedules
    Name: DBFULL
    Type of Backup:Automatic Full Backup
    Schedule:
    Name: Default-Appplication-Backup-DB
    Type of Backup: Application Backup
    Clients: db2服务器主机名
    Backup Selections:db2_backup_nbu_online.cmd
    创建db log策略
    Attributes:
    Policy type: DB2
    Schedules:
    Name: Default-Application-Backup-LOG
    Type of backup: Application Backup
    Schedule:
    Name: LOGFuLL
    Type of backup:Automatic Full Backup
    Clients: DB2数据库主机
    Backup Selections:注此处为空

2、配置环境变量:db2.conf

从install_path\NetBackup\dbext\db2\samples\db2.conf 复制到 Install_path\NetBackup\dbext\db2\db2.conf

3、修改脚本:db2_backup_db_online.cmd

从install_path\NetBackup\ DbExt\sample\ db2_backup_db_online.cmd 复制到D盘 D:\db2_backup_nbu_online.cmd

4、修改db2uext2.exe

将C:\Program Files\Veritas\NetBackup\DbExt\DB2\db2uext2.exe复制到D:\SQLLIB\BIN

转载于:https://blog.51cto.com/718689/2331993

你可能感兴趣的文章
算法-大整数加法
查看>>
Android学习笔记之布局技巧以及布局中的细节介绍....
查看>>
ios7 sdk 新特性
查看>>
573锁存器驱动8段数码管
查看>>
github常见操作和常见错误及其解决办法
查看>>
hiho_1041 国庆出游
查看>>
命令行参数(argc, argv)
查看>>
表空间回收操作判断
查看>>
零基础入门深度学习(1) - 感知器
查看>>
Nginx运行Laravel的配置
查看>>
Linux网络编程:基于TCP的程序开发回顾篇《转》
查看>>
MySQL常见错误代码及代码说明
查看>>
AngularJS - $index, $event, $log
查看>>
多线程调用COM组件的体会(CoInitialize)
查看>>
Java_并发工具包 java.util.concurrent 用户指南(转)
查看>>
Chrome禁用NPAPI插件(包含 Silverlight、Java 和 Unity)
查看>>
Elasticsearch教程(七) elasticsearch Insert 插入数据(Java)
查看>>
儿童节,我们从零开始——Python入门资源推荐
查看>>
maven POM.xml 标签详解
查看>>
【名企秋招】360公司2017年秋季校招开始喽~ 立即报名
查看>>