Click to See Complete Forum and Search --> : Dumps Oracle


ALREMTULLA
October 18th, 2006, 02:40 AM
Dear Friends,

I have a problem in taking a dump of oracle by using the schedule tasks.

I have created two files. The first file is the Batch file which is having this details:.

Exp USERID=sharp_tz/sharp_tz@TEST PARFILE=C:\DatabaseImp\EXPCDG.IMP

The second file is the EXPCDG.IMP file which is having the following codes:-


#EXPORT
FULL=N
BUFFER=1000000
OWNER=sharp_tz
CASE TO_CHAR(SYSDATE,'DAY')
WHEN "MONDAY" THEN
FILE=C:\DUMPS\ORAEXPORT\MON_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\MON_DUMP.log;
WHEN "TUESDAY" THEN
FILE:=C:\DUMPS\ORAEXPORT\TUE_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\TUE_DUMP.log;
WHEN "WEDNESDAY" THEN
FILE:=C:\DUMPS\ORAEXPORT\WED_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\WED_DUMP.log;
WHEN "THURSDAY" THEN
FILE:=C:\DUMPS\ORAEXPORT\THU_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\THU_DUMP.log;
WHEN "FRIDAY" THEN
FILE:=C:\DUMPS\ORAEXPORT\FRI_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\FRI_DUMP.log;
ELSE
FILE:=C:\DUMPS\ORAEXPORT\SAT_DUMP.DMP;
LOG=C:\DUMPS\ORAEXPORT\SAT_DUMP.log;
END;
GRANTS=Y
INDEXES=Y
CONSISTENT=Y


NOTE:
Aim is to create seperate dump's on different days.

If I try to run this its not working. Can I have your help please.

Thanks for helping me.

Yours

davide++
October 18th, 2006, 03:32 AM
Hi all.

Do you get any error when your batch file runs?

File EXPCDG.IMP is the parameter file that EXP command uses to create an export of an Oracle database; this file contains some information used by EXP, such as "FULL=N" that means full export, and so on. But expression such as "CASE TO_CHAR" or "WHEN" isn't valid parameter (they're SQL instruction), and you cannot using them in a parameter file.
If you want to get a daily dump, you should work on batch file.

I hope this will help you.

ALREMTULLA
October 18th, 2006, 04:18 AM
Thanks for your reply.

I don't get any error message.
It just starts and at the same moment if comes out without taking a dump.


Second Problem, I need one more help from you.


If I use the batch file below its gives me an error. The Batch code is:-


exp USERID=sharp_tz/shart_tz@test file=c:\oracledump\"%date%".dmp log=c:\oracledump\"%date%".log owner=sharp_tz

When running this code it goes into the command prompt then it shows the following error:-

EXP-00028: failed to open c:\oracledump"18/10/2006.dmp log=c:\oracledump"18/10/2006.log for write.

Then it asks for this:

Export file: EXPDAT.DMP >

And it stops here .

Here my aim is to try if it can create the dump by using the dates.

Can I have your suggestion or modified code for the First Problem and the Second Problem Please.

Thanks for helping me.

Regards.

davide++
October 18th, 2006, 05:24 AM
Well.

Exp cannot create c:\oracledump"18/10/2006.dmp file because its name is invalid for Windows: character " is not allowed. So Exp doesn't reach to read parameter file.

If you create a DMP file based on the date of current day, you'll can use a parameter file without the (invalid) command to select filename of dump; it's right.

I'm sorry, I don't know syntax of batch file, but I think you should write some code to manage creation and execution of exp command.

jp140768
October 25th, 2006, 09:23 AM
I'm not sure that you use the quotation marks around %date%.

I tried on the command line:
Echo %date%

Echo Hello%date%

and got the date and then Hello and the Date.

HTH

jp140768
October 25th, 2006, 09:34 AM
This link may help you?
Dos programming (http://home7.inet.tele.dk/batfiles/batfiles.htm)

From the above link:

Get the date and time into variables.
:: datetime.bat
:: also works with mo/da/year format
:: revised 30 April 2005
@echo off
echo @prompt set time=$t$_set date=$d$_>%temp%.\$dattim1.bat
%comspec%/e:4096/c%temp%.\$dattim1.bat>%temp%.\$dattim2.bat
call %temp%.\$dattim2.bat
for %%v in (%time%) do set time=%%v
echo set day=%%1>%temp%.\$dattim3.bat
echo set date=%%2>>%temp%.\$dattim3.bat
call %temp%.\$dattim3.bat %date%
del %temp%.\$dattim?.bat
::


HTH