dbserver_backup.sh脚本在老版本的exadata中,它存放在/opt/oracle.SupportTools目录中,主要用于/根文件系统和/boot分区的备份。dbserver_backup.sh脚本是将/根文件的内容复制至另外一个大小与根分区完全一样的其它分区中。

随着Exadata软件版本的不断更新,dbserver_backup.sh脚本同时也包含在计算节点的升级工具中,通常计算节点升级前的检查阶段,会自动地调用dbserver_backup.sh脚本完成操作系统的备份工作。

 

dbserver_backup.sh脚本进行系统备份的前提条件:

1、计算节点的文件系统使用基于LVM的管理方式,除了/boot分区。

2、操作系统系统中应该存在一个大小与/ 根分区完全一致的其它分区,如果不存在这样一个分区,则vg中必须还有足够的剩余空间来创建这样的一个分区。

 

下面,我们来看看dbserver_backup.sh脚本的参数说明:

[root@ggdb01 11.2.3.2.1]# ./dbserver_backup.sh -h

 

Usage: ./dbserver_backup.sh [--backup-to-partition <1|2>] [-help], where options

 

no options - create backup of active /dev/mapper/VGExaDb-LVDbSys1 partition

on /dev/mapper/VGExaDb-LVDbSys2 partition

 

--backup-to-partition - either 1 or 2 (default). Overwrite default behavior. Create backup of active partition on the provided backup partition.

 

-help - print this info

 

[root@ggdb01 11.2.3.2.1]#

从以上的脚本参数说明,基本上也可以看出dbserver_backup.sh脚本的主要作用是将/dev/mapper/VGExaDb-LVDbSys1分区的数据备份至/dev/mapper/VGExaDb-LVDbSys2分区。

 

说明:

1、如果使用dbserver_backup.sh脚本进行系统备份,则必须先检查是否存在非本地文件系统,也即是否存在NFS文件系统,如果存在,则必须先umount掉NFS文件系统。否则备份会失败。

2、检查是否存在LVDbSys1和LVDbSys2两个分区,如果不存在LVDbSys2分区,则必须检查VG中是否有足够的剩余空间来备份操作系统。

3、操作系统中的LV命名,只允许存在两个以"LVDBSys "开头的LV,也即LVDBSys1和LVDBSys2。

 

(1)、手动直接调用dbserver_backup.sh脚本:

[root@dw01db01 ~]# chmod +x /u01/patches/linux_patches/p13741363_112321_Linux-x86-64/13741363/11.2.3.2.1/dbserver_backup.sh

[root@dw01db01 ~]# sh /u01/patches/linux_patches/p13741363_112321_Linux-x86-64/13741363/11.2.3.2.1/dbserver_backup.sh

以下信息是dbserver_backup.sh脚本备份生成的日志:

[INFO] Start to backup root /dev/VGExaDb/LVDbSys1 and boot partitions

[INFO] Check for Volume Group "VGExaDb"

[INFO] Check for the LVM root partition "VGExaDb/LVDbSys1"

[INFO] The active root partition /dev/VGExaDb/LVDbSys1 has proper label DBSYS

[INFO] The backup partition /dev/VGExaDb/LVDbSys2 has no label

[INFO] Root file system is mounted to /dev/mapper/VGExaDb-LVDbSys1

[INFO] LVM root partition size: 30.00G (62914560S)

[INFO] Total amount of free space: 202.80G (425304064S)

[INFO] Create spare root partition in Volume Group "VGExaDb"

Logical volume "LVDbSys2" created

[INFO] Create ext3 file system on spare root partition /dev/VGExaDb/LVDbSys2

[INFO] Mount spare root partition /dev/VGExaDb/LVDbSys2 to /mnt_spare

[INFO] Create LVM snapshot with 1Gb size of the root partition /dev/VGExaDb/LVDbSys1

Logical volume "LVDbSys1Snap" created

[INFO] Mount snapshot partition /dev/VGExaDb/LVDbSys1Snap to /mnt_snap

[INFO] Clone data from the snapshot to the spare root partition

………(略)

[INFO] Unmount snapshot partition /mnt_snap

[INFO] Remove snapshot partition /dev/VGExaDb/LVDbSys1Snap

Logical volume "LVDbSys1Snap" successfully removed

[INFO] Save partition table of /dev/sda in /mnt_spare/part_table_backup.txt

[INFO] Save lvm info in /mnt_spare/lvm_info.txt

[INFO] Unmount spare root partition /mnt_spare

