NBU备份oracle详细配置文档(含常见报错处理方法)

2024-04-01 17:44

本文主要是介绍NBU备份oracle详细配置文档(含常见报错处理方法),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

​前提 NBU master和media服务器已经配置OK,现在需要oracle主机安装agent并配置备份任务。

NBU master版本8.3.0.2

Oracle OS版本redhat 6.8

Oracle版本 11.2.0.4       

1.Oracle 安装agent

下载安装档

https://www.veritas.com/content/support/zh_CN

选择产品和版本号

Windows 选择NetBackup_8.3.0.2_CLIENTS1.tar.gz

Linux/unix 选择NetBackup_8.3.0.2_CLIENTS2.tar.gz    

          

解压tar -xzf NetBackup_8.3.0.2_CLIENTS2.tar.gz       

安装

    

输入master服务器的IP/hostname

Media 服务器的地址

    

这里注意 需要输入授权的token    

该token需要在master服务器上找 如下图

找到valid token

          

Copy token

    

ps :然后直接粘贴到安装界面,因为这个是密码界面,输入任何结果都不会显示,所以粘贴后直接回车即可(这里容易出错)

之后就会正常安装

2.Master上配置备份计划

oracle db上安装好客户端后可以在master上看到host的信息

创建新的policy

    

   这里只需要注意两点

Policy的type选择oracle,

Policy的storage选择对应的media服务器

Schedule按自己需求设定    

Clients选择client for use with scripts

然后添加db客户端

注意:oracle 主机,master主机,media主机都需要配置hosts ,并且网络互通,端口互通(1556,13724)不然会有问题

    

          

Backup selections 选择rman备份脚本

默认的sample脚本在如下路径

   /usr/openv/netbackup/ext/db_ext/oracle/samples/rman

   我这里使用的是hot_database_backup.sh

