Question

Database fails to open after running a schedule SQL script (via database control) to perform a cold backup

Asked by: slimjim28

Database 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\admin e:\oracle_backups\cold_backups\9 /S /Y /I /O;
host xcopy e:\oradata e:\oracle_backups\cold_backups\9 /S /Y /I /O;
host xcopy c:\oracle\product\10.2.0\db_1\database\PWDoracle.ora e:\oracle_backups\cold_backups\9 /S /Y /I /O;
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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-09-08 at 12:17:09ID21982975
Tags

script

,

sql

Topic

Oracle Database

Participating Experts
2
Points
125
Comments
11

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. oracle hot and cold backup
    how can we take hot and cold backup in oracle 8.1.7
  2. Oracle 9i cold backup restore emergency help
    I could really use some fast answers to this question. Thanks! I have situation where i need to restore the previous day’s cold backup. Running Oracle 9i. The problem is I do not have any sqlplus login rights to the database I would like to restore. I did not setup this data...
  3. cold backup
    can you help me to take cold back up of a database step by step?
  4. cold backup
    HI I have a very simple question that when doing the cold backup of oracle database in unix where can I cp the controlfile,datafiles,logfiles. On the same server or whereelse? what other files are important to backup? thanks

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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.

Here is a script which is pretty well written -
http://toolkit.rdbms-insight.com/cold_backup_scr.php

Use windows  SCHEDULER to run this.

 

by: techjiPosted on 2006-09-08 at 17:22:52ID: 17483849

Check this link too. May help in puttng more bells and whistles if you are interested.
http://www.informit.com/articles/article.asp?p=30348&seqNum=4&rl=1

I would test out the script from the first link before I look for additional functionality.

 

by: MohanKNairPosted on 2006-09-10 at 04:50:52ID: 17489170

 

by: slimjim28Posted on 2006-09-11 at 06:23:15ID: 17494252

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?

 

by: techjiPosted on 2006-09-11 at 07:10:44ID: 17494630

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_schedule(
       schedule_name   => 'daily_at_4am_except_monday',
       repeat_interval => 'FREQ=DAILY; INTERVAL=1; BYDAY=TUE,WED,THU,FRI,SAT,SUN; BYHOUR=4',
       comments        => 'schedule to run daily at 4am except on mondays');
 
  dbms_scheduler.create_program
    (  program_name   => 'backup_database',
       program_type   => 'EXECUTABLE',
       program_action => 'd:\oracle\product\admin\dw\scripts\backup_dw.bat > nul',
       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_MONDAY',
    enabled      => true,
    comments     => 'backs up the dw daily at 4am except on for mondays.'
  );
end;
/

 

by: MohanKNairPosted on 2006-09-11 at 08:03:00ID: 17495102

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

 

by: slimjim28Posted on 2006-09-11 at 13:40:06ID: 17497686

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\product\10.2.0\db_1

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\db_1\database\initoracle.ora e:\backuptemp\initoracle.ora
        1 file(s) copied.

E:\scripts>copy c:\oracle\product\10.2.0\db_1\database\pwdoracle.ora e:\backuptemp\pwdoracle.ora
        1 file(s) copied.
Starting up...
Mon 09/11/2006
04:28 PM
Succesfully completed.
-----------END FULL COLD BACKUP OF DB-----------

Any ideas?

 

by: techjiPosted on 2006-09-11 at 13:51:48ID: 17497780

E:\scripts>SP2-0640: Not connected
'SP2-0640:' is not recognized as an internal or external command, operable program or batch file.

It didn't connect to the database. Can you check the user/pass you used ?

 

by: slimjim28Posted on 2006-09-11 at 14:12:14ID: 17497908

It was the account info.  I was running the script from the server so I didn't need the @orcl on the connect string.  

Are there any ramification for not having the temp01.dbf file?

I will try to schedule the execution of the .bat file in the morning.  I'll keep you posted.  Thanks for your help!

 

by: techjiPosted on 2006-09-11 at 14:28:37ID: 17498022

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\ORADATA\CLT01\TEMP01.DBF'
     SIZE 20971520  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
-- End of tempfile additions.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...