Manage Learn to apply best practices and optimize your operations.

How to run an Oracle database backup script during off hours

Want to run an Oracle database backup script during off hours? Learn how with these samples scripts from an Oracle expert.

I am working on Oracle Developer. What is a sample script that can start the database backup at the off hours, like after 10 pm, without my physical presence? The script should shut down the database, copy all the relevant files to the specified location, and it must startup the database. The size is 80 GB.

You did not specify the platform the Oracle database runs on. On Windows, the script can be as simple as one line:

 net start OracleServiceSID

Where SID is replaced with your Oracle SID. On Unix/Linux, the script is a little more complicated but something similar to (for CShell):

 #!/bin/csh # setenv ORACLE_SID=SID setenv ORACLE_HOME=/path_to_Oracle_Home_dir setenv LD_LIBRARY_PATH=$ORACLE_HOME/lib set path=($ORACLE_HOME/bin $path) sqlplus sys/pswd  << EOF startup EOF

You will have to make appropriate substitutions for your environment.



This was last published in February 2010

Dig Deeper on Oracle database backup and recovery

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.