需要修改环境变量和部分参数具体如下​

              #!/bin/sh# $Header$##bcpyrght#***************************************************************************# $Copyright: Copyright (c) 2020 Veritas Technologies LLC. All rights reserved $#***************************************************************************#ecpyrght## Note:  Only make modifications to a copy of this file. Changes to this file#        are lost when this example is overwritten during NetBackup upgrade.#        Delete this comment from the copy.## -----------------------------------------------------------------------------#              hot_database_backup.sh# -----------------------------------------------------------------------------#  This script uses Recovery Manager to take a hot (inconsistent) database    #  backup. A hot backup is inconsistent because portions of the database are#  being modified and written to the disk while the backup is progressing.#  You must run your database in ARCHIVELOG mode to make hot backups. It is#  assumed that this script will be executed by user root. In order for RMAN#  to work properly we switch user (su -) to the oracle dba account before#  execution. If this script runs under a user account that has Oracle dba#  privilege, it will be executed using this user's account.# -----------------------------------------------------------------------------           # -----------------------------------------------------------------------------# Log the start of this script to both the stdout/obk_stdout# and stderr/obk_stderr.# -----------------------------------------------------------------------------echo "==== $0 started on `date` ==== stdout"echo "==== $0 started on `date` ==== stderr" 1>&2           DEBUG=0           if [ "$DEBUG" -gt 0 ]; then        set -xfi # ---------------------------------------------------------------------------# Put output in.out. Change as desired.# Note: output directory requires write permission.# ---------------------------------------------------------------------------RMAN_LOG_FILE=${0}.out           # -----------------------------------------------------------------------------# Delete the log file before each execution so that it does not grow unbounded. # Remove or comment these lines if all historical output must be retained or if# the log file size is managed externally.# -----------------------------------------------------------------------------           if [ -f "$RMAN_LOG_FILE" ]; then    rm -f "$RMAN_LOG_FILE"fi           # -----------------------------------------------------------------------------    # Initialize the log file. By default it is readable by the DBA and other# users. Restrict the permissions as needed.# ----------------------------------------------------------------------------- echo >> $RMAN_LOG_FILEchmod 644 $RMAN_LOG_FILE           # -----------------------------------------------------------------------------# Redirect all stderr and stdout into the specified log file and also to# stdout. No output will appear on stderr (or in the obk_stderr).# -----------------------------------------------------------------------------           out=/tmp/`basename $0`.stdout.$$trap "rm -f $out" EXIT SIGHUP SIGINT SIGQUIT SIGTRAP SIGKILL SIGUSR1 SIGUSR2 SIGPIPE SIGTERM SIGSTOPmkfifo "$out"tee -a $RMAN_LOG_FILE < "$out" &exec 1>&- 2>&-exec 1>"$out" 2>&1           # -----------------------------------------------------------------------------# Log the start of this script to the log file and stdout.    # Log any additional arguments to the script.# -----------------------------------------------------------------------------echo "==== $0 started on `date` ===="echo "==== $0 $*"echo           # *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*# *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*## NOTE: User modifications should be made only below this point.## USER CUSTOMIZABLE VARIABLE SECTION## ORACLE_HOME               - Oracle Home path                 # ORACLE_SID                - Oracle Sid of the target database# ORACLE_USER               - Oracle user with permissions to execute RMAN# ORACLE_TARGET_CONNECT_STR - Connect string for the target database#                             [user]/[password][@TNSalias]    # RMAN_EXECUTABLE           - Path to the rman executable# RMAN_SBT_LIBRARY          - SBT library path;#                             on AIX see technote TECH194511.# RMAN_CATALOG              - Recovery catalog option and connect string# BACKUP_SCHEDULE           - If overriding Default-Application-Backup schedule# BACKUP_TAG                - User specified backup tag ###----需要修改的部分参数-------          ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1           ORACLE_SID=orcl1           ORACLE_USER=oracle           ORACLE_TARGET_CONNECT_STR=sys/*********** RMAN_EXECUTABLE=$ORACLE_HOME/bin/rman           RMAN_SBT_LIBRARY="/usr/openv/netbackup/bin/libobk.so64"           # Set the Recovery catalog to use. In This example we do not use a    # Recovery Catalog. If you choose to use one, replace the option 'nocatalog'# with a "'catalog/@'" statement.           RMAN_CATALOG="nocatalog"           BACKUP_SCHEDULE=""           # Note: This tag will be appended with the dected schedule type, see schedule# section.BACKUP_TAG="hot_db_bk"           export ORACLE_HOME ORACLE_SID           # Note: Additional tuning may be desired to RMAN_SEND and CMD_INPUT below.           # *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*# *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*               # -----------------------------------------------------------------------------# Determine the user which is executing this script.# -----------------------------------------------------------------------------           BACKUP_CUSER=`id |cut -d"(" -f2 | cut -d ")" -f1`           # -----------------------------------------------------------------------------# This script assumes that the database is properly opened. If desired,# this would be the place to verify that.# -----------------------------------------------------------------------------                      # -----------------------------------------------------------------------------# If this script is executed from a NetBackup schedule, NetBackup# sets NB_ORA environment variables based on the schedule type.# These variables can then used to dynamically select the appropriate# RMAN backup type.# For example, when:#     schedule type is                BACKUP_TYPE is#     ----------------                --------------# Automatic Full                     INCREMENTAL LEVEL=0    # Automatic Differential Incremental INCREMENTAL LEVEL=1# Automatic Cumulative Incremental   INCREMENTAL LEVEL=1 CUMULATIVE## For client initiated backups, BACKUP_TYPE defaults to incremental# level 0 (full).  To change the default for a user initiated# backup to incremental or incremental cumulative, uncomment# one of the following two lines.# BACKUP_TYPE="INCREMENTAL LEVEL=1"# BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"## Note that we use incremental level 0 to specify full backups.# That is because, although they are identical in content, only# the incremental level 0 backup can have incremental backups of# level > 0 applied to it.# ----------------------------------------------------------------------------- if [ "$NB_ORA_FULL" = "1" ]; then    echo "Full backup requested from Schedule"    BACKUP_TYPE="INCREMENTAL LEVEL=0"    BACKUP_TAG="${BACKUP_TAG}_inc_lvl0"     elif [ "$NB_ORA_INCR" = "1" ]; then    echo "Differential incremental backup requested from Schedule"    BACKUP_TYPE="INCREMENTAL LEVEL=1"    BACKUP_TAG="${BACKUP_TAG}_inc_lvl1" elif [ "$NB_ORA_CINC" = "1" ]; then    echo "Cumulative incremental backup requested from Schedule"    BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"    BACKUP_TAG="${BACKUP_TAG}_inc_lvl1_cinc" elif [ "$BACKUP_TYPE" = "" ]; then    echo "Manual execution - defaulting to Full backup"    BACKUP_TYPE="INCREMENTAL LEVEL=0"    BACKUP_TAG="${BACKUP_TAG}_inc_lvl0"fi           echo           # -----------------------------------------------------------------------------# Construct an RMAN SEND command when initiated from the master server. # This ensures that the resulting application backup jobs utilize the same     # master server, client name, and policy name. ## If desired, initialize RMAN_SEND with additional NB_ORA_* variable=value# pairs.## NOTE WHEN USING NET SERVICE NAME: When connecting to a database# using a net service name, you must use a send command or a parms operand to# specify environment variables.  In other words, when accessing a database# through a listener, any environment variable set in this script are not# inherited by the Oracle channel processes because it is a child of the# listener process and not of this script.  For more information on the# environment variables, please refer to the NetBackup for Oracle Admin. Guide.# -----------------------------------------------------------------------------           RMAN_SEND=""           if [ "$NB_ORA_SERV" != "" ]; then        RMAN_SEND="NB_ORA_SERV=${NB_ORA_SERV}"fi           if [ "$NB_ORA_CLIENT" != "" ]; then    if [ "$RMAN_SEND" != "" ]; then        RMAN_SEND="${RMAN_SEND},NB_ORA_CLIENT=${NB_ORA_CLIENT}"    else        RMAN_SEND="NB_ORA_CLIENT=${NB_ORA_CLIENT}"    fifi           if [ "$NB_ORA_POLICY" != "" ]; then    if [ "$RMAN_SEND" != "" ]; then        RMAN_SEND="${RMAN_SEND},NB_ORA_POLICY=${NB_ORA_POLICY}"    else        RMAN_SEND="NB_ORA_POLICY=${NB_ORA_POLICY}"    fifi           if [ "$BACKUP_SCHEDULE" != "" ]; then        if [ "$RMAN_SEND" != "" ]; then        RMAN_SEND="${RMAN_SEND},NB_ORA_SCHED=${BACKUP_SCHEDULE}"    else        RMAN_SEND="NB_ORA_SCHED=${BACKUP_SCHEDULE}"    fifi           if [ "$RMAN_SEND" != "" ]; then    RMAN_SEND="SEND '${RMAN_SEND}';"fi           # ---------------------------------------------------------------------------# Call Recovery Manager to initiate the backup.## Note: Any environment variables needed at run time by RMAN#       must be set and exported within the CMDS variable.# ---------------------------------------------------------------------------#  Backs up the whole database.  This backup is part of the incremental#  strategy (this means it can have incremental backups of levels > 0#  applied to it).#    #  We do not need to explicitly request the control file to be included#  in this backup, as it is automatically included each time file 1 of#  the system tablespace is backed up (the inference: as it is a whole#  database backup, file 1 of the system tablespace will be backed up,#  hence the controlfile will also be included automatically).##  Typically, a level 0 backup would be done at least once a week.##  The scenario assumes:#     o you are backing your database up to two tape drives#     o you want each backup set to include a maximum of 5 files#     o you wish to include offline datafiles, and read-only tablespaces,#       in the backup#     o you want the backup to continue if any files are inaccessible.#     o This script explicitly backs up the control file.  If you specify or#       default to nocatalog, the controlfile backup that occurs#       automatically as the result of backing up the system file is#       not sufficient; it will not contain records for the backup that#       is currently in progress.#     o you want to archive the current log, back up all the#       archive logs using two channels, putting a maximum of 20 logs#       in a backup set, and deleting them once the backup is complete.    ##  Note that the format string is constructed to guarantee uniqueness and#  to enhance NetBackup for Oracle backup and restore performance.## -----------------------------------------------------------------------------           # When needed, commands to debug the environment present in the subshell where# RMAN will be started.           if [ "$DEBUG" -gt 0 ]; then    ENV_COMMANDS="    echo ----- LIST OF DECLARED VARIABLES IN SUBSHELL -----    echo     set | sort    echo     echo ----- LANGUAGE AND LOCALE -----    echo     locale     echo     echo ----- PROCESS LIST -----         echo     ps -ef    echo"else    ENV_COMMANDS=""fi           # The RMAN commands to be executed.# NOTE: If the default shell for the ORACLE_USER is the C shell, then update# the export syntax as follows:# setenv ORACLE_HOME "$ORACLE_HOME"# setenv ORACLE_SID "$ORACLE_SID"           CMDS="export ORACLE_HOME=$ORACLE_HOMEexport ORACLE_SID=$ORACLE_SIDechoecho ----- SUBSHELL ENV VARIABLES -----echoenv | sort | egrep '^ORACLE_|^NB_ORA_|^RMAN_|^BACKUP_|^TNS_'echo$ENV_COMMANDS    echo ----- STARTING RMAN EXECUTION -----echo$RMAN_EXECUTABLE target $ORACLE_TARGET_CONNECT_STR $RMAN_CATALOG"           # Building the PARMS option for the RMAN channels           if [ $RMAN_SBT_LIBRARY != "" ]; then    RMAN_SBT_LIBRARY_PARMS="PARMS 'SBT_LIBRARY=$RMAN_SBT_LIBRARY'"else    RMAN_SBT_LIBRARY_PARMS=""fi           # The RMAN statements that are needed to perform the desired backup.# Add, delete, or modify the CMD_INPUT per the backup requirements for the# instance.           CMD_INPUT="<< EOFSHOW ALL;RUN {    ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' $RMAN_SBT_LIBRARY_PARMS;ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' $RMAN_SBT_LIBRARY_PARMS;$RMAN_SENDBACKUP    $BACKUP_TYPE    SKIP INACCESSIBLE    TAG $BACKUP_TAG    FILESPERSET 5    # recommended format, must end with %t    FORMAT 'bk_%s_%p_%t'    DATABASE;    sql 'alter system archive log current';RELEASE CHANNEL ch00;RELEASE CHANNEL ch01;# backup all archive logsALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' $RMAN_SBT_LIBRARY_PARMS;ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE' $RMAN_SBT_LIBRARY_PARMS;$RMAN_SENDBACKUP    filesperset 20        # recommended format, must end with %t    FORMAT 'al_%s_%p_%t'    ARCHIVELOG ALL DELETE INPUT;RELEASE CHANNEL ch00;RELEASE CHANNEL ch01;## Note: During the process of backing up the database, RMAN also backs up the# control file.  That backup of the control file does not contain the# information about the archive log backup if "nocatalog" has been specified.# To include the information about the current backup, the control file should# be backed up as the last step.  This step may not be necessary if using# a recovery catalog or AUTOBACKUP CONTROLFILE.#ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' $RMAN_SBT_LIBRARY_PARMS;$RMAN_SENDBACKUP    # recommended format, must end with %t    FORMAT 'cntrl_%s_%p_%t'        CURRENT CONTROLFILE;RELEASE CHANNEL ch00;}EOF"           # -----------------------------------------------------------------------------# Print out the values of various variables matched by the following patterns.# -----------------------------------------------------------------------------if [ "$DEBUG" -gt 0 ]; then    echo ----- LIST OF DECLARED VARIABLES IN SCRIPT -----    echo     set | sort    echofi           echoecho "----- SCRIPT VARIABLES -----"echoset | sort | egrep '^ORACLE_|^NB_ORA_|^RMAN_|^BACKUP_|^TNS_'echo     echo "----- RMAN CMD -----"echoecho "$CMDS"echoecho "----- RMAN INPUT -----"echoecho "$CMD_INPUT"echo           # Sanity check the environment.           if [ ! -x $RMAN_EXECUTABLE ]; then    echo "ERR: $RMAN_EXECUTABLE: required executable not found!" 1>&2    exit 1fi           if [ ! -f  `echo $RMAN_SBT_LIBRARY | cut -d'(' -f1`  ]; then    echo "ERR: $RMAN_SBT_LIBRARY: required library not found!" 1>&2    exit 1fi               echo "----- STARTING CMDS EXECUTION -----"echo           if [ "$BACKUP_CUSER" = "root" ]; then    su - $ORACLE_USER -c "$CMDS $CMD_INPUT"    RSTAT=$?else    /bin/sh -c "$CMDS $CMD_INPUT"    RSTAT=$?fi # ---------------------------------------------------------------------------# Log the completion of this script to both stdout/obk_stdout# and stderr/obk_stderr.# --------------------------------------------------------------------------- if [ "$RSTAT" = "0" ]; then    LOGMSG="ended successfully"else    LOGMSG="ended in error"fi     echoecho "==== $0 $LOGMSG on `date` ==== stdout" echo "==== $0 $LOGMSG on `date` ==== stderr" 1>&2echoexit $RSTAT           

          

