cancel
Showing results for 
Search instead for 
Did you mean: 

Problems running Oracle Backup

arctics2
Level 5

We are trying to configure a Oracle client backup, but having some issues.  When running the script from the machine manually, the backup initiates successfully, and in Netbackup activity monitor, a Default Application backup job runs successfully, however, when trying to manually run a policy configured to run the same script, it immediately completes with a status 0, but nothing is actually run.

The following is the content of the script:

@REM $Header: hot_database_backup_TW.cmd,v 1.4 2010/08/04 17:55:57 $
@REM bcpyrght
@REM ***************************************************************************
@REM * $VRTScprght: Copyright 2013 Symantec Corporation, All Rights Reserved $ *
@REM ***************************************************************************
@REM ecpyrght
@REM
@REM ---------------------------------------------------------------------------
@REM     hot_database_backup.cmd
@REM ---------------------------------------------------------------------------
@REM This script uses Recovery Manager to take a hot (inconsistent) database
@REM backup. A hot backup is inconsistent because portions of the database are
@REM being modified and written to the disk while the backup is progressing.
@REM You must run your database in ARCHIVELOG mode to make hot backups.
@REM ---------------------------------------------------------------------------

@setlocal ENABLEEXTENSIONS

@REM ---------------------------------------------------------------------------
@REM No need to echo the commands.
@REM ---------------------------------------------------------------------------

@echo off

@REM ---------------------------------------------------------------------------
@REM Put output in the same filename, different extension.
@REM ---------------------------------------------------------------------------

@set RMAN_LOG_FILE="%~dpn0.out"

@REM ---------------------------------------------------------------------------
@REM You may want to delete the output file so that backup information does
@REM not accumulate.  If not, delete the following command.
@REM ---------------------------------------------------------------------------

@if exist %RMAN_LOG_FILE% del %RMAN_LOG_FILE%

@REM ---------------------------------------------------------------------------
@REM Replace H:\oracle\ora102, below, with the Oracle home path.
@REM ---------------------------------------------------------------------------

@set ORACLE_HOME=E:\Oracle\db11g

@REM ---------------------------------------------------------------------------
@REM Replace ora102, below, with the Oracle SID.
@REM ---------------------------------------------------------------------------

@set ORACLE_SID=conservT

@REM ---------------------------------------------------------------------------
@REM Replace sys/manager, below, with the target connect string.
@REM ---------------------------------------------------------------------------

@set TARGET_CONNECT_STR=sys/password

@REM ---------------------------------------------------------------------------
@REM Set the Oracle Recovery Manager.
@REM ---------------------------------------------------------------------------

@set RMAN=%ORACLE_HOME%\bin\rman.exe

@REM ---------------------------------------------------------------------------
@REM Log the start of this script.
@REM ---------------------------------------------------------------------------

@for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p

@echo ==== started on %DATE% ==== >> %RMAN_LOG_FILE%
@echo Script name: %0 >> %RMAN_LOG_FILE%

@REM ---------------------------------------------------------------------------
@REM Several RMAN commands use time parameters that require NLS_LANG and
@REM NLS_DATE_FORMAT to be set. This example uses the standard date format.
@REM Replace below with the desired language values.
@REM ---------------------------------------------------------------------------

@set NLS_LANG=american
@set NLS_DATE_FORMAT=YYYY-MM-DD:hh24:mi:ss

@REM ---------------------------------------------------------------------------
@REM Print out environment variables set in this script.
@REM ---------------------------------------------------------------------------

@echo #                                       >> %RMAN_LOG_FILE%
@echo   RMAN  :  %RMAN%                       >> %RMAN_LOG_FILE%
@echo   NLS_LANG  :  %NLS_LANG%               >> %RMAN_LOG_FILE%
@echo   ORACLE_HOME  :  %ORACLE_HOME%         >> %RMAN_LOG_FILE%
@echo   ORACLE_SID  :  %ORACLE_SID%           >> %RMAN_LOG_FILE%
@echo   NLS_DATE_FORMAT  :  %NLS_DATE_FORMAT% >> %RMAN_LOG_FILE%
@echo   RMAN_LOG_FILE  :  %RMAN_LOG_FILE%     >> %RMAN_LOG_FILE%

@REM ---------------------------------------------------------------------------
@REM Print out environment variables set in bphdb.
@REM ---------------------------------------------------------------------------

@echo   NB_ORA_SERV  :  %NB_ORA_SERV%                     >> %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%

@REM ---------------------------------------------------------------------------
@REM We assume that the database is properly opened. If desired, this would
@REM be the place to verify that.
@REM ---------------------------------------------------------------------------

