Veeam backup and replication 备份oracle 数据库,通过调用rman api 接口,简化了oracle 数据库备份与恢复,这里主要介绍oracle for linux x64 平台。
首先,在目标服务器上安装veeam rman veeam plugin,并进行配置,插件可以在veeam iso 镜像中找到,我们使用rpm格式的安装包。
在服务器上安装插件:
rpm –ivh VeeamPluginforOracleRMAN-11.0.101.1264-1.x86_64.rpm
安装完成后,进行配置:
1、/etc/hosts 文件中增加veeam 备份主机ip地址与主机名映射关系;
2、配置到veeam 备份主机的备份存储库:
# /opt/veeam/VeeamPluginforOracleRMAN/OracleRMANConfigTool –wizard
Enter backup server name or IP address [veeam-br]:
Enter backup server port number [10006]:
Enter username [Administrator]:
Enter password for Administrator [(do not change the existing password)]:
Available backup repositories:
1. Default Backup Repository
2. Veeam-Backup-Repository-DB
Specify up to 4 Veeam repositories to use as target using whitespace as a separator [2]:
Enter the number of data streams (From 1 to 254) to run in parallel for each repository (RMAN DEVICE PARALLELISM value). Channel count per device [4]:
Do you want to use Veeam compression? (y/N): n
Failed to connect to the following Oracle instances:
ORACLE_SID=testdb ORACLE_HOME=/u01/app/oracle/product/21.3.0/db_1
Please apply the following RMAN settings manually:
CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;
CONFIGURE CHANNEL DEVICE TYPE SBT_TAPE
PARMS 'SBT_LIBRARY=/opt/veeam/VeeamPluginforOracleRMAN/libOracleRMANPlugin.so'
FORMAT '82771617-f2bb-4dd0-ac06-ba1597aef922/RMAN_%I_%d_%T_%U.vab';
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1;
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 4;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F_RMAN_AUTOBACKUP.vab';
Channel definition for RMAN scripts:
ALLOCATE CHANNEL VeeamAgentChannel1 DEVICE TYPE SBT_TAPE
PARMS 'SBT_LIBRARY=/opt/veeam/VeeamPluginforOracleRMAN/libOracleRMANPlugin.so'
FORMAT '82771617-f2bb-4dd0-ac06-ba1597aef922/RMAN_%I_%d_%T_%U.vab';
Save configuration?
1. Apply configuration to the Oracle environment
2. Export configuration into a file for manual setup
3. Cancel without saving
Enter: 1
3、使用oracle rman veeam plugin 备份数据库,脚本如下:
#!/bin/bash
source /home/oracle/.bash_profile
TODAY_TAG=`date +%Y_%m_%d`
YESTERDAY_TAG=`date +%Y_%m_%d --date=-1day`
BEFORE_YESTERDAY_TAG=`date +%Y_%m_%d --date=-2day`
KEEPDAY_TAG=`date +%Y_%m_%d --date=-1day`
dbname=testdb
$ORACLE_HOME/bin/rman target / msglog /var/log/rmanbk/${dbname}_fullback_${TODAY_TAG}.log<<EOF
run{
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate-7';
crosscheck backup;
delete noprompt expired backup;
backup as compressed backupset database format '82771617-f2bb-4dd0-ac06-ba1597aef922/RMAN_DATA_%I_%d_%T_%U.vab';
sql 'alter system archive log current';
backup as compressed backupset filesperset 10 format '82771617-f2bb-4dd0-ac06-ba1597aef922/RMAN_ARCH_%I_%d_%T_%U.vab' archivelog all not backed up 1 times;
backup current controlfile format '82771617-f2bb-4dd0-ac06-ba1597aef922/RMAN_CTL_%I_%d_%T_%U.vab';
report obsolete;
delete noprompt obsolete;
}
EOF
82771617-f2bb-4dd0-ac06-ba1597aef922 表示veeam 备份存储库Veeam-Backup-Repository-DB标识id,可以在/opt/veeam/VeeamPluginforOracleRMAN/veeam_config.xml 配置文件中找到。
4、使用oracle rman veeam plugin 恢复数据库,脚本如下:
恢复到原来的服务器:
rman TARGET /
set dbid=1550858067;
RUN {
ALLOCATE VeeamRestorech00 DEVICE TYPE sbt_tape PARMS "SBT_LIBRARY=/opt/veeam/VeeamPluginforOracleRMAN/libOracleRMANPlugin.so";
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F_RMAN_AUTOBACKUP.vab';
restore spfile from autobackup;
restore controlfile from autobackup;
RELEASE CHANNEL VeeamRestorech00;
}
RUN {
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
RESTORE DATABASE;
RECOVER DATABASE;
}
su – oracle
sqlplus / as sysdba
alter database open resetlogs;
恢复到另外一台服务器:
首先在/opt/veeam/VeeamPluginforOracleRMAN/veeam_config.xml 配置文件增加如下参数条目
<PluginParameters customServerName="original_server_hostname" />
original_server_hostname 为原来服务器主机名,如果是rac 数据库,original_server_hostname 为源服务器rac 数据库scan 名称,服务器主机名或者scan名称需提前在/etc/hosts 文件中定义名称、ip映射关系,也可以在恢复脚本中使用send 指令 SEND "srcSrv=original_server_hostname "表示异机恢复。
提前准备好参数文件,将数据库实例启动到nomount 状态,使用rman 工具进行恢复作业:
rman TARGET /
set dbid=1550858067;
RUN {
ALLOCATE CHANNEL VeeamRestorech00 DEVICE TYPE sbt_tape PARMS "SBT_LIBRARY=/opt/veeam/VeeamPluginforOracleRMAN/libOracleRMANPlugin.so";
SEND "srcSrv=original_server_hostname";
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO '%F_RMAN_AUTOBACKUP.vab';
RESTORE controlfile FROM autobackup;
RELEASE CHANNEL VeeamRestorech00;
}
alter database mount;
RUN {
ALLOCATE CHANNEL VeeamRestorech00 DEVICE TYPE sbt_tape PARMS 'SBT_LIBRARY=/opt/veeam/VeeamPluginforOracleRMAN/libOracleRMANPlugin.so' SEND "srcSrv=original_server_hostname";
restore database;
recover database;
RELEASE CHANNEL VeeamRestorech00;
}
su – oracle
sqlplus / as sysdba
alter database open resetlogs;
标签:RMAN,SBT,DEVICE,Oracle,rman,veeam,TYPE,_% From: https://www.cnblogs.com/oradba/p/16899567.html