手动启动备份任务验证是否可以正常备份

Active monitor 查看备份任务的状态

    

双击备份任务可以看到详细的信息,如有报错也是在这里看

          

3.常见报错处理

3.1bpcd on db1 exited with status 48: client hostname could not be found

原因:一般是因为master,media主机和db主机网络或者端口不通

解决办法:确认hosts已经配置ok 并且互相都能ping通    

检查办法

       

[root@csaslbak02 ~]# /usr/openv/netbackup/bin/bpclntcmd -hn db1(hostname)host db1: db1 at 10.245.40.101aliases:     db1     10.245.40.10[~]# /usr/openv/netbackup/bin/bpclntcmd  -clear_host_cache ##可以清理一下cache 再重新获取Successfully cleared host cacheSuccessfully cleared generic cache

  

             3.2Error bpbrm (pid=36341) bpcd on db1 exited with status 59: access to the client was not allowed

              

原因:客户端配置问题

解决办法:

   

  cd /usr/openv/netbackup/[root@db1 netbackup]# vi bp.confSERVER = cscn01bak01SERVER = csaslbak02  ##media服务器没有加入到该配置文件CLIENT_NAME = db1CONNECT_OPTIONS = localhost 1 0 2

验证办法:

Media服务端验证client的连接性

/usr/openv/netbackup/bin/admincmd/bptestbpcd -client db1 -verbose