@REM ---------------------------------------------------------------------------
@REM If this script is executed from a NetBackup schedule, NetBackup
@REM sets an NB_ORA environment variable based on the schedule type.
@REM For example, when:
@REM     schedule type is                BACKUP_TYPE is
@REM     ----------------                --------------
@REM Automatic Full                      INCREMENTAL LEVEL=0
@REM Automatic Differential Incremental  INCREMENTAL LEVEL=1
@REM Automatic Cumulative Incremental    INCREMENTAL LEVEL=1 CUMULATIVE
@REM
@REM For user initiated backups, BACKUP_TYPE defaults to incremental
@REM level 0 (Full).  To change the default for a user initiated
@REM backup to incremental or incrementatl cumulative, uncomment
@REM one of the following two lines.
@REM @set BACKUP_TYPE="INCREMENTAL LEVEL=1"
@REM @set BACKUP_TYPE="INCREMENTAL LEVEL=1 CUMULATIVE"
@REM
@REM Note that we use incremental level 0 to specify full backups.
@REM That is because, although they are identical in content, only
@REM the incremental level 0 backup can have incremental backups of
@REM level > 0 applied to it.
@REM ---------------------------------------------------------------------------

@REM ---------------------------------------------------------------------------
@REM What kind of backup will we perform.
@REM ---------------------------------------------------------------------------

@if "%NB_ORA_FULL%" EQU "1" @set BACKUP_TYPE=INCREMENTAL Level=0
@if "%NB_ORA_INCR%" EQU "1" @set BACKUP_TYPE=INCREMENTAL Level=1
@if "%NB_ORA_CINC%" EQU "1" @set BACKUP_TYPE=INCREMENTAL Level=1 CUMULATIVE
@if NOT DEFINED BACKUP_TYPE @set BACKUP_TYPE=INCREMENTAL Level=0

@REM ---------------------------------------------------------------------------
@REM Call Recovery Manager to initiate the backup. This example does not use a
@REM Recovery Catalog. If you choose to use one, remove the option, nocatalog,
@REM from the rman command line below and add a
@REM 'catalog <userid>/<passwd>@<net service name>' statement.
@REM
@REM  NOTE WHEN USING NET SERVICE NAME: When connecting to a database
@REM  using a net service name, you must use a send command or a parms operand to
@REM  specify environment variables.  In other words, when accessing a database
@REM  through a listener, the environment variables set at the system level are not
@REM  visible when RMAN is running.  For more information on the environment
@REM  variables, please refer to the NetBackup for Oracle Admin. Guide.
@REM
@REM If you are getting an error that the input line is too long, you will need
@REM to put the RMAN run block in a separate file.  Then use the "cmdfile"
@REM option of RMAN.  For more information on the "cmdfile" options please
@REM refer to the RMAN documentation.
@REM ---------------------------------------------------------------------------
@(
echo RUN {
echo  ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
echo  ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE';
echo  BACKUP
echo        %BACKUP_TYPE%
echo        FORMAT 'bk_u%%u_s%%s_p%%p_t%%t'
echo        DATABASE;
echo  sql 'alter system archive log current';
echo  RELEASE CHANNEL ch00;
echo  RELEASE CHANNEL ch01;
echo  ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
echo  BACKUP
echo        FILESPERSET 20
echo        FORMAT 'arch-s%%s-p%%p-t%%t'
echo        ARCHIVELOG ALL;
echo  RELEASE CHANNEL ch00;
@REM ----------------------------------------------------------------------------
@REM Note: During the process of backing up the database, RMAN also backs up the
@REM control file.  This version of the control file does not contain the
@REM information about the current backup because "nocatalog" has been specified.
@REM To include the information about the current backup, the control file should
@REM be backed up as the last step of the RMAN section.  This step would not be
@REM necessary if we were using a recovery catalog or auto control file backups.
@REM ----------------------------------------------------------------------------
@REM echo  ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
@REM echo BACKUP
@REM recommended format
@REM echo        FORMAT 'cntrl_%s_%p_%t'
@REM echo        CURRENT CONTROLFILE;
@REM echo  RELEASE CHANNEL ch00;
echo  }
) | %RMAN% target %TARGET_CONNECT_STR% nocatalog msglog '%RMAN_LOG_FILE%' append

@set ERRLEVEL=%ERRORLEVEL%

@REM ---------------------------------------------------------------------------
@REM NetBackup (bphdb) stores the name of a file in an environment variable,
@REM called STATUS_FILE. This file is used by an automatic schedule to
@REM communicate status information with NetBackup's job monitor. It is up to
@REM the script to write a 0 (passed) or 1 (failure) to the status file.
@REM ---------------------------------------------------------------------------

@if %ERRLEVEL% NEQ 0 @goto err

@set LOGMSG=ended successfully
@if "%STATUS_FILE%" EQU "" goto end
@echo 0 > "%STATUS_FILE%"
@goto end

:err
@set LOGMSG=ended in error
@if "%STATUS_FILE%" EQU "" @goto end
@echo 1 > "%STATUS_FILE%"

:end

@REM ---------------------------------------------------------------------------
@REM Log the completion of this script.
@REM ---------------------------------------------------------------------------

@for /F "tokens=1*" %%p in ('date /T') do @set DATE=%%p %%q
@for /F %%p in ('time /T') do @set DATE=%DATE% %%p

