DD备份script

来源:互联网 发布:淘宝买家采集 编辑:程序博客网 时间:2024/04/28 06:28
ora_full.sh

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 91 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP off;
run                                                                                     
 {
   allocate channel t1 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   allocate channel t2 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   allocate channel t3 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   allocate channel t4 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   sql 'alter system archive log current';
   backup full filesperset 1                                                           
   format 'ora_%d_%I_%s_%p_%T' database;                                              
   release channel t1;
   release channel t2;
   release channel t3;
   release channel t4;   
}

run {   
   allocate channel t1 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   sql 'alter system archive log current';                                            
   backup filesperset 10
   format 'arch_%d_%I_%s_%p_%T'                                                                
   archivelog all not backed up 1 times skip inaccessible;
   DELETE NOPROMPT ARCHIVELOG UNTIL TIME "SYSDATE-7";
   release channel t1;   
}   
 
run                                                                                     
 {                                                                                   
   allocate channel t1 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   backup format 'cntrl_%s_%p_%T' current controlfile;                                            
   backup spfile format 'spfile_%d_%I_%T_%t.ora';
   release channel t1;
}



ora_log.sh


CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 91 DAYS;
CONFIGURE CONTROLFILE AUTOBACKUP off;
run {   
   allocate channel t1 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   sql 'alter system archive log current';                                            
   backup filesperset 10
   format 'arch_%d_%I_%s_%p_%T'                                                                
   archivelog all not backed up 1 times skip inaccessible;
   DELETE NOPROMPT ARCHIVELOG UNTIL TIME "SYSDATE-7";
   release channel t1;   
}   
 
run                                                                                     
 {                                                                                   
   allocate channel t1 type 'SBT_TAPE';
   send channel t1 'NSR_ENV=(NSR_CLIENT=gps02,NSR_SERVER=bakserver,NSR_DATA_VOLUME_POOL=oraddboostb)';
   backup format 'cntrl_%s_%p_%T' current controlfile;                                            
   backup spfile format 'spfile_%d_%I_%T_%t.ora';
   release channel t1;
}




oracle_gpsdb.cfg


###############################################################################
#
# nmda_oracle.cfg
#
# All rights reserved.
#
# NetWorker Module for Databases and Applications (NMDA) 1.6
#
# This template is designed to help users configure NMDA Oracle scheduled
# backups if the NMC-based configuration wizard is not being used.
# Additional parameters may be added to the file when required.
#
# Check the NMDA administration guide for a complete list of all the supported
# parameters and rules for editing the configuration file.
#
# Make a copy of this file before attempting any modifications.
# To enable a parameter, uncomment or add it and specify its value.
#
###############################################################################


# #############################################################################
#               MANDATORY PARAMETERS (scheduled backups only)
# #############################################################################

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

  #
  # ORACLE_HOME: Location of the Oracle software installation.


# #############################################################################
#               OPTIONAL PARAMETERS (scheduled backups only)
# #############################################################################

ORACLE_SID =gpsdb2
ORACLE_USER =oracle
# NLS_LANG =
NSR_RMAN_ARGUMENTS ="nocatalog target / msglog '/data/bak_shell/oracle_gpsdb.log'"
# TNS_ADMIN =
# PRECMD =
# POSTCMD =
# NSR_NWPATH =
# NSR_DIRECT_ACCESS =


  #
  # ORACLE_SID:             SID of the Oracle database being backed up.
  #                         Required for proxy copy catalog synchronization, or
  #                         when the parameter ORACLE_USER is set, or
  #                         NSR_INCR_EXPIRATION or NSR_BUNDLING is enabled.
  # ORACLE_USER:            UNIX or Linux only. An operating system username to
  #                         be used for Oracle operating system authentication.
  # NLS_LANG:               Sets the language, territory, and character set
  #                         used by Oracle database.
  # NSR_RMAN_ARGUMENTS:     Provides extra RMAN parameters. Value must be
  #                         enclosed in quotes. For example: "nocatalog".
  # TNS_ADMIN:              Set if the Oracle Net configuration files are not
  #                         in the default location. Pathname of the directory
  #                         location.
  # PRECMD:                 Full pathname of a command script to be run before
  #                         a scheduled backup. If the PRECMD script fails, the
  #                         backup does not run.
  # POSTCMD:                Full pathname of a command script to be run after a
  #                         scheduled backup. If the POSTCMD script fails, a
  #                         warning message is printed but the backup succeeds.
  # NSR_NWPATH:             Pathname that contains the NetWorker binaries. May
  #                         be needed for Avamar deduplication backups.
  # NSR_DIRECT_ACCESS:      Yes, No or Default (default). Yes enforces the
  #                         Direct File Access(DFA) method. No does not
  #                         attempt DFA at all. Default(recommended) tries
  #                         DFA and falls back to traditional methods if DFA
  #                         cannot be used.


# #############################################################################
#               OPTIONAL PARAMETERS (manual backups only)
# #############################################################################




# #############################################################################
#               DEBUG PARAMETERS (for troubleshooting)
# #############################################################################

# NSR_DEBUG_LEVEL =
# NSR_DIAGNOSTIC_DEST =

  #
  # NSR_DEBUG_LEVEL:     0-9.
  # NSR_DIAGNOSTIC_DEST: /nsr/apps/logs (default). Location of the debug logs.
0 0