修改bp.conf添加media服务器    

再次验证 可以抓取client的信息 即表示正常

-------------------历史文章推荐----------------------------   

oracle常用监控脚本(纯干货,没有EMCC,ZABBIX也不怕)

Oracle利用BBED恢复崩溃实例

只要网通就可以实现异构数据库交互?

oracle 19c 打补丁教程

Oracle systemstate、gdb、dbx介绍

小心!udev异常导致的oracle集群宕机

传统制造型企业数据库选型之困

这篇关于NBU备份oracle详细配置文档(含常见报错处理方法)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/867761

相关文章

Python中Tkinter GUI编程详细教程

《Python中TkinterGUI编程详细教程》Tkinter作为Python编程语言中构建GUI的一个重要组件,其教程对于任何希望将Python应用到实际编程中的开发者来说都是宝贵的资源,这篇文... 目录前言1. Tkinter 简介2. 第一个 Tkinter 程序3. 窗口和基础组件3.1 创建窗

Python字符串处理方法超全攻略

《Python字符串处理方法超全攻略》字符串可以看作多个字符的按照先后顺序组合,相当于就是序列结构,意味着可以对它进行遍历、切片,:本文主要介绍Python字符串处理方法的相关资料,文中通过代码介... 目录一、基础知识:字符串的“不可变”特性与创建方式二、常用操作:80%场景的“万能工具箱”三、格式化方法

