Exadata中的dbserver_backup.sh脚本
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脚本的更多相关文章
- sh脚本实战
做了什么东西还是要尽快移动到博客上,不然回头看自己写的东西已经看不懂了... 凭着回忆+搜资料,把当初写sh脚本的过程写上来. 首先新建一个.sh文件,用vim就可以 在sh的第一行,写上 #!/bi ...
- 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系统中 ...
- 在Linux中执行.sh脚本,异常
在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...
- ? 原创: 铲子哥 搜狗测试 今天 shell编程的时候,往往不会把所有功能都写在一个脚本中,这样不太好维护,需要多个脚本文件协同工作。那么问题来了,在一个脚本中怎么调用其他的脚本呢?有三种方式,分别是fork、source和exec。 1. fork 即通过sh 脚本名进行执行脚本的方式。下面通过一个简单的例子来讲解下它的特性。 创建father.sh,内容如下: #!/bin/bas
? 原创: 铲子哥 搜狗测试 今天 shell编程的时候,往往不会把所有功能都写在一个脚本中,这样不太好维护,需要多个脚本文件协同工作.那么问题来了,在一个脚本中怎么调用其他的脚本呢?有三种方式,分别 ...
- ubuntu中写sh脚本
批量执行命令 https://jingyan.baidu.com/article/3052f5a121c8ac97f21f8661.html 批量执行脚本也是可行的! 如,main.sh内写 sh ...
- 在Linux中执行.sh脚本,异常/bin/sh^M
在Linux中执行.sh脚本,异常/bin/sh^M 在linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分 ...
- 使用shell程序备份crontab中的.sh脚本文件
需求 线上环境有一些定时脚本(用crontab -l可查看当前用户的),有时我们可能会改这些定时任务的脚本内容.为避免改错无后悔药,需用shell实现一个程序,定时备份crontab中的.sh脚本文件 ...
- ps -ef |grep -v 在shell sh 脚本中貌似无效?
想通过ps -ef |grep erdp_ |awk '{print $2}' 获取 erdp_ 开头的进程id, 执行在终端环境下执行是ok的,但是在 sh 脚本里面竟然多出了 两个 root 11 ...
- Exadata中Infiniband交换机升级
Infiniband交换机的软件补丁包,随着软件版本的不同,其发布方式也有所变化,从如下图表可以看出,1.3.3-2这个版本是一个分水岭,这个版本及以前的版本,补丁包是单独下载的,而之后的版本,inf ...
随机推荐
- 【转】C++11 标准新特性:Defaulted 和 Deleted 函数
原文链接http://www.ibm.com/developerworks/cn/aix/library/1212_lufang_c11new/ 本文将介绍 C++11 标准的两个新特性:defaul ...
- Agc004_C AND Grid
传送门 题目大意 给定一个$N\times M\space(N,M\leq 500)$的网格,有一些格子是紫色,保证边界没有颜色. 构造两个$N\times M$的网格$A,B$,在$A$中染红色在$ ...
- [冬令营模拟]GTSG2018
上学期没有去 GTSG,于是今天老师让我们来做一下 GTSG2018 Day1 & Day3 Day1 在上午当成一场考试来搞了,Day3 由于锅太多而且 T3 玄学而被放到下午自学... 上 ...
- bzoj1006神奇的国度
OrzCDQ您太强辣 #include<iostream> #include<cstdio> #include<cstdlib> #include<algor ...
- SPOJ Query on a tree II (树剖||倍增LCA)(占位)
You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, ...
- uoj problem 10
uoj problem 10 题目大意: 给定任务若干,每个任务在\(t_i\)收到,需要\(s_i\)秒去完成,优先级为\(p_i\) 你采用如下策略: 每一秒开始时,先收到所有在该秒出现的任务,然 ...
- 2440移植内核到uboot上,打印乱码
转载请注明出处:http://blog.csdn.net/qq_26093511/article/details/51851368 可能原因: 1. 修改内核 里的晶振大小 arch\arm\mach ...
- 杭电acm 1022题
Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot o ...
- hadoop-2.3.0-cdh5.1.0伪分布安装(基于centos)
一.环境 操作系统:CentOS 6.5 64位操作系统 注:Hadoop2.0以上采用的是jdk环境是1.7,Linux自带的jdk卸载掉,重新安装 下载地址:http://www.oracle. ...
- Appium 在 Android UI 测试中的应用
原文地址:https://blog.coding.net/blog/Appium-Android-UI Android 测试工具与 Appium 简介 Appium 是一个 C/S 架构的,支持 An ...