- 论坛徽章:
- 0
|
我遇到个问题 环境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和脚本文件写得不对啊,你有修改的格式吗? |
|