Rman windows batch

Dear all,
11.2.0.2 on windows 2008
Batch script :
set DD=%date:~-4%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%%time:~6,2%
set O=E:\rbkp\medt\data\medt%DD%
mkdir %O%
e:
cd %O%
rem Here's a one-line NT command (but a LONG line!)
rem one that splits all the date parts out, putting
set logfile=E:\rbkp\medt\log\medt_RMAN_%DD%.log
rman nocatalog target sys/oracle@medt @c:\script\rbkp\rman_medt.sql msglog %logfile%
echo "medt Backup Completed backup"this script calls this script rman_medt.sql
run{
backup full database format 'ISDB_t%t_s%s_p%p';
backup spfile format 'spfile_%d_%s%t%p.ora';
backup archivelog all format 'medtARCH_%d_%s%t%p.arc';
backup current controlfile format 'ISDBCNTR_t%t_s%s_p%p';
configure controlfile autobackup format for device type disk clear;
configure controlfile autobackup clear;
}.. the problem is that it has to write into the directory O=E:\rbkp\medt\data\medt%DD%
but it is not, it iw writing into the ORACLE_HOME/database. log files are getting created in the dir %logfile% as required, but the backup pieces
are not..
Please advise

KaiS wrote:
Dear all,
11.2.0.2 on windows 2008
Batch script :
set DD=%date:~-4%%date:~4,2%%date:~7,2%%time:~0,2%%time:~3,2%%time:~6,2%
set O=E:\rbkp\medt\data\medt%DD%
mkdir %O%
e:
cd %O%
rem Here's a one-line NT command (but a LONG line!)
rem one that splits all the date parts out, putting
set logfile=E:\rbkp\medt\log\medt_RMAN_%DD%.log
rman nocatalog target sys/oracle@medt @c:\script\rbkp\rman_medt.sql msglog %logfile%
echo "medt Backup Completed backup"this script calls this script rman_medt.sql
run{
backup full database format 'ISDB_t%t_s%s_p%p';
backup spfile format 'spfile_%d_%s%t%p.ora';
backup archivelog all format 'medtARCH_%d_%s%t%p.arc';
backup current controlfile format 'ISDBCNTR_t%t_s%s_p%p';
configure controlfile autobackup format for device type disk clear;
configure controlfile autobackup clear;
And why are you clearing the controlfile autobackup? And why are you doing it every time the script runs?
>
.. the problem is that it has to write into the directory O=E:\rbkp\medt\data\medt%DD%
but it is not, it iw writing into the ORACLE_HOME/database. log files are getting created in the dir %logfile% as required, but the backup pieces
are not..
Please advise

Similar Messages

  • Pass tablespace(s) as a parameter to RMAN using batch file (windows2000)

    I want to make a backup of one or more than one tablespaces.
    For Example:
    Backup tablespace USERS,TOOLS;
    Backup tablespace USERS;
    In this regards I am using windows batch file. Below you find the code of batch file which I am using to perform this operation (windows 2000)
    Batch file (c:\rman.cmd)
    set tbs1=%1
    set tbs2=,%2
    if exist tbs1 == goto usage
    if exist tbs2 == goto usage
    echo BACKUP tablespace %tbs1% %tbs2% ; > c:\temp\tbs.rman
    rman TARGET / @ c:\temp\tbs.rman
    Problem
    I run this batch file on command line .
    When I issue this command its ok and backed up both the tablespaces.
    Host @c:\rman.cmd USERS,TOOLS
    But when I want to backup only one tablespace and issue the command like that:
    Host @c:\rman.cmd USERS
    It gave the following error
    BACKUP tablespace users , ;
    Found comma after first tablespace.
    Point of focus
    How to get rid of the comma after first tablespace on run time, when I want to backup only one tablespace.
    BACKUP tablespace users , ;
    How to avoid that comma on run time when I only want to make a backup of single tablespace.
    Please check this matter it is only the batch file side problem.
    With Best Regards
    Fawad Ahmed

    I am not expert is DOS but I think you can fix this with
    a simple programming logic elements in the script.
    You have 2 cases:
    1 case ) When you have only one parameter
    2 case ) When you have more or equal than two parameters
    if exist tbs1 == goto mark1
    if exist tbs2 == goto mark2
    mark2:
    echo BACKUP tablespace %tbs1% %tbs2% ; > c:\temp\tbs.rman
    goto end
    mark1:
    echo BACKUP tablespace %tbs1% ; > c:\temp\tbs.rman
    goto end
    end:
    rman TARGET / @ c:\temp\tbs.rman
    This can be one the case for 1 or 2 parameters . If
    you think to pass more parameters you have to use
    another logic.
    I hope this can help you!
    Joel P�rez

  • Is there any command in windows batch file similar to the unix grep command

    Hi,
    I have a batch file which will return status of the Database to a file ex: "OPEN". Now I want to read this output file and check for the "OPEN" string from another batch file. any suggestions?. This is similar to "grep" command in unix. I want this to be done in windows batch file.
    This is my actual batch file
    rem -- Description: Check whether the Database is UP
    rem -- Usage:
    rem -- ORACLE_SID is input parameter for the file
    rem --
    rem --start of batch file
    @echo off
    set ORACLE_SID=%1
    echo connect plp/ltd1plp@%1
    echo set cmdsep on
    echo set cmdsep '"'; --"
    echo set term on
    echo spool c:/status_log.log
    echo select status from v$instance;
    echo spool off
    ) | sqlplus /nolog
    rem --end batch file
    Thanks.

    The same link from [google cache|http://209.85.229.132/search?q=cache:EJrm9tgj0a8J:www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/find.mspx+windows+find&cd=1&hl=en&ct=clnk&client=opera]. Also you can use help:
    find /?

  • Call Oracle Stored Procedure with Parameters from Windows Batch File

    Hi,
    I have an oracle procedure that requires two parameters to execute, start date and end date as such:
    CREATE OR REPLACE PROCEDURE insert_orders(
    pSTART_DT IN varchar2
    , pEND_DT IN varchar2
    I want to create a windows batch file to execute the procedure but want to be able to specify the parameters (ie start and end dates) in the batch file as opposed to changing the sql file that the batch file uses to execute the procedure but I don't know what the syntax is. I tried the following but it still doesn't work.
    Sql File: call_insert_orders.sql
    execute insert_orders('&1','&2');
    exit
    Batch File:
    sqlplus username/password @call_insert_orders.sql %01-jan-2010% %01-jan-2011%
    When I execute the batch file, my DOS window still prompts me to enter value 1 so I think it recognizes that there is a variable being used but is not able to fill in the actual value I specify. I'm not an experienced DOS/Windows Batch File person so I'm guessing it's my syntax that's screwed up. There is not a lot of documentation on this subject matter hence my post on this forum. Any helps would be appreciated.
    Thanks

    Hello,
    Just try the same DOS command without all the % sign.
    In MS-DOS, the % at the beginning and at the end of a string are for variables. Which means your batch is looking for a variable called 01-jan-2010 and a variable called 01-jan-2011, but those are the values you want to pass, not the name of variables.
    As they are not defined, nothing is passed to the sqlplus script, and that is why you are prompted for values.
    Hope it will help.
    Regards,
    Sylvie

  • Naming output files in Windows Batch Scripts

    <p>Looking for Windows batch script syntax to autonumber,automatically name, and/or randomly name output files to avoidoverwriting output files.</p>

    I use this type of functionalithy frequently to save output logs.<BR>Here is a snippet of code that should work. It assumes that you already have the Esscmd script that performs the DBStats call and outputs the log to D:\logs\dbstats.log.<BR><BR>Let me know if you have any questions.<BR><BR>@ECHO OFF<BR>:: ==========================================================<BR>::Filename:     GetDBSTATS.bat<BR>:<img src="i/expressions/face-icon-small-happy.gif" border="0">escription:     Runs DBSTATS and rename outputfile with current date<BR>:: ==========================================================<BR>::<BR>:: Run Esscmd to get dbstats output log d:\logs\dbstats.log<BR>ESSCMD D:\script\getdbstats.ess<BR>::<BR>:: Get Current Date and Time<BR> FOR /F "TOKENS=2" %%i IN ('DATE/T') DO SET FullDate=%%i<BR> SET Month=%fulldate:~0,2%<BR> SET Day=%fulldate:~3,2%<BR> SET Year=%fulldate:~6,4%<BR><BR> FOR /F "TOKENS=1" %%i IN ('TIME/T') DO SET FullTime=%%i<BR> FOR /F "DELIMS=: TOKENS=1" %%i in ('ECHO %fulltime%') DO SET Hour=%%i<BR> FOR /F "DELIMS=: TOKENS=2" %%j in ('ECHO %fulltime%') DO SET Minute=%%j<BR><BR>::<BR>::<BR>RENAME d:\logs\dbstats.log dbstats_%month%_%day%_%year%.log<BR>EXIT<BR>

  • Is it possible to call a windows batch file from PL/SQL

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    Hi!
    Youn need some extproc related entries in you listener.ora and tnsnames.ora file.
    *1. In the listener.ora:*
    Defining the listener process is done in two parts.
    The information contained in each listener differs!!!
    The first part is as follows:
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))  <---  *ADD THIS LINE
          (ADDRESS = (PROTOCOL = TCP)(HOST = yourhostname)(PORT = 1521))
      )The seoncd part is as follows:
    SID_LIST_LISTENER =
      (SID_LIST = 
        (SID_DESC =
          (GLOBAL_DBNAME = YOUR_GLOBAL_DBNAME)
          (ORACLE_HOME = c:\oracle\product\10.2.0)  <-- THIS IS YOUR ORACLE_HOME
          (SID_NAME = YOUR_SID)                            <-- SID
        (SID_DESC =                                              <--- ADD THIS LINE
          (SID_NAME = PLSExtProc)                          <--- ADD THIS LINE
          (ORACLE_HOME = c:\oracle\product\10.2.0) <--- ADD THIS LINE AND EDIT TO YOUR ORACLE_HOME
          (PROGRAM = extproc)                                <--- ADD THIS LINE
          (ENV = "EXTPROC_DLLS=ANY")                  <--- ADD THIS LINE
        )                                                                <--- ADD THIS LINE
      )*2. In the tnsnames.ora you need to add the following entry:*
    *(The KEY value entered must be match to the KEY value entered int the listener.ora file!)*
    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
        (CONNECT_DATA =
          (SID = PLSExtProc)
          (PRESENTATION = RO)
      )Finally you need to restart your listiner. After restarting there will be a service called "PLSExtProc" in your listener.
    This are only examples for extproc configuration, your tnsnames.ora and listener.ora can be differs.
    FIRST MAKE MAKE A BACKUP OF YOUR ORIGINAL tnsnames.ora AND listener.ora FILES
    For more information please check metalink note 68061.1 "EXTPROC: Creating External Procedures on Windows NT"
    Bestr Regards
    Norbert

  • Is it possible to call a windows batch file from PL/SQL block ??

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL block ??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    You didn't specify a database version, but if you are 10g or higher, it's quite straightforward using an external job type in DBMS_SCHEDULER. Funnily enough i'm looking at something similar myself at the moment.
    Useful guide to some of the issues here Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

  • Problem in connecting to sqlplus from windows batch file (DOS)

    Hi All,
    We have a new 10g Oracle database installed on windows server. I am trying to write a windows batch file to
    1) Connect to SQLPLUS
    2) Execute a script
    3) Disconnect from SQLPLUS.
    Example File Name:- execsql.bat
    SET ORACLE_SID=CAUT
    SET SCHEMA_IN=%1
    SET PASS=DEV
    SET script=%2
    sqlplus %SCHEMA_IN%/%PASS%@%ORACLE_SID% @%script%
    if %errorlevel% NEQ 0 echo ERROR: %ERRORLEVEL% else echo OK
    Now if i run this bat file like :- execsql.bat DEV script1.sql
    DEV= schema name,
    script1.sql = this file contains select * from dual;
    The code runs fine, but if i change dual to dual1 the sql error's out but not able to catch the error in the batch file.
    Reason why i would like to catch the error is this batch file would be scheduled through Autosys job scheduler and for autosys any exit code >0 is an error. Please help me in rewriting this batch script.
    Thanks
    Sam.

    Hello,
    What if you run this in SQL*Plus before you run the SELECT:
    whenever sqlerror exit failure

  • SQLPLUS from Windows Batch (.bat) Files

    I am executing a SQL script from within a windows batch file using the SQLPLUS command.
    sqlplus %MAX_ORA_USER%/%MAX_ORA_PASSWORD%@%MAX_ORA_DB% @MAIDIOUT_PS_TEST2.sql
    On exit, the SQL returns a code EXIT 0 (Success) or EXIT 2 (Warning).
    I want to be able to capture the value of the exit in the WINDOWS batch file and take some action.
    QUESTION: Does someone have a code example on how to capture hte EXIT value in the Windows Batch file?
    thanks,
    Philip

    Try one of the following constructs:
    IF ERRORLEVEL <x> <command> [ELSE expression]
    IF %ERRORLEVEL% == <x> <command> [ELSE expression]
    GOTO label_%ERRORLEVEL%
    :LABEL_xThe first construct to perform <command> any time the errorlevel is greater or equal to x.
    The second construct will perform <command> anytime the errorlevel equals x.
    The third construct will jump to the specified label with the value of errorlevel appended to it.

  • Maxl within Windows Batch File

    Hello,
       I am trying to schedule an Automatic Essbase Archiving command . Function is to Disable connects , Archive , Unarchive and Enable connects . I know the Maxl commands which perform this action but just wanted to make sure how to portray this within a Windows Batch file.
    Within the Batch file , abc.bat can I insert those commands . To enter the shell we need essmsh command , but I didnt wanted to get into decrypting , encrypting the ID etc to do that . So is there a way to get it done within the Windows batch file ?
    Thanks !!

    Yes its Straight forward case ,create a batch file which call the maxl script.The batch file should contain the user id and password of Essbase and the maxl script should contain the parameters of Essbase archiving
    The content of batch file for Essbase archiving process
    echo off
    set ESSUSER=admin
    Set ESSPWD=Password
    set ESSSERVER=localhost
    set ESSAPP=Sample
    set ESSDB=Basic
    SET ESSBASE SERVER PATH=D:\Hyperion\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer
    set MaxlScript=D:\Hyperion\Middleware\user_projects\epmsystem1\Essbaseserver\essbaseserver1\bin
    essmsh "D:\Archieve.mxl" %ESSUSER% %ESSPWD% %ESSSERVER%
    ===================================================================================================
    Maxlscript Content for Archieving
    spool on to "D:/bck.log";
    set timestamp on;
    login $ESSUSER $ESSPWD on $ESSSERVER;
    display session all;
    alter system kill request all;
    alter system logout session all force;
    export database $essApp.$essDB all data to server data_file 'd:\alldata.txt';
    alter database $essApp.$essDB force archive to file "D:/sample.arc";
    alter database $essApp.$essDB end archive;
    spool off;
    logout;
    exit;
    Similarly can you create batch files for Cube restoration .I hope the above example helps you
    Thanks,
    Sreekumar Hariharan

  • Where windows batch file which log off windows lies ?

    where windows batch file which log off windows lies ?
    to which me can call from java code to log off my pc?

    You should use a brute-force algorithm on the on/off switch on your pc. I suggest a rate of 30 hits per minute.

  • Where windows batch file lies which log off windows ?

    where windows batch file lies which log off windows ? wana log off my pc from java code

    grc.com has a program (very small) that does it. The program is called "wizmo" and is written in Assembly.
    If you are using Windows NT/2000/XP you can get a program in MS Windows Resource Kit called "shutdown.exe" but the program does only the shutdown job. You must manually turn the machine off.

  • Executing sqlplus in windows batch file - URGENT

    Hi
    Is it possible to run sqlplus.exe thru batch file as follows.
    set PATH=%PATH%;C:\oracle\product\10.2.0\client_1\BIN;
    host sqlplus userid=test1/test12@testdev
    sELECT * FROM CASESTATUS
    Thanks
    murali

    hI
    It did not work. I have this question.
    1. Do I have to run this opening SQL/PLUS and then submit
    @C:\Test\SQL2.bat
    2. Or from Windows command run SQL2.Bat
    I tried both of them , it did not work. If I try from windows , I am getting SQLPlus connection window at all.
    Please help me.
    Murali
    set PATH=%PATH%;C:\oracle\product\10.2.0\client_1\BIN;
    sqlplus userid=test1/test12@testdev
    Ok so far but your select needs to be in a file if you want this to be executed.
    Put this in, f.ex, run.sql
    >>
    sELECT * FROM CASESTATUS
    >>
    then you can use
    sqlplus userid=test1/test12@testdev @run.sql <complete path if needed>

  • Rman windows and  Shell Script

    hi,
    How to take the backup by windows script and shell script.please any one tell that.
    thanks
    with regards

    Dear user!
    How to take the backup by script is a very imprecisely kind of question. So the only thing I can give you is a very imprecise answer.
    For linux shellscript you may use:
    vim my_backup_script.sh
    #!/bin/bash
    BACKUP DATABASE;Save and run this script in the following way:
    rman target / catalog catuser/password@CATDB CMDFILE my_backup_script.shYou may customize this script to fit your needs. On Windows you may write a batchscript like that:
    notepad my_backup_script.bat
    BACKUP DATABASE;Save and run this script like that:
    rman target / catalog catuser/password@CATDB CMDFILE my_backup_script.batMaybe if you could state your needs a little bit more precisely I could give you a more helpful answer.
    Yours sincerely
    Florian W.

  • Windows batch file issue for Dbf to csv

    Hello,
    I am in a tough situation.I need to create a batch file in windows to convert .dbf file to .csv.
    i am using below code for doing this .
    dbf_2_ora.bat.....
    f:
    cd \Retail_Work\DATA_201\test
    copy C_N_DETL.DBF C_N_DETL_TEST.csv
    when I am running above bat file "C_N_DETL_TEST.csv" is creating but when I am opening this file data is separated by "tab".
    kindly help me to create a csv file from dbf file withput spaces/tab/whitespaces.
    hel[p me                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    IMPORT DATA is a server side command (just as the documentation tells you)
    The SAP HANA server cannot access your workstation or the folders on it.
    This (and a lot more around data import/export) has been discussed a lot here in SCN already.
    A little research effort would have clarified this.
    - Lars

Maybe you are looking for

  • How to make macbook pro run faster

    Hi, Saw a post from admins I guess, listed below that post and my Macbook Pro details as required: Do a Apple Menu > About This Mac > More information and copy and paste here what you see there EXCEPT the serial numbers at the bottom. Edit the serial

  • Error while doing  GR for scheduling aggrement

    Dear Experts, We are facing error while doing GR for scheduling aggrement. we have done the following steps. 1) Scheduling aggreement in ME31L 2) Released in ME35L 3) Mainatined Sch.Agmt Schdule in ME38 for todays and date 200 qty and other line is 8

  • Synching MBP to Mac Pro

    Dear Board, Can I have the MBP "talk" to the Mac Pro via the Airport Extreme cards without a cable running between the two, or do I need a wireless router? Thanks for your help. B3

  • 10.4.9 Killed my WEP/WPA abilities

    Just updated to 10.4.9 on my Core 2 Duo black Macbook, and I can no longer connect to my home network via WEP or WPA. If I remove all encryption from the network, then 10.4.9 will work. The network is ok, because my Powerbook running Panther continue

  • Item Region: 'Group/Sort by' issues

    I've got some serious issues organizing and sorting items on a page. If I select 'Group by Item Type' and 'display the Group by banner', items are grouped by Simple File, Simple Text, Simple URL. I am unable to change this sorting order and unable to