[INFO] Backup of root /dev/VGExaDb/LVDbSys1 and boot partitions is done successfully

[INFO] Backup partition is /dev/VGExaDb/LVDbSys2

[INFO] /boot area back up named boot_backup.tbz (tar.bz2 format) is on the /dev/VGExaDb/LVDbSys2 partition.

[INFO] No other partitions were backed up. You may manually prepare back up for other partitions.

[root@dw01db02 oracle.SupportTools]#

从以上的日志我们可以看出,dbserver_backup.sh脚本其实也是利用Linux操作系统的LVM snapshot技术进行的/ 根文件系统备份,最后再将/boot文件系统中的数据备份成boot_backup.tbz文件放在LVDbSys2中。

 

(2)、升级工具调用dbserver_backup.sh脚本:

在计算节点升级工具的不断演变过程中,dbserver_backup.sh脚本也融合到计算节点的升级工具内,可以直接执行升级工具来调用dbserver_backup.sh脚本。

下面,我们以计算节点最新的升级工具patchmgr为例,展示计算节点的升级工具对dbserver_backup.sh脚本的调用。

[root@ggdb01 dbserver_patch_5.170123]# ./patchmgr -h

Usage:

./patchmgr -dbnodes <database_node_list_file>

-backup (yum_repo <baseurl> | -iso_repo <zipped_iso_file>) [-target_version version] [-rolling] [-unkey] |

-precheck (yum_repo <baseurl> | -iso_repo <zipped_iso_file>) [-target_version version] [-unkey] |

-upgrade (yum_repo <baseurl> | -iso_repo <zipped_iso_file>) [-target_version version] [-rolling] [-unkey] |

-rollback [-rolling] [-unkey]

-cleanup [-unkey]

 

MANDATORY PARAMETER

 

-dbnodes db_nodes_list_file

Specifies the name of the database node(s) list file. The file has one

hostname or ip per line.

 

ACTIONS

 

-backup

Perform backup only the database node(s) specified in the host list.

Runs backup in non-rolling fashion unless -rolling option is specified.

而查看patchmgr工具脚本,可以看出,真正进行升级工作的还是dbnodeupdate.sh升级工具,patchmgr工具脚本只是做了一些封装而已,继续查看dbnodeupdate.sh升级工具的代码。

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

# PROCEDURE : PrepBackup

# INPUT :

# DESCRIPTION :

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

PrepBackup()

