Batch file to run daily database backup
Our company has just started using an Oracle database for a third-party software. I am currently performing a manual daily database backup through the dos command prompt (exp.exe "system_id"\password@"database" parfile=export_parameter.txt). This creates and .dmp and .log file for the database backup.
Does anyone know of a batch file or another method that I can use to perform an automatic daily backup of my database?
I would really appreciate your input. Thanks.
Hi,
Put your exp command into a .bat file, and schedule it by AT dos command (or WINAT, if you have it).
hth
Paolo
Similar Messages
-
Daily database backup runnig on RAC 10.2.0.3 with two Solaris nodes & ASM
Hello,
I'm confused about making daily incremental RMAN backup of a database runnig on Oracle RAC 10.2.0.3 on two Solaris nodes and ASM.
Databases cannot be stopped for backup and point in time recovery is needed.
Please correct me if I am doing wrong:
1) Backup must be Weekly database Level 0 and Daily database Level 1 is appropriate.
2) Is best to use a Flash Recovery Area (FRA) - I've setup one on a separate ASM volume. I have enough space to do the backup on FRA.
3) I am confused about the number channels I need to use. Do I need to use separate RMAN backup channels for each node or I can just leave the default:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
4) Below are the RMAN scripts I plan to use for
- Weekly database backup Level 0:
#!/usr/bin/ksh
echo BACKUP FULL: $ORACLE_HOME/bin/rman target / nocatalog log ${LOGFILE} append
$ORACLE_HOME/bin/rman target / nocatalog log ${LOGFILE} append << eof
run {
backup incremental level 0 database TAG bkp_level0_200906010;
SQL 'alter system archive log current';
backup archivelog all;
delete noprompt obsolete;
exit;
eof
- Daily database backup Level 1:
#!/usr/bin/ksh
echo BACKUP INCREMENTAL: $ORACLE_HOME/bin/rman target / nocatalog log ${LOGFILE} append
$ORACLE_HOME/bin/rman target / nocatalog log ${LOGFILE} append << eof
run {
backup incremental level 1 database TAG bkp_level1_20090611;
SQL 'alter system archive log current';
backup archivelog all;
delete noprompt obsolete;
exit;
eof
I'm I doing things wrong?Show also the parameter I have set for RMAN:
node1:oracle$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on Tue Jun 9 23:46:05 2009
connected to target database: ORCL (DBID=1198388159)
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/oracle/product/10gr2/db/dbs/snapcf_orcl1.f'; # default
Showing some instance parameters on node1:
SQL> show parameter recovery;
NAME TYPE VALUE
db_recovery_file_dest string DGFRA+
db_recovery_file_dest_size big integer 300G
recovery_parallelism integer 0
SQL> show parameter archive;
NAME TYPE VALUE
archive_lag_target integer 0
log_archive_config string
log_archive_dest string
log_archive_dest_1 string
log_archive_dest_10 string location=use_db_recovery_file_
dest
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
NAME TYPE VALUE
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
NAME TYPE VALUE
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
log_archive_duplex_dest string
log_archive_format string %t_%s_%r.dbf
log_archive_local_first boolean TRUE
log_archive_max_processes integer 2
log_archive_min_succeed_dest integer 1
log_archive_start boolean FALSE
log_archive_trace integer 0
remote_archive_enable string true
standby_archive_dest string ?/dbs/arch -
How to schedule the Batch file to run from task scheduler
Hello Everyone,
I have a batch file which kills the wscript.exe process, I am doing this manually, I need to schedule this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers, i.e if the wscript.exe process count in task
manager reaches to 30, the task schedular should execute this batch file,
Is there a way to do so.
dibuHi,
àI need to schedule
this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers.
As I know, it will not help you to achieve this target via Scheduled Task. When configure Scheduled Task, there
seems no Trigger option that help you specify this condition (process counts reaches to specific numbers) to trigger the batch file.
You could consider that improve this batch file. Adding the
Check function to the script will be a better option. For script issue, you can post it in the
Official Scripting Guys Forum. I believe we will get a better assistance there.
If any update, please feel free to let me know.
Best regards,
Justin Gu -
[Solved] Problem getting Batch Files to run as Admin in Win 8.1
I'm trying to control certain Services with batch files to have them stop automatically at start. However, with certain services, stopping requires run as admin. My user account has admin privileges.
For example, a batch file with this command will stop with a command prompt requiring Y/N to confirm the stop.
NET STOP "Audiosrv"
I can create a shortcut and set it to run as admin and it will stop the service without issue when it's clicked. However, if I put the shortcut in the Windows startup folder, so the script runs automatically at boot it seems to ignore the shortcuts.
I've tried the RunAs command below in a batch file, but it doesn't stop the service.
runas /user:jaguar\Admin NET STOP "Audiosrv"
Thanks for your help.Hello Peter, that works great. I found I can add multiple arguments by separating them with a semi colon and I could hide the powershell window with the command at the end.
My last question is if there's an additional command that will hide or minimize the command line window when the script runs?
powershell.exe "Start-Process powershell -ArgumentList 'stop-service audiosrv; stop-service AudioEndpointBuilder; stop-service MMCSS' -Verb RunAs" -windowstyle hidden -
Batch File to run Java Program
I'm trying to create a batch file that will run a java program without opening it up, compiling, and executing:
JAVA.EXE "C:\(path).class"
It keeps giving me the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: C:\\(path)/classallright... i switched up the batch file to the format
you gave me. It seems better, but now it has a problem
with TerminalIO.KeyboardReader. The error message was:
Exception in thread "main"
java.lang.NoClassDefFoundError:
TerminalIO/KeyboardReader
at util.<clinit>(util.java:18)
at GPA_Calculator.<clinit>(GPA_Calculator.java:3)
util line 18 is:
private static KeyboardReader input = new
KeyboardReader ();Sounds like you've got alot of non-standard classes there ... I could not begin to speculate. Is this something you wrote or inherited? If it is not too large you could try posting the code ... but it sounds like that would not be practicle. At any rate I can't see how it's working better if it is still not working :S -
Batch File not running all commands, MaxL seems to stop them
I have a batch file that looks like this (removed the part in the middle that does the data extract, this is just for testing)
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt"
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StopArchive.txt"
It executes the first MaxL file find, and then in the command prompt says "MaxL Shell Completed" and goes back to the prompt. It is not picking up the second MaxL script.
We just upgraded to 11.1.2.1 and this worked fine in 11.1.1.3 when using essmsh. Any idea why it doesn't go through the whole script?
The contents of the two files are:
MaxL-StartArchive
login 'admin' identified by 'removedpassword' on 'servername';
alter database CSHBud.PandL begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-CSHBud-PandL.txt';
alter database CSHBud.Wrkforce begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-CSHBud-Wrkforce.txt';
alter database PropBud.NOIStmt begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-PropBud-NOIStmt.txt';
alter database PropBud.Staffing begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-PropBud-Staffing.txt';
logout;
MaxL-StopArchive
login 'admin' identified by 'removedpassword' on 'servername';
alter database CSHBud.PandL end archive;
alter database CSHBud.Wrkforce end archive;
alter database PropBud.NOIStmt end archive;
alter database PropBud.Staffing end archive;
logout;
exit;>
E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt"
Had this happen at a client that just upgraded
Try Cmd /C E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt" -
Hi,
We created an OS batch file for our daily exports (backups). This file is scheduled to run daily at 7:00 P.M. A test run showed that it did not work. Can somebody find an error in the script?
rem ***** SAMPLE BATCH FILE TO DO DAILY EXPORT ******
@echo Export started at:
@echo
date /T
time /T
rem Here's a one-line NT command (But a long line!)
rem one that splits all the date parts out, outting
rem each one into it's own variable (weekday, day, month, year)
for /f "tokens=1-4 delims=/ " %%a in('date /t') do
(set=weekend=%%a& set day=%%b& set month=%%c& set year=%%d)
set logfile=%year%_%month%_%day%.log
set expfile=%year%_%month%_%day%.exp
set ORACLE_SID=BDC
set ORACLE_HOME=D:\oracle\product\10.2.0
exp system/bdcadmin@bdc full=y grants=y file=D:\export\bdc.dmp log=D:\export\bdc.log compress=N
@echo Export completed at:
@echo
date /T
time /T
rem ************* END OF BATCH FILE *********************
Thank you!You can straight away use this batch file after modifying the exp line with your machine details and schema name.
@echo off
if %1/==:/ goto %2
if NOT %1/==/?/ goto Begin
for %%C in (echo. goto:End) do %%C
:Begin --------------------------------------------------------------
if NOT errorlevel 1 %0 : %OS%Parse MM DD
%0 : %OS%Parse DD MM
:Windows_NTParse ----------------------------------------------------
for /f "tokens=1-4 delims=/.- " %%A in ('date /t') do (
set Dow=%%A&set %3=%%B&set %4=%%C&set YYYY=%%D&goto End)
:Parse --------------------------------------------------------------
for %%C in (md cd) do %%C @tmp@
%COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
call ~tmp2
if NOT errorlevel 1 goto Slash
lfnfor on > "%_D%.-"
ren "%_D%.-" "??? ?? ?? ????"
for %%F in ("??? ?? ?? ????") do set _D=%%F
lfnfor off
:Slash
for %%S in ("%3=%%%4%%" "%4=%%YYYY%%" "YYYY=%%1") do echo set %%S>>~tmp1.bat
for %%S in (%_D%) do call ~tmp1 %%S
if errorlevel 1 goto Cleanup
%COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
call ~tmp2
:Cleanup
for %%C in ("set _D=" cd.. "deltree /y @tmp@ > NUL") do %%C
:End ----------------------------------------------------------------
exp system/oracle file=D:\Backup\PERF_4.2_%yyyy%%mm%%dd%.dmp log=D:\Backup\PERF_4.2_%yyyy%%mm%%dd%.log owner=TEST
**************************************************************************************** -
How to create a batch file to stop/start only essbase services 11.1.2.2
Hi,
I have a requirement to build a batch file to schedule stop or start essbase. This batch files should run daily once. Version 11.1.2.2.
I have tried to prepare a batch file which is calling the default service restart batch StartEssbase.bat and stopEssbase.bat.
Stop process is running fine. But, Start is not success. When I run StartEssbase.bat and stopEssbase.bat manually essbase is restarting successfully.
I tried with the command like START ESSCMD.exe "Password" also. Still it is not working.
Could any one please help with the batch scrpit how can I build to start or stop essbase.
Thanks
Srilatha DasariHi,
You can use these...
Start essbase-------------------------------
REM ----------EssbaseAgent Start----------
net start HyS9ESBAgent11.1.1_hypservice_1
SET CHK46=%ERRORLEVEL%
IF "%CHK46%" NEQ "0" (
ECHO "ERROR IN STARTING THE ESSBASE SERVICE"
EXIT /B 46
) ELSE (
ECHO "STARTING ESSBASE SERVICE WAS SUCCESSFUL"
EXIT /B 0
PAUSE
Stop essbase----------------------------------------
REM ----------Stopping of ESSBASE Service----------
SET ESB_BIN_DIR=E:\Hyperion\products\Essbase\EssbaseServer\bin
SET SRCDIR=F:\Essbase\bin
SET MSHSRC=%SRCDIR%\ShutdownServer.msh
SET SERVERNAME=XXXXXXXX
SET USERNAME=XXXXXX
SET PASSWORD=XXXXX
REM *****************CALLING ESSBASE ENVIRONMENT SCRIPT***********************
CALL %ESB_BIN_DIR%\setEssbaseEnv.cmd
CALL %ESB_BIN_DIR%\ESSMSH %MSHSRC% %USERNAME% %PASSWORD% %SERVERNAME%
SET CHK10=%ERRORLEVEL%
IF "%CHK10%" NEQ "0" (
ECHO ------------------------------------------------------
ECHO [%DATE% %TIME%] ERROR IN STOPPING THE ESSBASE SERVICE
ECHO ------------------------------------------------------
EXIT /B 10
) ELSE (
ECHO ------------------------------------------------------
ECHO [%DATE% %TIME%] STOPPING ESSBASE SERVICE WAS SUCCESSFUL
ECHO ------------------------------------------------------
EXIT /B 0
The maxl is like
login $1 $2 on $3;
alter system shutdown;
exit;
Regards
Snehasis -
Industry standard for database backup time
We have many databases in our company for which our Database backups are forced to be run by System Administrators at 3PM since their tape backups are starting from 4PM.
As a DBA I am suggesting to run all the tape backups late night so that I can schedule my Database bacukps at atleast 10PM daily.
What is the industry standard for running daily database backups time? Can somebody please provide some links for such standards from a authorising body like Gartner, etc?
Thanks in advance.There is no such standard. To have one would be simply implausible.
It would depend massively on your infrastructure and where you take backups to. If it's tape, how fast is your networking to the tape, how fast is your tape drive. If it's disk, how fast is the disk you're backing it up to. For both, it depends on the size of the database, what type of backup you're taking and how loaded your database is, how fast your servers are. There are too many variables.
Only you will know how fast your backups take and whether they're taking longer than they should (based on your observations on how long they usually take). -
I have an SSIS package which loads data from an Excel file into a SQL Database. This SSIS package is triggered by a batch file.
As part of a load test, I have created 20 batch files that run the same package for a different Excel file.
To have these batch files run together, I have created 2 master batch files, one to run them sequentially (using CALL) and the to run them parallely (using START). I do have any issues in both of them.
But when I try to run 5 instances of the same batch file run concurrently (using START XYZ.bat 5 times) only 1 succeeds. CALL XYZ.bat 5 times has no issues.
Is it because during START, the Excel file is opened by 1 batch file and unavailable to the other 4 instances? If yes, then why doesn't SSIS throw an error when I run the package through BIDS keeping the Excel file opened? Is there something I can do to
overcome a FAILURE?
Nelton D'Souza MS BI DeveloperYes, it seems that since you open the same file from multiple processes the error occurs due to the sharing violation.
I guess you will get the error opening several Excel files from BIDS trying to read / write to it if you have two BIDS so it is consistent. Excel disallows multiple access paths by its design.
Arthur My Blog -
How run a batch file from VBS script?
I have written a script in which I create a batch file that I want to run. Running it from the Start menu with "Run..." works fine but I would like to do it automatically from the script. I can't find a command that works but I am a beginner, so I'm hoping someone's got a solution?!
Hi again!
Thank you for your help but I've just discovered that my problem probably doesn't have to do with the way that I call for the batch file. It's more like this:
The batch file is run but it only does its job some of the times... The batch contains one name of a converter application (Convert.exe) and the names of some databases and files. I've been told that the conversion should work if Convert.exe is located in the same folder as the files. Which it also does, if I run the batch from "Run..." but not from my code.
I had it working for a while when I had fiddled (as I said, I'm a beginner at this) with setting some drives, such as userDrv and changing some paths in the script settings. Since I didn't really know what I was doing though, I didn't save these settings when closing down DIAdem and now it's not working again. When it worked, it only worked for the file where my .VBS was saved. The point of the program is to convert files in different folders so that wasn't enough.
Just for clearity: I can't write the name as "C:\My Folder..." because the batch file name and the folder it is situated in is different each time so I have variables for the path and the batch, but that part seems to work. (Call ExtProgram(batFilename_) where batFilename_ includes the path).
So I guess what I need to understand is how the different drives work or maybe I need to somehow change my path settings? -
How to run batch file from oracle forms 9i
Hi everyone.
i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
i have made a batch file which run the sql loader and transfer my data to database.
How to run batch file from oracle forms 9i.
when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
here is my code
Begin
HOST('C:\temp\batchfile.bat');
message('done');
end;
Thanks in advance
regards
sajidthis is my log file, when i run manually.
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: file_to_upload.ctl
There are 2 data files:
Data File: sk.csv
Bad File: sk.bad
Discard File: none specified
(Allow all discards)
Data File: sk1.csv
Bad File: sk1.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table KHAN, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
SR FIRST * , O(") CHARACTER
DATES NEXT * , O(") CHARACTER
AGENT NEXT * , O(") CHARACTER
COUNTRY NEXT * , O(") CHARACTER
TRANSACTIONS NEXT * , O(") CHARACTER
PKR NEXT * , O(") CHARACTER
USD NEXT * , O(") CHARACTER
BANK NEXT * , O(") CHARACTER
Table KHAN:
11088 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 132096 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 11088
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Jul 01 23:27:53 2010
Run ended on Thu Jul 01 23:27:54 2010
Elapsed time was: 00:00:00.63
CPU time was: 00:00:00.17 -
Batch file seetup to run in event viewer not working.
Hi everyone,
Long story short
we have some new Security monitoring software that we use for our clients WHich is written in .net2 and can't pick up the IDs for failures in event viewer as they are in .net4. so what we have done is set up a series of batch files to run through task scheduler
and send the event ID to Application in event viewer that o ur security monitoring software can read.
This has worked perfectly on all of our servers but for some reason on Windows 7 machines when the batch file is run nothing happens in Application under Event Viewer.
e.g:
Trigger Details
Status
On an event On event- Log:Microsoft-WindowsBackup, Source: Microsoft-WindowsBackup, Event ID100 Enabled
Action Details
Start a program "C:\PandMon\Microsoft Backup Failure ID100.bat"
This is the batch file:
eventcreate /ID 100 /L APPLICATION /T information /SO Backup /D "Microsoftsoft SBS Backup Failed - Id 100"
Any help here would be greatly appreciated.
Cheers :)Your first step must be to check if the batch file actually runs, e.g. like so:
@echo off
if not exist c:\Logs md c:\Logs
echo %date% %time% >> c:\Logs\Log.txt
eventcreate /ID 100 /L APPLICATION /T information /SO Backup /D "Microsoftsoft SBS Backup Failed - Id
100" 1>>c:\Logs\Log.txt 2>>&1
echo. >> c::\Logs\Log.txt
When you examine the log file then you probably get a good idea about the cause of your problem. -
Closing Console window while running Java application from Batch file
Hi all,
I have made a small application using Java swings,now i have made a jar file of my application and calling this jar file through batch file,when user clicks on that batch file it runs "java -jar applicationname.jar" command,but problem is that when i run that file from batch file it opens Dos console window at baclk of the screen which looks weird for a desktop application,i dnt want that Dos console window visible at the backend while my application is running,i have searched regarding this on google but found nothing usefull,if anybody can please help regarding that it will be a great releif for me,i have been stuck on this problem from last two days.
Thanks.
Simerwarnerja wrote:
georgemc wrote:
warnerja wrote:
start java -jar applicationname.jar
That'll pop up another consoleI'm under the impression that the console window he is seeing is the one which cmd.exe opens when it is executing the batch file. And that batch file won't return until the java process has completed because he didn't start it in the background to let the batch file continue and terminate.
So I don't think just simply substituting java with javaw will do much good either. Still think he needs a "start" command in that batch file.
So now he can try:
start java -jar ...
or
start javaw -jar ...Fair point -
Windows task scheduler to run batch file running a java program
I have created a batch file that runs my SendEmail program. The batch file is in the same directory as the java program. The only line in the batch file is
java SendEmail
This works fine from the command prompt but from the windows task scheduler it fails to function. Any help on how I can overcome this problem will be greatly appreciated.
THanksLooks okay. The classpath is set, too, I guess? Btw, try running javaw instead of java. I may err, but I think it can show a console, so you can watch any error messages.
Maybe you are looking for
-
500 internal server error in EPMA and Calc manager in 11.1.2.1
We are getting the below errors in EPMA log and Calc Manager log and unable to determine the cause of it. It seems like this particular issue was cause while deploying a calc manager rule for an HFM app. The issue resolved itself and the errors went
-
When I am printing daily calendars and I at printing from a certain date (i.e. selecting the 'On Date' option), the day showed in the preview is always two days before the date I selected. This carries on into the actual printing, where it starts to
-
"Abstract" method in a non-abstract class
Hi all. I have a class "SuperClass" from which other class are extended... I'd like to "force" some methods (method1(), method2, ...) to be implemented in the inherited classes. I know I can accomplish this just implementing the superclass method bod
-
I want to restrict the tv content on my son's iPad, especially as we've just enabled family sharing. Unfortunately, in the UK, it seems you have the options of allowing all shows, allowing none at all or allowing those with a caution rating. There
-
Float / Double Decimal Display
How do you get a float or double to display a certain amount of decimal places? For example, dealing with money, to have it be displayed as $1.30 instead of $1.3