db2 备份错误
我遇到个问题 环境win-master win-DB2client
nbu7.0备份DB2的问题,用的是copy 日志方式,修改bp.conf和脚本后,还是备份失败。
脚本:@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 1993 - 2009 Symantec Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM ---------------------------------------------------------------------------
@REM
@REM This script is provided as an example. See the instructions below
@REM for making customizations to work within your environment.
@REM
@REM Please copy this script to a safe location before customizing it.
@REM Modifications to the original files will be lost during product updates.
@REM
@REM This script performs an online backup of the database. An online backup
@REM requires that the database is configured for forward recovery (see the
@REM DB2 USEREXIT and LOGRETAIN settings). DB2 users can remain connected
@REM while performing an online backup.
@REM
@REM To back up a database or a database partition, the user must have SYSADM,
@REM SYSCTRL, or SYSMAINT authority.
@REM ---------------------------------------------------------------------------
@echo off
@setlocal
@REM !!!!! START CUSTOMIZATIONS !!!!!
@REM
@REM The following changes need to be made to make this script work with your
@REM environment:
@REM
@REM ---------------------------------------------------------------------------
@REM (1) NetBackup for DB2 shared library:
@REM ---------------------------------------------------------------------------
@REM This is the NetBackup library that backs up and restores DB2 databases
@REM Set db2_nblib below to the correct NetBackup library path for your host
@REM
@REM Example: @set db2_nblib=C:\progra~1\veritas\netbackup\bin\nbdb2.dll
@set db2_nblib=C:\progra~1\veritas\netbackup\bin\nbdb2.dll
@echo db2_nblib = %db2_nblib%
@REM ---------------------------------------------------------------------------
@REM (2) DB2 home directory (the system catalog node):
@REM ---------------------------------------------------------------------------
@REM This is the DB2 home directory where DB2 is installed
@REM Set db2_home to DB2 home directory
@REM
@REM Example: @set db2_home=D:\SQLLIB
@set db2_home=C:\Program Files\IBM\SQLLIB
@echo db2_home = %db2_home%
@REM ---------------------------------------------------------------------------
@REM (3) Database to backup:
@REM ---------------------------------------------------------------------------
@REM Set db2_name to the name of the database to backup:
@REM
@REM Example: @set db2_name=SAMPLE
@set db2_name=TOOLSDB
@echo db2_name = %db2_name%
@REM ---------------------------------------------------------------------------
@REM (4) Multiple Sessions:
@REM ---------------------------------------------------------------------------
@REM Concurrency can improve backup performance of large databases.
@REM Multiple sessions are used to perform the backup, with each session
@REM backing up a subset of the database. The sessions operate
@REM concurrently, reducing the overall time to backup the database.
@REM This approach assumes there are adequate resources available, like
@REM multiple tape devices and/or multiplexing enabled.
@REM
@REM For more information on configuring NetBackup multiplexing,
@REM refer to the "Veritas NetBackup System Administrator's Guide".
@REM
@REM If using multiple sessions change db2_sessions to use multiple sessions
@REM
@REM Example: @set db2_sessions="OPEN 2 SESSIONS WITH 4 BUFFERS BUFFER 1024"
@set db2_sessions=
@REM !!!!! END CUSTOMIZATIONS !!!!!
@REM ---------------------------------------------------------------------------
@REM Exit now if the sample script has not been customized
@REM ---------------------------------------------------------------------------
if "%db2_name%" == "" goto custom_err_msg
@REM ---------------------------------------------------------------------------
@REM These environmental variables are created by Netbackup (bphdb)
@REM ---------------------------------------------------------------------------
@echo DB2_POLICY = %DB2_POLICY%
@echo DB2_SCHED = %DB2_SCHED%
@echo DB2_CLIENT = %DB2_CLIENT%
@echo DB2_SERVER = %DB2_SERVER%
@echo DB2_USER_INITIATED = %DB2_USER_INITIATED%
@echo DB2_FULL = %DB2_FULL%
@echo DB2_CINC = %DB2_CINC%
@echo DB2_INCR = %DB2_INCR%
@echo DB2_SCHEDULED = %DB2_SCHEDULED%
@echo STATUS_FILE = %STATUS_FILE%
@REM ---------------------------------------------------------------------------
@REM Type of Backup:
@REM ---------------------------------------------------------------------------
@REM NetBackup policies for DB2 recognize different
@REM backup types, i.e. full, cumulative, and differential.
@REM For more information on NetBackup backup types, please refer to the
@REM NetBackup for DB2 System Administrator's Guide.
@REM
@REM Use NetBackup variables to set DB2 full or incremental options
@REM
@set db2_action=
if "%DB2_FULL%" == "1" @set db2_action=ONLINE
if "%DB2_CINC%" == "1" @set db2_action=ONLINE INCREMENTAL
if "%DB2_INCR%" == "1" @set db2_action=ONLINE INCREMENTAL DELTA
@echo db2_action = %db2_action%
@REM ---------------------------------------------------------------------------
@REM Actual command that will be used to execute a backup
@REM Note: the parameters /c /w /i and db2 should be used with db2cmd.exe
@REM Without them, NetBackup job monitor may not function properly.
@REM ---------------------------------------------------------------------------
@set CMD_FILE=%temp%\cmd_file
@echo CMD_FILE = %CMD_FILE%
@set CMD_LINE=%db2_home%\bin\db2cmd.exe /c /w /i db2 -f %CMD_FILE%
@echo CMD_LINE = %CMD_LINE%
@echo BACKUP DATABASE %db2_name% %db2_action% LOAD %db2_nblib% %db2_sessions%
@echo BACKUP DATABASE %db2_name% %db2_action% LOAD %db2_nblib% %db2_sessions% > %CMD_FILE%
@REM ---------------------------------------------------------------------------
@REM Execute the command
@REM ---------------------------------------------------------------------------
@echo Executing CMD=%CMD_LINE%
%CMD_LINE%
@REM Successful Backup
if errorlevel 1 goto errormsg
echo BACKUP SUCCESSFUL
if "%STATUS_FILE%" == "" goto end
if exist "%STATUS_FILE%" echo 0 > "%STATUS_FILE%"
goto end
:custom_err_msg
echo This script must be customized for proper operation in your environment.
@REM Backup command unsuccessful
:errormsg
echo Execution of BACKUP command FAILED - exiting
if "%STATUS_FILE%" == "" goto end
if exist "%STATUS_FILE%" echo 1 > "%STATUS_FILE%"
:end
@endlocal
--------------------------------------------------
bp.conf文件
# $Header: db2.conf,v 1.6 2009/08/26 15:58:31 $
#
# ***************************************************************************
# * $Copyright: Copyright 1993 - 2009 Symantec Corporation, All Rights Reserved $ *
# ***************************************************************************
#
# The following settings are used by NetBackup to backup/restore a DB2 database.
#
# Reminders:
# 1) The specified policy must have a type of "DB2".
# 2) The specified schedule must be defined for this policy.
# 3) The DB2 database host must be entered as a client for this policy.
#
DATABASE TOOLSDB
OBJECTTYPE DATABASE
POLICY DB2-DB
SCHEDULE Default-Application-Backup
ENDOPER
#
# The following settings are used by NetBackup to backup/restore DB2 log files.
#
Reminders:
# 1) DB2 transcation logs can be backed up/restored using either
# (a) DB2 User Exit Program
# The specified policy must have a type of "Standard" (for UNIX DB2
# host) or "MS-Windows" (for Windows DB2 host).
#
# (b) LOGARCHMETH1 can be configured to use NetBackup.
# (When LOGARCHMETH1 = "VENDOR:NetBackup for DB2 agent")
# This option is possible only for versions 8.2 and above.
# The specified policy must have a type of DB2.
#
# 2) The specified schedule must be defined for this policy.
# 3) The DB2 database host must be entered as a client for this policy.
#
# ---------------------
# DB2 User Exit Program
# ---------------------
# If DB2 log file archiving is enabled (DB2 USEREXIT ON), DB2 will invoke
# the NetBackup user-exit program to backup & restore DB2 archive log files.
# Using ARCFUNC SAVE causes log files to be archived to NetBackup storage,
# as specified by the policy storage-unit setting.
# Using ARCFUNC COPY causes log files to be archived to a disk directory.
# Use ARCDIR to specify the destination directory for log file backup.
# Use RETDIR to specify the source directory for log file restore.
#
DATABASE TOOLSDB
OBJECTTYPE ARCHIVE
POLICY DB2-LOG
SCHEDULE DB2-LOG
#SCHEDULE User
#ARCFUNC SAVE
ARCFUNC COPY
ARCDIR C:\db2log\NODE0000
RETDIR C:\db2log\NODE0000
#ARCDIR /home/db2inst1/arcdir
#RETDIR /home/db2inst1/arcdir
ENDOPER
# --------------------------------------------------------------
# LOGARCHMETH1 = "VENDOR.." parameter for versions 8.2 and above
# Policy is of type DB2.
# --------------------------------------------------------------
#
# Comment the above DB2 User Exit section when using LOGARCHMETH1 = "VENDOR.."
#
DATABASE TOOLSDB
OBJECTTYPE ARCHIVE
POLICY DB2_ARCH_Policy
SCHEDULE Default-Application-Backup
ENDOPER
------------------------------------------------------------
我在客户端备份也是错误代码也是6,出错中
SQL30082N 安全处理失败,因为 "24"("USERNAME AND/OR PASSWORD INVALID")。 SQLSTATE=0800
我又修改了Nbu客户端登陆帐户为db2管理员可还是如此错误。
是不是我bp.conf和脚本文件写得不对啊,你有修改的格式吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
脚本可以通过模板拷贝过来修改,具体可以参考官方手册
是拷贝出来修改的。
已经按照 官方文档修改了db2.conf文件,但是shell脚本官方没有文档,我是根据DB2环境修改的。
win03下db2 v9.5,实例DB2数据库名 TOOLSDB
home=c:\pro..\ibm\sqllib
日志文件路径c:\db2log\NODE0000\ (这个路径是通过NEWLOGPATH修改后的。。userexit\logretain\trackmod 都已修改)
安装client后复制db2uext.exe到DB2下,但已经存在。再将db2.conf复制到上层目录,脚本复制到C根目录下开始修改...
服务器上所作策略
1。 DB2-DB 类型DB2 日志 除了默认还添加了自动完全备份名称FULL,选择客户端添加备份选择,客户端C盘下(复制出的)脚本。
2。DB2-LOG 类型 M-windows,日志DB2-LOG 全备份,备份选择c:\db2log\NODE0000\
3.DB2-ARC 类型 M-windows 日志DB2-ARC 用户归档 备份选择 无
在线等兄弟们
不能沉啊
{:3_190:} 还没人来瞧瞧啊
怎么回事 这么久了也没人理
这个帖子就这样沉默了
建议楼主先打一下NBU7.0.1的补丁再试一试。