@echo #  >> %RMAN_LOG_FILE%
@echo %==== %LOGMSG% on %DATE% ==== >> %RMAN_LOG_FILE%
@endlocal
@REM End of Main Program -----------------------------------------------------

 

The log output is as follows:

==== started on Mon 12/09/2013  01:44 ====
Script name: "C:\Program Files\VERITAS\NetBackup\DbExt\Oracle\Samples\rman\hot_database_backup_TW.cmd"
#                                      
  RMAN  :  E:\Oracle\db11g\bin\rman.exe                      
  NLS_LANG  :  american              
  ORACLE_HOME  :  E:\Oracle\db11g        
  ORACLE_SID  :  conservT          
  NLS_DATE_FORMAT  :  YYYY-MM-DD:hh24:mi:ss
  RMAN_LOG_FILE  :  "C:\Program Files\VERITAS\NetBackup\DbExt\Oracle\Samples\rman\hot_database_backup_TW.out"    
  NB_ORA_SERV  :  wpbk11ho                    
  NB_ORA_FULL  :  1                    
  NB_ORA_INCR  :  0                    
  NB_ORA_CINC  :  0                    

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Dec 9 13:44:19 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CONSERVT (DBID=3190565982)
using target database control file instead of recovery catalog

RMAN>

Recovery Manager complete.
#  

 

We have also tried following TECH171912, but it did not help. 

4 REPLIES 4

arctics2
Level 5

Output of BPHDB log:

 

13:44:19.628 [3408.6852] <2> logparams: -sb -rdbms oracle -S MASTER -to 300 -c Oracle_Agent_Fiber_Test_1 -s Full -clnt CLIENT_FQDN -FULL -kl 28 -b CLIENT_FQDN_1386614493 -jobid 1260
13:44:19.644 [3408.6852] <4> bphdb: Module: libncf, Release: 7.5.0.6 , Build: 06/10/2013 19:55:39 CDT (20130610)
13:44:19.644 [3408.6852] <4> bphdb: Windows version: 6.1.7601, Platform: 2 (Service Pack 1), Service pack: 1.0, Suite: 274, Product type: 3
13:44:19.644 [3408.6852] <4> bphdb: Process architecture: 9, Page size: 4096, Process type: 24, Process level: 8664, Processor revision: 6
13:44:19.644 [3408.6852] <4> bphdb: Current code page: WINDOWS: 1252  (ANSI - Latin I), Max. character width: 1, Substitution character: 0x3F [?], Unicode substitution character: 0x003f [?.]
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_POLICY=Oracle_Agent_Fiber_Test_1
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_CLIENT=CLIENT_FQDN
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_MODE=B
13:44:19.644 [3408.6852] <4> bphdb: INF - NB_ORA_POLICY=Oracle_Agent_Fiber_Test_1
13:44:19.644 [3408.6852] <4> bphdb: INF - NB_ORA_SCHED not defined.
13:44:19.644 [3408.6852] <4> bphdb: INF - NB_ORA_PC_SCHED=Full
13:44:19.644 [3408.6852] <4> bphdb: INF - NB_ORA_SERV=MASTER
13:44:19.644 [3408.6852] <4> bphdb: INF - NB_ORA_PC_BTYPE not set
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_FULL=1
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_INCR=0
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_CINC=0
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_SCHEDULED=1
13:44:19.644 [3408.6852] <4> bphdb: INF - setenv NB_ORA_PARENT_JOBID=1260
13:44:19.644 [3408.6852] <4> bphdb: INF - BACKUP START 3408
13:44:19.644 [3408.6852] <4> bphdb: INF - CONTINUE BACKUP message received

13:44:19.659 [3408.6852] <4> bphdb: INF - Processing "C:\Program Files\VERITAS\NetBackup\DbExt\Oracle\Samples\rman\hot_database_backup_.cmd"
13:44:19.659 [3408.6468] <4> bphdb: Process 2692, command '"C:\Program Files\VERITAS\NetBackup\DbExt\Oracle\Samples\rman\hot_database_backup_.cmd"', started
13:44:20.689 [3408.6468] <4> bphdb: Process 2692, command '"C:\Program Files\VERITAS\NetBackup\DbExt\Oracle\Samples\rman\hot_database_backup_.cmd"', completed with status 0
13:44:21.687 [3408.6852] <4> bphdb: INF - command successfully initiated
13:44:21.687 [3408.6852] <4> bphdb: INF - bphdb exit normal

13:44:21.687 [3408.6852] <4> bphdb: INF - EXIT STATUS 0: the requested operation was successfully completed

 

Will_Restore
Level 6

ensure NetBackup Client Service  on the db client is using login account that has SYSDBA privileges

RamNagalla
Moderator
Moderator
Partner    VIP    Certified

what is the user ID that netbackup client service on the client is running...?

does the user ID have the Full Privilages over the DB?

arctics2
Level 5

Thanks for the replies. 

The netbackup client service was configured to use local system.  We changed it now to the account used to successfully run the batch file locally, but no change.  Services were restarted after making the change.

Yes, the user ID has full privilages, and as mentioned, when running the script manually on the client, it works fine with the same ID.