NBU7.5备份oracle

  • 格式:docx
  • 大小:151.41 KB
  • 文档页数:16

1、 建立连接

[root@localhost ~]#su - oracle

[oracle@localhost ~]$ cd /usr/openv/netbackup/bin

[oracle@localhost bin]$ ./oracle_link

2012年 08月 25日星期六 09:43:28 CST

All Oracle instances should be shutdown before running this script.

Please log into the Unix system as the Oracle owner for running this script

Do you want to continue? (y/n) [n] y

LIBOBK path: /usr/openv/netbackup/bin

ORACLE_HOME: /orcl/oracle

Oracle version: 10.2.0.1.0

Platform type: i686

Linking LIBOBK:

ln -s /usr/openv/netbackup/bin/libobk.so /orcl/oracle/lib/libobk.so

Done

Please check the trace file located in /tmp/make_trace.4459

to make sure the linking process was successful.

2、 创建备份脚本

[root@localhost ~]# mkdir -p /usr/openv/netbackup/script

[root@localhost ~]#cd /usr/openv/netbackup/ext/db_ext/oracle/samples/rman

[root@localhostrman]# ls

cold_database_backup.sh database_restore.sh

hot_tablespace_backup.sh

cold_duplex_database_backup_full.sh hot_database_backup.sh

pit_database_restore.sh

[root@localhostrman]# cp hot_database_backup.sh /usr/openv/netbackup/script/

[root@localhostrman]# cd /usr/openv/netbackup/script/

[root@localhost script]# ls

hot_database_backup.sh

[root@localhost script]#mv hot_database_backup.sh rman.sh

[root@localhost script]#chmodo+x rman.sh

[root@localhost script]#vi rman.sh

#!/bin/sh

# $Header: hot_database_backup.sh,v 1.2 2002/08/06 23:51:42 $

#

#bcpyrght

#*************************************************************************** #* $VRTScprght: Copyright 1993 - 2008 Symantec Corporation, All Rights Reserved $ *

#***************************************************************************

#ecpyrght

#

# ---------------------------------------------------------------------------

# hot_database_backup.sh

# ---------------------------------------------------------------------------

# This script uses Recovery Manager to take a hot (inconsistent) database

# backup. A hot backup is inconsistent because portions of the database are

# being modified and written to the disk while the backup is progressing.

# You must run your database in ARCHIVELOG mode to make hot backups. It is

# assumed that this script will be executed by user root. In order for RMAN

# to work properly we switch user (su -) to the oracle dba account before

# execution. If this script runs under a user account that has Oracle dba

# privilege, it will be executed using this user's account.

# ---------------------------------------------------------------------------

# ---------------------------------------------------------------------------

# 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

# ---------------------------------------------------------------------------

# Replace /db/oracle/product/ora81, below, with the Oracle home path.

# ---------------------------------------------------------------------------

ORACLE_HOME=/u01/app/oracle/product/11.2.0/

export ORACLE_HOME

Oracle HOME目录,可通过env命令查出

# ---------------------------------------------------------------------------

# Replace ora81, below, with the Oracle SID of the target database.

# ---------------------------------------------------------------------------

ORACLE_SID=orcl

export ORACLE_SID

Oracle实例名

# ---------------------------------------------------------------------------

# Replace ora81, below, with the Oracle DBA user id (account).

# ---------------------------------------------------------------------------