m6米乐安卓版下载-米乐app官网下载
暂无图片
9
暂无图片
暂无图片
暂无图片

nbu备份oracle数据库详细配置文档 -m6米乐安卓版下载

原创 潇湘秦 2023-09-06
873

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

下载安装档

选择产品和版本号

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

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

之后就会正常安装

补充 如果安装客户端是没有输入token,则在管理台无法看到该host,可以使用如下命令手动导入token

cd /usr/openv/netbackup/bin

./nbcertcmd -getcacertificate

./nbcertcmd -getcertificate -force -token token_num


  1. 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

#***************************************************************************

# $米乐app官网下载 copyright: 米乐app官网下载 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 -x

fi

# ---------------------------------------------------------------------------

# 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_file

chmod 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 sigstop

mkfifo "$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}"

fi

fi

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}"

fi

fi

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}"

fi

fi

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_home

export oracle_sid=$oracle_sid

echo

echo ----- subshell env variables -----

echo

env | 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="<< eof

show all;

run {

allocate channel ch00 type 'sbt_tape' $rman_sbt_library_parms;

allocate channel ch01 type 'sbt_tape' $rman_sbt_library_parms;

$rman_send

backup

$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 logs

allocate channel ch00 type 'sbt_tape' $rman_sbt_library_parms;

allocate channel ch01 type 'sbt_tape' $rman_sbt_library_parms;

$rman_send

backup

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_send

backup

# 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

echo

fi

echo

echo "----- script variables -----"

echo

set | sort | egrep '^oracle_|^nb_ora_|^rman_|^backup_|^tns_'

echo

echo "----- rman cmd -----"

echo

echo "$cmds"

echo

echo "----- rman input -----"

echo

echo "$cmd_input"

echo

# sanity check the environment.

if [ ! -x $rman_executable ]; then

echo "err: $rman_executable: required executable not found!" 1>&2

exit 1

fi

if [ ! -f `echo $rman_sbt_library | cut -d'(' -f1` ]; then

echo "err: $rman_sbt_library: required library not found!" 1>&2

exit 1

fi

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

echo

echo "==== $0 $logmsg on `date` ==== stdout"

echo "==== $0 $logmsg on `date` ==== stderr" 1>&2

echo

exit $rstat

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

active monitor 查看备份任务的状态

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

  1. 常见报错处理
    1. bpcd 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.101

aliases: db1 10.245.40.10

[~]# /usr/openv/netbackup/bin/bpclntcmd -clear_host_cache ##可以清理一下cache 再重新获取

successfully cleared host cache

successfully cleared generic cache

3.2 error 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.conf

server = cscn01bak01

server = csaslbak02 ##media服务器没有加入到该配置文件

client_name = db1

connect_options = localhost 1 0 2

[root@db1 netbackup]#

验证办法:

media服务端验证client的连接性

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

修改bp.conf添加media服务器

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

最后修改时间:2023-10-10 14:25:18
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图