Check this link too. May help in puttng more bells and whistles if you are interested.
http://www.informit.com/ar
I would test out the script from the first link before I look for additional functionality.
Main Topics
Browse All TopicsDatabase fails to reach the open state after Oracle 10g database control job (SQL script) to perform a cold backup runs. All files are copied but the database doesn't reach the open state. I have to manually log into the database via sqlplus and type "startup" to bring the database online. The problem is that I need this job to be fully automated to run in the middle of the night when support personnel aren't on site. So manually having to bring the database to the open state is an issue.
The database is Oracle 10g R2 running on Windows 2003 Server Standard Edition. What is really odd is that I have done a reinstall of the database a few times and on each occasion the backup script I'm using runs flawlessly for a month or two without any problems then all of a sudden the database stops reaching the open state when the script is run. I have submitted this problem to Oracle support on a few occasion and I have yet to get a solution to this problem.
The script I am using is as follows:
shutdown immediate
host xcopy c:\oracle\product\10.2.0\a
host xcopy e:\oradata e:\oracle_backups\cold_bac
host xcopy c:\oracle\product\10.2.0\d
startup;
I am using Oracle 10g database control to create a SQL script job that runs a SQL script file that is stored on the hard drive through the @backup.sql format. The file that is being executed has the code listed above. I've also tried embedding the full script in the command window rather than referencing the SQL script file and I get the same result. Each time this scheduled SQL script job runs via database control the database fails to open after completion. The most interesting point here is that if I launch sqlplus and run this script manually (@backup.sql), it runs and the database opens every time. So the problem only occurs when the SQL script is launch via the 10g database control.
The most recent feedback I had received from Oracle Support was to create a "host command" job rather than a "SQL script" job but no details were giving on how to accomplish this task. Does anyone know how to accomplish this via a host command job in the 10g Database Control? or any other solutions would be appreciated.
I'm getting ready to head out for the weekend so it will probably be the beginning of the week before I can test any solutions so please be patient. Thanks in advance for your help!
Regards,
Jim
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Check this link too. May help in puttng more bells and whistles if you are interested.
http://www.informit.com/ar
I would test out the script from the first link before I look for additional functionality.
Use the windows command line utility oradim to shutdown and startup the database
http://www.oracleutilities
http://www.adp-gmbh.ch/ora
http://www.psoug.org/refer
techji - We also have a RMAN backup job running through the dbconsole but we would also like to have a file copy backup. The domain policy that this server is part of doesn't allow us to use the windows scheduler so I'm limited to using the scheduling features of the dbconsole.
MohanKNair - I don't understand how this would help. Can you be more specific?
Did you try running a bat file using dbconsole scheduler ? then you can have more flexibility in scripting various commands.
--------------------------
here is an example, you can do all this from dbconsole. But just to give you a clear idea of what is being done here.
begin
dbms_scheduler.create_sche
schedule_name => 'daily_at_4am_except_monda
repeat_interval => 'FREQ=DAILY; INTERVAL=1; BYDAY=TUE,WED,THU,FRI,SAT,
comments => 'schedule to run daily at 4am except on mondays');
dbms_scheduler.create_prog
( program_name => 'backup_database',
program_type => 'EXECUTABLE',
program_action => 'd:\oracle\product\admin\d
enabled => TRUE,
comments => 'Backup dw database via hot backup.'
);
dbms_scheduler.create_job (
job_name=>'daily_backup',
program_name =>'backup_database',
schedule_name=> 'DAILY_AT_4AM_EXCEPT_MONDA
enabled => true,
comments => 'backs up the dw daily at 4am except on for mondays.'
);
end;
/
It is easier to handle command line utilities when using .bat files to schedule jobs. Since oradim is a command line utility it can be used in batch files.
The steps for taking a cold backup can be
1) Use oradim to shutdown the database
2) Copy datafiles and log files to destination folder
3) Use oradim to startup the database
techji:
Okay so I tried using your first solution that uses the .bat file for the backup. I'm getting an error message in the output and I have attached it. The script connects to the database and shuts it down. It then copies the init and pwd file BUT it fails to copy any of the dbf files. It then starts the database back up. Here's the output from the log file.
----------BEGIN FULL COLD BACKUP OF DB----------
Mon 09/11/2006
04:28 PM
Generating cold backup script...
Mon 09/11/2006
04:28 PM
Shutting down...
Backing up...
E:\scripts>REM Script to take full cold database backup
E:\scripts>REM generated by make_cold_backup_scr.sql
E:\scripts>REM does not back up tempfiles
E:\scripts>REM
E:\scripts>set oracle_home=c:\oracle\prod
E:\scripts>set backup_dir=e:\backuptemp
E:\scripts>SP2-0640: Not connected
'SP2-0640:' is not recognized as an internal or external command,
operable program or batch file.
E:\scripts>REM Copy init.ora and pwd files
E:\scripts>copy c:\oracle\product\10.2.0\d
1 file(s) copied.
E:\scripts>copy c:\oracle\product\10.2.0\d
1 file(s) copied.
Starting up...
Mon 09/11/2006
04:28 PM
Succesfully completed.
-----------END FULL COLD BACKUP OF DB-----------
Any ideas?
TEMP tablespace can be skipped from backups. You can always recreate a TEMP tablespace during recovery.
If you want, you can put the following sql in shutdown.sql
connect / as sysdba
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
shutdown immediate;
exit;
This will create a trace file in udump directory. If you open it, there you will find a sql to rebuild a control file and the following sql at the bottom. Just an easy way to find what all TEMP tablespace consisted of.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
PL/SQL Script
http://www.experts-exchang
Business Accounts
Answer for Membership
by: techjiPosted on 2006-09-08 at 17:19:11ID: 17483839
Unless you want to use RMAN I wouldnt choose to use dbconsole for backups.
ht.com/col d_backup_s cr.php
Here is a script which is pretty well written -
http://toolkit.rdbms-insig
Use windows SCHEDULER to run this.