{

local v_record_timings="No"

local v_func_call=${FUNCNAME}

DiaryEntry "${v_func_call}" "Enter" "${v_record_timings}" ${FUNCNAME}

 

v_to_release_maj=`echo ${v_to_release} 2>/dev/null | cut -d \. -f1-5`

# 24784563

# 24826294

 

# When image -ge 121233 we assume we can run dbserver_backup.sh from /opt/oracle.SupportTools

if [ ${v_current_image_id_maj} -ge 121233 ]

then

v_dbserver_backup_sh="/opt/oracle.SupportTools/dbserver_backup.sh"

if ! [ -f "${v_dbserver_backup_sh}" ]

then

# If the file is removed - then just grab the latest one shipping with the helpers

v_dbserver_backup_sh="${v_dbupdate_helpers_loc}/12.1.2.3.2/dbserver_backup.sh"

fi

else

# 24826294 - Images older than 121233 and newer or equal to 112310 can use the one shipping with helpers

if [ ${v_current_image_id_maj} -lt 121233 ] && [ ${v_current_image_id_maj} -ge 112310 ]

then

local v_current_image_version_maj=$(echo ${v_current_image_version} | cut -d \. -f1-5)

v_dbserver_backup_sh="${v_dbupdate_helpers_loc}/${v_current_image_version_maj}/dbserver_backup.sh"

else

if [ ${v_current_image_id_maj} -lt 112310 ]

then

# On 11.2.2.4.2 this script seems missing by default - this may happen on other older images.

# For those cases where this script is missing : just use the one from a release later

v_dbserver_backup_sh="${v_dbupdate_helpers_loc}/11.2.3.1.0/dbserver_backup.sh"

fi

fi

fi

从这部分代码可以看出,所有的计算节点升级工具,在升级前的操作系统备份工作都是调用的dbserver_backup.sh脚本。

Exadata中的dbserver_backup.sh脚本的更多相关文章

  1. sh脚本实战

    做了什么东西还是要尽快移动到博客上,不然回头看自己写的东西已经看不懂了... 凭着回忆+搜资料,把当初写sh脚本的过程写上来. 首先新建一个.sh文件,用vim就可以 在sh的第一行,写上 #!/bi ...

  2. Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。

    在Linux中运行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  3. 在Linux中执行.sh脚本,异常

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  4. ? 原创: 铲子哥 搜狗测试 今天 shell编程的时候,往往不会把所有功能都写在一个脚本中,这样不太好维护,需要多个脚本文件协同工作。那么问题来了,在一个脚本中怎么调用其他的脚本呢?有三种方式,分别是fork、source和exec。 1. fork 即通过sh 脚本名进行执行脚本的方式。下面通过一个简单的例子来讲解下它的特性。 创建father.sh,内容如下: #!/bin/bas

    ? 原创: 铲子哥 搜狗测试 今天 shell编程的时候,往往不会把所有功能都写在一个脚本中,这样不太好维护,需要多个脚本文件协同工作.那么问题来了,在一个脚本中怎么调用其他的脚本呢?有三种方式,分别 ...

  5. ubuntu中写sh脚本

    批量执行命令 https://jingyan.baidu.com/article/3052f5a121c8ac97f21f8661.html 批量执行脚本也是可行的! 如,main.sh内写   sh ...

  6. 在Linux中执行.sh脚本,异常/bin/sh^M

    在Linux中执行.sh脚本,异常/bin/sh^M 在linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分 ...

  7. 使用shell程序备份crontab中的.sh脚本文件

    需求 线上环境有一些定时脚本(用crontab -l可查看当前用户的),有时我们可能会改这些定时任务的脚本内容.为避免改错无后悔药,需用shell实现一个程序,定时备份crontab中的.sh脚本文件 ...

  8. ps -ef |grep -v 在shell sh 脚本中貌似无效?

    想通过ps -ef |grep erdp_ |awk '{print $2}' 获取 erdp_ 开头的进程id, 执行在终端环境下执行是ok的,但是在 sh 脚本里面竟然多出了 两个 root 11 ...

  9. Exadata中Infiniband交换机升级

    Infiniband交换机的软件补丁包,随着软件版本的不同,其发布方式也有所变化,从如下图表可以看出,1.3.3-2这个版本是一个分水岭,这个版本及以前的版本,补丁包是单独下载的,而之后的版本,inf ...

随机推荐

  1. 【LeetCode】018 4Sum

    题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = ...

  2. 系列文章--AJAX技术系列总结

    各种AJAX方法的使用比较 用ASP.NET写个SQLSERVER的小工具  写自己的ASP.NET MVC框架(下)  写自己的ASP.NET MVC框架(上)  用Asp.net写自己的服务框架  ...

  3. [转]由Tencent://Message协议想到的一个解决方案

    源代码下载:http://files.cnblogs.com/phinecos/HelloWorldProtocal.rar 前天在BruceZhang的一篇博文<求助:如何在ASP页面中调用W ...

  4. form+iframe实现ajax文件上传

    在做文件上传时除了传入文件外,还有附件参数,并且要求不刷新页面,之前是表单提交的方式,现在修改成ajax上传的方式,由于没有选择用插件,所以用form+iframe的方式,并且这种方式对IE8以上及主 ...

  5. 我的SIP开发之路

    http://hi.baidu.com/ltlovelty/blog/item/837baf1ece7fc6f11ad57647.html 经过对SIP协议和开源协议栈快半年的研究,我现在终于有点入门 ...

  6. PG peered实验

    标签(空格分隔): ceph,ceph实验,pg 1. 创建一个文件,并把该文件作为对象放到集群中: [root@node1 ~]# echo "this is test! " & ...

  7. AD9 如何画4层pcb板

    新建的PCB文件默认的是2层板,教你怎么设置4层甚至更多层板. 在工具栏点击Design-->Layer Stack Manager.进入之后显示的是两层板,添加为4层板,一般是先点top la ...

  8. ES6学习之Set和Map

    一.Set 1.Set 定义:Set类似于数组,但成员的值都是唯一的,没有重复的值 let s = new Set([1,2,3,4,5,2,4]); //Set { 1, 2, 3, 4, 5 } ...

  9. DataTable列查询加排序

    DataTable列查询加排序 DataRow[] drArray = dt.Select("ANLYCOM_ID='" + chSPrdtStblAnly.AnlyComId + ...

  10. 关于Confusion Matrix

    from sklearn.metrics import confusion_matrixy_true = [2, 0, 2, 2, 0, 1]y_pred = [0, 0, 2, 2, 0, 2]pr ...