当前位置:网站首页>Oracle RMAN semi automatic recovery script restore phase
Oracle RMAN semi automatic recovery script restore phase
2022-07-02 07:05:00 【Virtuous time】
#!/bin/bash
##############################################
#NAME: rman_auto_restore.sh
#DESC:restore oracle db from prod environment to test environment very quickly.
#Note: Linux USER - execute as oracle instance user
#History:
# v1.0 2022-03-08 yangshixian
##############################################
. /home/${USER}/.bash_profile
#
#define Oracle env To configure EBS environment variable
#
export PATH=/data/ebs/sit/db/tech_st/11.2.0/perl/bin:/data/ebs/sit/db/tech_st/11.2.0/bin:$PATH
export PERL5LIB=/data/ebs/sit/db/tech_st/11.2.0/perl/lib/5.10.0:/data/ebs/sit/db/tech_st/11.2.0/perl/lib/site_perl/5.10.0:/data/ebs/sit/db/tech_st/11.2.0/appsutil/perl
export ORACLE_SID=PROD # in the light of linux The instance name in the configuration file of is case sensitive
export ORACLE_HOME=/data/ebs/sit/db/tech_st/11.2.0
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#
#rman env conf To configure rman environment variable #
#
RMAN_BAK_PATH=/data1/backup/rman_bak_data/
RMAN_CONTROLFILE=`ls $RMAN_BAK_PATH | grep C0_ |head -1`
TARGET_DATA_FILE_PATH=/data/ebs/sit/db/apps_st/data
#
#unmount:execute rman restore scripts
#
echo "restore controlfile begin ..."
rman target / <<EOF run { startup nomount; RESTORE CONTROLFILE FROM '$RMAN_BAK_PATH$RMAN_CONTROLFILE'; alter database mount; catalog start with '$RMAN_BAK_PATH' noprompt; } exit EOF
echo "restore controlfile end Status $?"
#
#mount:execute rman restore scripts
#
echo "gen restore rman_scripts begin ...."
sqlplus -s / as sysdba <<EOF set heading off feed off verify off echo off pages 0 trimspool on set lines 132 pagesize 0 spo restore.rman select 'run{' from dual; select 'set newname for datafile ' || file# || ' to '|| '''' || '$TARGET_DATA_FILE_PATH' || substr(name,INSTR(name,'/',-1,1)) || '''' || ';' from v\$datafile; select 'restore database;' || chr(10) || 'switch datafile all;' || chr(10) || '}' from dual; spo off exit; EOF
echo "gen restore rman_scripts end status $?"
echo "begin rman restore ....."
echo `date`
rman target / log rman_auto_restore_`date -I`.log @restore.rman
echo "begin rman restore over! status: $?"
echo `date`
边栏推荐
- Ingress Controller 0.47.0的Yaml文件
- ORACLE 11.2.0.3 不停机处理SYSAUX表空间一直增长问题
- sqli-labs通关汇总-page3
- Stack (linear structure)
- Vscode installation, latex environment, parameter configuration, common problem solving
- Thinkphp5中一个字段对应多个模糊查询
- php中判断版本号是否连续
- mapreduce概念和案例(尚硅谷学习笔记)
- ORACLE 11G利用 ORDS+pljson来实现json_table 效果
- How to call WebService in PHP development environment?
猜你喜欢

Latex compiles Chinese in vscode and solves the problem of using Chinese path

ORACLE EBS 和 APEX 集成登录及原理分析

Explanation and application of annotation and reflection

IDEA2020中测试PySpark的运行出错

SQLI-LABS通关(less6-less14)

Go package name

Sqli labs customs clearance summary-page3

Sqli labs customs clearance summary-page4

In depth study of JVM bottom layer (3): garbage collector and memory allocation strategy

Sublime text configuring PHP compilation environment
随机推荐
sqli-labs通關匯總-page2
js删除字符串的最后一位
Oracle APEX 21.2 installation et déploiement en une seule touche
Review of reflection topics
Go package name
在php的开发环境中如何调取WebService?
Oracle rman自动恢复脚本(生产数据向测试迁移)
Network security -- intrusion detection of emergency response
The table component specifies the concatenation parallel method
ORACLE EBS ADI 开发步骤
The default Google browser cannot open the link (clicking the hyperlink does not respond)
2021-07-17C#/CAD二次开发创建圆(5)
Overload global and member new/delete
Sqli-labs customs clearance (less15-less17)
php中树形结构转数组(拉平树结构,保留上下级排序)
Self study table Au
搭建frp进行内网穿透
JS judge whether the object is empty
Sqli-labs customs clearance (less6-less14)
Latex error: the font size command \normalsize is not defined problem solved