Dump file name on windows.
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Dump file name on windows.

  1. #1
    Join Date
    Jan 2004
    Location
    Paris, France
    Posts
    52

    Dump file name on windows.

    Hi

    I have a daily backup with RMAN on a test environnment.
    But often, the developpers want to get back to previous datas.

    I want so to do some daily exports.
    I want to know how I can script a batch file that do the following :
    1/ Export full database
    2/ Dump filename should be SID_YYYYMMDD.dmp

    Thanks in advance.

  2. #2
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,333
    exp full =y file=x

    You will have to do an environment variable to get sid and date in log

  3. #3
    Join Date
    Sep 2001
    Location
    Makati, Philippines
    Posts
    857
    can you expand this procedure to save it to a file?
    declare
    siddate varchar2(20);
    begin
    select 'FILE=SID_'||to_char(sysdate,'YYMMDD')||'.DMP' INTO SIDDATE FROM DUAL;
    DBMS_OUTPUT.PUT_LINE(SIDDATE);
    DBMS_OUTPUT.PUT_LINE('GRANTS=Y');
    DBMS_OUTPUT.PUT_LINE('FULL=Y');
    DBMS_OUTPUT.PUT_LINE('ROWS=Y');
    END;
    /

  4. #4
    Join Date
    Jan 2004
    Location
    Paris, France
    Posts
    52
    Originally posted by davey23uk
    exp full =y file=x

    You will have to do an environment variable to get sid and date in log
    What I am looking for is a way to get windows environment variable for the date and format it into YYYYMMDD.

    Thanks

  5. #5
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    You can do it with native "DOS" - but I found doff.exe easier to use
    http://www.jfitz.com/dos/

  6. #6
    Join Date
    Jan 2004
    Location
    Paris, France
    Posts
    52
    Found a solution...

    setlocal

    for /f "tokens=2 delims=/- " %%f in ('date /t') do (set mm=%%f)
    for /f "tokens=3 delims=/- " %%g in ('date /t') do (set dd=%%g)
    for /f "tokens=4 delims=/- " %%h in ('date /t') do (set yy=%%h)

    for /f "tokens=1 delims=:" %%i in ('time /t') do (set hh=%%i)
    for /f "tokens=2 delims=:" %%j in ('time /t') do (set minutes=%%j)

    exp system/manager full=y file=%sid%_%mm%-%dd%-%yy%_%hh%-%minutes%.dmp

    endlocal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width