-
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.
-
exp full =y file=x
You will have to do an environment variable to get sid and date in log
-
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;
/
-
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
-
You can do it with native "DOS" - but I found doff.exe easier to use
http://www.jfitz.com/dos/
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|