springboot+redis实现订单过期(超时取消)功能的方法详解

《springboot+redis实现订单过期(超时取消)功能的方法详解》在SpringBoot中使用Redis实现订单过期(超时取消)功能,有多种成熟方案,本文为大家整理了几个详细方法,文中的示例代... 目录一、Redis键过期回调方案(推荐)1. 配置Redis监听器2. 监听键过期事件3. Redi

Spring Boot 处理带文件表单的方式汇总

《SpringBoot处理带文件表单的方式汇总》本文详细介绍了六种处理文件上传的方式,包括@RequestParam、@RequestPart、@ModelAttribute、@ModelAttr... 目录方式 1:@RequestParam接收文件后端代码前端代码特点方式 2:@RequestPart接

基于SpringBoot实现分布式锁的三种方法

《基于SpringBoot实现分布式锁的三种方法》这篇文章主要为大家详细介绍了基于SpringBoot实现分布式锁的三种方法,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录一、基于Redis原生命令实现分布式锁1. 基础版Redis分布式锁2. 可重入锁实现二、使用Redisso

jdk1.8的Jenkins安装配置实践

《jdk1.8的Jenkins安装配置实践》Jenkins是一款流行的开源持续集成工具,支持自动构建、测试和部署,通过Jenkins,开发团队可以实现代码提交后自动进行构建、测试,并将构建结果分发到测... 目录Jenkins介绍Jenkins环境搭建Jenkins安装配置Jenkins插件安装Git安装配

自定义注解SpringBoot防重复提交AOP方法详解

《自定义注解SpringBoot防重复提交AOP方法详解》该文章描述了一个防止重复提交的流程,通过HttpServletRequest对象获取请求信息,生成唯一标识,使用Redis分布式锁判断请求是否... 目录防重复提交流程引入依赖properties配置自定义注解切面Redis工具类controller

Nginx之https证书配置实现

《Nginx之https证书配置实现》本文主要介绍了Nginx之https证书配置的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起... 目录背景介绍为什么不能部署在 IIS 或 NAT 设备上?具体实现证书获取nginx配置扩展结果验证

C#如何在Excel文档中获取分页信息

《C#如何在Excel文档中获取分页信息》在日常工作中,我们经常需要处理大量的Excel数据,本文将深入探讨如何利用Spire.XLSfor.NET,高效准确地获取Excel文档中的分页信息,包括水平... 目录理解Excel中的分页机制借助 Spire.XLS for .NET 获取分页信息为什么选择 S

Java利用Spire.XLS for Java自动化设置Excel的文档属性

《Java利用Spire.XLSforJava自动化设置Excel的文档属性》一个专业的Excel文件,其文档属性往往能大大提升文件的可管理性和可检索性,下面我们就来看看Java如何使用Spire... 目录Spire.XLS for Java 库介绍与安装Java 设置内置的 Excel 文档属性Java