Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement RMAN full backup and incremental backup shell script under Linux platform

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to achieve RMAN full and incremental backup shell script under the Linux platform, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

Full script

Take the nocatalog mode as an example:

Shell script:

#

# # hot_database_backup.sh # #

# # created by Tianlesoftware # #

# # 2010-7-16 # #

#

#! / bin/sh

#-

# Determine the user which is executing this script.

#-

CUSER= `id | cut-d "("-f2 | cut-d ")"-f1`

#-

# Put output in .out. Change as desired.

# Note: output directory requires write permission.

#-

RMAN_LOG_FILE=$ {0} .out

#-

# You may want to delete the output file so that backup information does

# not accumulate. If not, delete the following lines.

#-

If [- f "$RMAN_LOG_FILE"]

Then

Rm-f "$RMAN_LOG_FILE"

Fi

#-

# Initialize the log file.

#-

Echo > > $RMAN_LOG_FILE

Chmod 666 $RMAN_LOG_FILE

#-

# Log the start of this script.

#-

Echo Script $0 > > $RMAN_LOG_FILE

Echo = started on `date` = > > $RMAN_LOG_FILE

Echo > > $RMAN_LOG_FILE

#-

# Oracle home path.

#-

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1

Export ORACLE_HOME

#-

# the Oracle SID of the target database.

#-

ORACLE_SID=orcl

Export ORACLE_SID

#-

# The Oracle DBA user id (account).

#-

ORACLE_USER=oracle

Export ORACLE_USER

#-

# Set the Oracle Recovery Manager name.

#-

RMAN=$ORACLE_HOME/bin/rman

#-

# Print out the value of the variables set by this script.

#-

Echo > > $RMAN_LOG_FILE

Echo "RMAN: $RMAN" > > $RMAN_LOG_FILE

Echo "ORACLE_SID: $ORACLE_SID" > > $RMAN_LOG_FILE

Echo "ORACLE_USER: $ORACLE_USER" > > $RMAN_LOG_FILE

Echo "ORACLE_HOME: $ORACLE_HOME" > > $RMAN_LOG_FILE

#-

# Print out the value of the variables set by bphdb.

#-

# echo > > $RMAN_LOG_FILE

# echo "NB_ORA_FULL: $NB_ORA_FULL" > > $RMAN_LOG_FILE

# echo "NB_ORA_INCR: $NB_ORA_INCR" > > $RMAN_LOG_FILE

# echo "NB_ORA_CINC: $NB_ORA_CINC" > > $RMAN_LOG_FILE

# echo "NB_ORA_SERV: $NB_ORA_SERV" > > $RMAN_LOG_FILE

# echo "NB_ORA_POLICY: $NB_ORA_POLICY" > > $RMAN_LOG_FILE

#-

# NOTE: This script assumes that the database is properly opened. If desired

# this would be the place to verify that.

#-

Echo > > $RMAN_LOG_FILE

#-

#-

# Call Recovery Manager to initiate the backup.

#-

CMD_STR= "

ORACLE_HOME=$ORACLE_HOME

Export ORACLE_HOME

ORACLE_SID=$ORACLE_SID

Export ORACLE_SID

$RMAN nocatalog target sys/admin msglog $RMAN_LOG_FILE append

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report