Step By Step Oracle Backup on Netbackup
1.find หา tnsname.ora
2.vi tnsname.ora ใส่ rmancatalog ไว้ ที่ท้าย file
RMANCAT = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = backserv)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = rmancat) ) ) |
4.
TNS Ping Utility for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production on 17-NOV-2008 14:20:00 Copyright (c) 1997 Oracle Corporation. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = backserv)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = rmancat))) OK (170 msec) |
6. rman target sys/”Password” rcvcat rman_db/rman_db@rmancat
7. RMAN>register database;
8.jbpSA &
9.
10.
11.
12.
13.
14.
15
16. จากนั้น ก็ ใส่ Template ที่ต้องการ Gen script จาก master
17. cd /usr/openv/netbackup/bin/
18. /bpdbsbora -backup -g /usr/openv/netbackup/ext/db_ext/oracle/hot_ORCL_arc_1.sh -t ORCL_test.tpl
19. script จะอยู่ ใน file /usr/openv/netbackup/ext/db_ext/oracle/hot_ORCL_arc_1.sh
20.จะเป็น Backup แบบ cold backup ของ Oracle หรือ ท่า Database ตัวอื่นก็คือ FULL Backup
21. เข้าไปแก้ script
#!/bin/sh # ----------------------------------------------------------------- # Backup script generated on 11/14/08 19:22:38 # Shell Script name: /usr/openv/netbackup/ext/db_ext/oracle/hot_ORCL_juliet33.sh # # Veritas NetBackup for oracle on UNIX # $VRTScprght: Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved $ # ----------------------------------------------------------------- RMAN_LOG_FILE=/tmp/rman1052732.log # ----------------------------------------------------------------- # Initialize the log file. # ----------------------------------------------------------------- > $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=/app/oracle/product/9.2.0 ORACLE_SID=ORCL TARGET_CONNECT_STR=sys/abc_1234 CATALOG_CONNECT_STR=rman_db/rman_db@rmancat RUN_AS_USER=oracle RMAN=$ORACLE_HOME/bin/rman CUSER=`id | cut -d"(" -f2 | cut -d ")" -f1` # ----------------------------------------------------------------- # The NetBackup script generator determined that a NetBackup Policy # configured for the standard Oracle backup would have been used # when this script was generated. # This script was generated for use with a Policy with the standard # Oracle backup method (i.e. non-proxy). # ----------------------------------------------------------------- # ----------------------------------------------------------------- # For NetBackup scheduled, or server initiated backups, NetBackup # sets an NB_ORA environment variable based on the schedule type. # The NB_ORA variable is then used to dynamically set BACKUP_TYPE. # For example, when: if [ "$NB_ORA_FULL" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=0" elif [ "$NB_ORA_INCR" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=1" elif [ "$NB_ORA_CINC" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE" elif [ "$BACKUP_TYPE" = "" ] then BACKUP_TYPE="INCREMENTAL LEVEL=0" fi # ----------------------------------------------------------------- # rman commands for database ORCL. # ----------------------------------------------------------------- CMD=" ORACLE_HOME=/app/oracle/product/9.2.0 export ORACLE_HOME ORACLE_SID=ORCL export ORACLE_SID $RMAN target $TARGET_CONNECT_STR rcvcat $CATALOG_CONNECT_STR msglog $RMAN_LOG_FILE append <<EOF # ----------------------------------------------------------------- # RMAN command section # ----------------------------------------------------------------- RUN { ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch03 TYPE 'SBT_TAPE'; SEND 'NB_ORA_CLIENT=juliet33,NB_ORA_POLICY=K_juliet33_ORACLE_DB_Daily,NB_ORA_SERV=cobalt2'; BACKUP $BACKUP_TYPE FORMAT 'bk_u%u_s%s_p%p_t%t' DATABASE; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; RELEASE CHANNEL ch02; RELEASE CHANNEL ch03; # Backup Archived Logs # For an offline backup, remove the following sql statement sql 'alter system archive log current'; ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch03 TYPE 'SBT_TAPE'; SEND 'NB_ORA_CLIENT=juliet33,NB_ORA_POLICY=K_juliet33_ORACLE_DB_Daily,NB_ORA_SERV=cobalt2'; BACKUP FORMAT 'arch_u%u_s%s_p%p_t%t' ARCHIVELOG ALL; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; RELEASE CHANNEL ch02; RELEASE CHANNEL ch03; # Control file backup ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; SEND 'NB_ORA_CLIENT=juliet33,NB_ORA_POLICY=K_juliet33_ORACLE_DB_Daily,NB_ORA_SERV=cobalt2'; BACKUP FORMAT 'ctrl_u%u_s%s_p%p_t%t' CURRENT CONTROLFILE; RELEASE CHANNEL ch00; } EOF " if [ "$CUSER" = "root" ] then su - $RUN_AS_USER -c "$CMD" >> $RMAN_LOG_FILE RSTAT=$? else sh -c "$CMD" >> $RMAN_LOG_FILE RSTAT=$? if [ "$RSTAT" = "0" ] then LOGMSG="ended successfully" else LOGMSG="ended in error" fi # ----------------------------------------------------------------- # Log the completion of this script. # ----------------------------------------------------------------- echo >> $RMAN_LOG_FILE echo Script $0 >> $RMAN_LOG_FILE echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE exit $RSTAT |
#!/bin/sh # ----------------------------------------------------------------- # Backup script generated on 11/14/08 19:22:38 # Shell Script name: /usr/openv/netbackup/ext/db_ext/oracle/hot_ORCL_juliet33.sh # # Veritas NetBackup for oracle on UNIX # $VRTScprght: Copyright 1993 - 2007 Symantec Corporation, All Rights Reserved $ # ----------------------------------------------------------------- RMAN_LOG_FILE=/tmp/rman1052732.log # ----------------------------------------------------------------- # Initialize the log file. # ----------------------------------------------------------------- > $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=/app/oracle/product/9.2.0 ORACLE_SID=ORCL TARGET_CONNECT_STR=sys/abc_1234 CATALOG_CONNECT_STR=rman_db/rman_db@rmancat RUN_AS_USER=oracle RMAN=$ORACLE_HOME/bin/rman CUSER=`id | cut -d"(" -f2 | cut -d ")" -f1` # ----------------------------------------------------------------- # The NetBackup script generator determined that a NetBackup Policy # configured for the standard Oracle backup would have been used # when this script was generated. # This script was generated for use with a Policy with the standard # Oracle backup method (i.e. non-proxy). # ----------------------------------------------------------------- # ----------------------------------------------------------------- # For NetBackup scheduled, or server initiated backups, NetBackup # sets an NB_ORA environment variable based on the schedule type. # The NB_ORA variable is then used to dynamically set BACKUP_TYPE. # For example, when: if [ "$NB_ORA_FULL" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=0" elif [ "$NB_ORA_INCR" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=1" elif [ "$NB_ORA_CINC" = "1" ] then BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE" elif [ "$BACKUP_TYPE" = "" ] then BACKUP_TYPE="INCREMENTAL LEVEL=0" fi # ----------------------------------------------------------------- # rman commands for database ORCL. # ----------------------------------------------------------------- CMD=" ORACLE_HOME=/app/oracle/product/9.2.0 export ORACLE_HOME ORACLE_SID=ORCL export ORACLE_SID $RMAN target $TARGET_CONNECT_STR rcvcat $CATALOG_CONNECT_STR msglog $RMAN_LOG_FILE append <<EOF # ----------------------------------------------------------------- # RMAN command section # ----------------------------------------------------------------- # Backup Archived Logs # For an offline backup, remove the following sql statement sql 'alter system archive log current'; ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch02 TYPE 'SBT_TAPE'; ALLOCATE CHANNEL ch03 TYPE 'SBT_TAPE'; SEND 'NB_ORA_CLIENT=juliet33,NB_ORA_POLICY=K_juliet33_ORACLE_DB_Daily,NB_ORA_SERV=cobalt2'; BACKUP FORMAT 'arch_u%u_s%s_p%p_t%t' ARCHIVELOG ALL DELETE INPUT; RELEASE CHANNEL ch00; RELEASE CHANNEL ch01; RELEASE CHANNEL ch02; RELEASE CHANNEL ch03; # Control file backup ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'; SEND 'NB_ORA_CLIENT=juliet33,NB_ORA_POLICY=K_juliet33_ORACLE_DB_Daily,NB_ORA_SERV=cobalt2'; BACKUP FORMAT 'ctrl_u%u_s%s_p%p_t%t' CURRENT CONTROLFILE; RELEASE CHANNEL ch00; } EOF " if [ "$CUSER" = "root" ] then su - $RUN_AS_USER -c "$CMD" >> $RMAN_LOG_FILE RSTAT=$? else sh -c "$CMD" >> $RMAN_LOG_FILE RSTAT=$? if [ "$RSTAT" = "0" ] then LOGMSG="ended successfully" else LOGMSG="ended in error" fi # ----------------------------------------------------------------- # Log the completion of this script. # ----------------------------------------------------------------- echo >> $RMAN_LOG_FILE echo Script $0 >> $RMAN_LOG_FILE echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE exit $RSTAT |
23. ไป Run cross check ใน Rman
24. su – oracle
24.rman target sys/”Password” rcvcat rman_db/rman_db@rmancat
25.RMAN>crosscheck archivelog all;
0 comments:
Post a Comment