This discussion is archived
5 Replies Latest reply: Nov 9, 2012 7:05 AM by user296828 RSS

Stop Recovery in specific time

ozgurumut Newbie
Currently Being Moderated
Hi All,

I'd like to stop Recovery in specific time.
For instance ; My db works Day-1 and Every day Recovery starts 20:00 and finish 05:00. If it is possible that when DB time reach to sync 03:00, I'd like to stop recovery.
DB version Oracle 10.2.0.5 .....

Thanks...
  • 1. Re: Stop Recovery in specific time
    mseberg Guru
    Currently Being Moderated
    Hello;

    Should be possible with a script.

    What is your OS?

    Best Regards

    mseberg
  • 2. Re: Stop Recovery in specific time
    ozgurumut Newbie
    Currently Being Moderated
    Hi mseberg,

    OS is IBM AIX... If you have a script , Please can you share with me ?

    Thanks...
  • 3. Re: Stop Recovery in specific time
    mseberg Guru
    Currently Being Moderated
    Testing on Linux

    You will have to use your env command and change the env file for your system

    Test result
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Nov 9 08:17:29 2012
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    SQL> Connected.
    SQL> 
    Database altered.
    
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Test of test
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> alter database recover managed standby database cancel;
    alter database recover managed standby database cancel
    *
    ERROR at line 1:
    ORA-16136: Managed Standby Recovery not active
    Script
    #!/bin/bash
    ####################################################################
    #
    
    if [ "$1" ]
    then DBNAME=$1
    else
    echo "basename $0 : Syntax error : use . stoprecovery <DBNAME> "
    exit 1
    fi
    
    
    
    #
    # Set the Environmental variable for the instance
    #
    . /u01/app/oracle/dba_tool/env/${DBNAME}.env
    #
    #
    
    
    
    $ORACLE_HOME/bin/sqlplus /nolog <<EOF
    connect sys/oracle as sysdba
    alter database recover managed standby database cancel;
    EOF
    ENV file for database
    ORACLE_BASE=/u01/app/oracle
    
    ULIMIT=unlimited
    
    ORACLE_SID=STANDBY
    
    ORACLE_HOME=$ORACLE_BASE/product/11.2.0.2
    
    ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
    
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    
    LIBPATH=$LD_LIBRARY_PATH:/usr/lib
    
    TNS_ADMIN=$ORACLE_HOME/network/admin
    
    PATH=$ORACLE_HOME/bin:$ORACLE_BASE/dba_tool/bin:/bin:/usr/bin:/usr/ccs/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/GNU/bin/make:/u01/app/oracle/dba_tool/bin:/home/oracle/utils/SCRIPTS:/usr/local/bin:.
    
    export EXP_DIR=/u01/oradata/STANDBY_export
    
    #export TERM=linux=80x25 wrong wrong wrong wrong wrong
    
    export TERM=vt100
    
    export ORACLE_BASE ORACLE_SID ORACLE_TERM ULIMIT
    
    export ORACLE_HOME
    
    export LIBPATH LD_LIBRARY_PATH ORA_NLS33
    
    export TNS_ADMIN
    
    export PATH
    Best Regards

    mseberg

    Edited by: mseberg on Nov 9, 2012 8:23 AM
  • 4. Re: Stop Recovery in specific time
    ozgurumut Newbie
    Currently Being Moderated
    Thanks...

    I will test at the same time :)
  • 5. Re: Stop Recovery in specific time
    user296828 Expert
    Currently Being Moderated
    all cooked and ready for you :)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points