当前位置:网站首页>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`
边栏推荐
- SQLI-LABS通关(less2-less5)
- JS divides an array into groups of three
- How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
- Sublime text configuring PHP compilation environment
- ORACLE EBS ADI 开发步骤
- Redis -- cache breakdown, penetration, avalanche
- Uniapp introduces local fonts
- php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
- ORACLE APEX 21.2安裝及一鍵部署
- Yolov5 practice: teach object detection by hand
猜你喜欢
User login function: simple but difficult
SQLI-LABS通關(less6-less14)
Check log4j problems using stain analysis
SQL注入闭合判断
Sqli-labs customs clearance (less1)
The boss said: whoever wants to use double to define the amount of goods, just pack up and go
Take you to master the formatter of visual studio code
Explanation and application of annotation and reflection
flex九宫格布局
Network security -- intrusion detection of emergency response
随机推荐
js把一个数组分割成每三个一组
sqli-labs通关汇总-page3
Flex Jiugongge layout
Sqli labs customs clearance summary-page4
ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用
js判断数组中对象是否存在某个值
php中计算两个日期之前相差多少天、月、年
SQLI-LABS通关(less1)
uniapp引入本地字体
php中的数字金额转换大写数字
Eslint configuration code auto format
[leetcode question brushing day 35] 1060 Missing element in ordered array, 1901 Find the peak element, 1380 Lucky number in matrix
Sqli Labs clearance summary - page 2
Review of reflection topics
Take you to master the formatter of visual studio code
Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
Sqli-labs customs clearance (less2-less5)
Build FRP for intranet penetration
Queue (linear structure)
php中根据数字月份返回月份的英文缩写