Hot Backup

Posted on 2001-09-06
Last Modified: 2010-08-05
I need the process to hot bakcup my database, but i need this process step by step, if someone can give an answer or a link, or a document, i really aprecciate....

Thans very much...

I know that i have to put the db in archive mode...
I know that the tablespace follow a begin backup, copy tablespace, end backup or something like that...
I know existe a process for the .logs
I know exists a process for the control...

But i need an specific procedure, with points and steps..

i need this ....

Question by:sokobans
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6461998
Here is a note from Oracle. If you need more info. please let me know.

Doc ID:  Note:66405.1
Subject:  Performing Operating System Backups of an Oracle 8 database
 Content Type:  TEXT/PLAIN
Creation Date:  03-NOV-1998
Last Revision Date:  23-JUL-2001


There are two fundamentally different ways to backup an Oracle8 database.
The first method is 'Operating system backups' and the second method is
often referred to as 'Server Managed Recovery'.

Operating system backups are performed using operating system commands and/or
utilities and can be written to disk or tape. This backup method
is documented in this article.  It is the simpler of the two methods and is often
most applicable where you have a simple environment, e.g. few servers and few

'Server Managed Recovery' (SMR) the actual backing up of Oracle data to backup
media is handled by a thread within the Oracle server executable, i.e. the
database software itself writes the data from within the database to backup
media. This backup method is controlled by the client tool called Oracle
Recovery Manager (RMAN). This backup method is more complex to set up and
administer and it is often more applicable to a more complex environment,
e.g. many databases. This method is not covered in this article.

Cold backup
This is when the database is shutdown while the backup takes place. It is the
simplest backup method.

Hot backup
This is when the database is running and fully available to users while the
backup is taking place. It is slightly more complex to perform and is usually
only done if the database cannot be shutdown for cold backups, e.g. if the
database is supporting a business function which needs 24x7 availability.

Archivelog mode
When you operate your database in archive log mode, the filled online redo log
files are archived before they are reused in the cycle. When in archivelog
mode, the database can be completely recovered from both instance and disk
failure. The database can also be backed up when open and available for use.
However, additional administrative operations are required to maintain the
archived redo logs.

Noarchivelog mode
When you operate the database in noarchivelog mode, the filled online redo logs
are not archived before being overwritten. Typically, the only recovery option
is to restore the whole database. The only backup option is to backup the
database while completely closed.

The next three sections detail:

  A. How to perform COLD backups
  B. How to perform HOT backups
  C. How to schedule either of the above.

For the purposes of this article, the following assumptions are made

  - the oracle_home is c:\orant
  - all database files we need to backup are stored in c:\orant\database
  - the instance name (SID) is ORCL
  - the script files are stored in c:\scripts
  - database files are backed up to c:\backup

In the examples below, the files are copied to a directory c:\backup. Once
backed up to here, the files can be backed up to tape as required by any backup
software which can copy files from disk to tape.


What to backup.

It is crucial to backup all datafiles and the control file(s).
You can determine the names and locations of these files by

  select name from v$datafile
  select name from v$controlfile

It is also very useful to backup your parameter file.
Note that Oracle does not recommend backing up your online redo log files.
But if your database is running in NOARCHIVELOG mode, you can also backup
the online redologs. This will make the recovery a simple matter of restoring
all files and startup the database without having to use RESETLOGS to recreate
the missing redologs.

In the example script below, our database has 4 datafiles and 1 control file

1. Create a file called 'backup.bat' containing

       c:\orant\bin\svrmgr30 @c:\scripts\shutdown.sql
       net stop OracleServiceORCL /Y
       copy c:\orant\database\sys1orcl.ora c:\backup\
       copy c:\orant\database\usr1orcl.ora c:\backup\
       copy c:\orant\database\tmp1orcl.ora c:\backup\
       copy c:\orant\database\rbs1orcl.ora c:\backup\
       copy c:\orant\database\ctr1orcl.ora c:\backup\
       net start OracleServiceORCL
       c:\orant\bin\svrmgr30 @c:\scripts\startup.sql

2. Create a file called 'shutdown.sql' containing

       connect internal/password
       shutdown immediate

3. Create a file called 'startup.sql' containing
       connect internal/password
4. You can now perform a full cold backup of your database by typing
c:\scripts\backup.bat at a Windows NT Command Prompt. See Section C for
how to schedule this.


You can only perform a hot backup if you are in archivelog mode.

What to backup.
You need to backup all datafiles, but you need to know which datafiles belong
to each tablespace. You can discover this using

  select file_name, tablespace_name from dba_data_files;

You should also perform a backup of the control file (see below)
Note that Oracle does not recommend backing up your online redo log files.

In the example below, we have 4 tablespaces, each consisting of 1 or 2

1.  Create a  file 'backup.bat' which contains the line

       c:\orant\bin\svrmgr30 @c:\scripts\backup.sql

2. Create a file backup.sql containing

 connect system/manager
 alter tablespace system begin backup;
 host c:\orant\bin\ocopy80 c:\orant\database\sys1orcl.ora c:\backup\sys1orcl.ora
 alter tablespace system end backup;
 alter tablespace user begin backup;
 host c:\orant\bin\ocopy80 c:\orant\database\usr1orcl.ora c:\backup\usr1orcl.ora
 host c:\orant\bin\ocopy80 c:\orant\database\usr2orcl.ora c:\backup\usr2orcl.ora
 alter tablespace user end backup;
 alter tablespace temp begin backup;
 host c:\orant\bin\ocopy80 c:\orant\database\tmp1orcl.ora c:\backup\tmp1orcl.ora
 host c:\orant\bin\ocopy80 c:\orant\database\tmp2orcl.ora c:\backup\tmp2orcl.ora
 alter tablespace temp end backup;
 alter tablespace rollback begin backup;
 host c:\orant\bin\ocopy80 c:\orant\database\rbs1orcl.ora c:\backup\rbs1orcl.ora
 alter tablespace rollback end backup;

 alter system switch logfile;

 alter database backup controlfile to 'c:\backup\ctrl1orcl.ora';
 alter database backup controlfile to trace;

3.  You can now perform a full hot backup of your database by typing
c:\scripts\backup.bat at a Windows NT Command Prompt. See Section C below for
instructions to schedule backup.bat.

C. Scheduling the command files to run at a specified time.
The simplest way to schedule the above jobs is to use the built in NT scheduler
using the 'at' command eg

at 23:00 c:\scripts\backup.bat

will schedule the backup script to run at 11pm tonight.

For more information about the Windows NT 'at' command, consult the
Windows NT online help.


Author Comment

ID: 6462332
This is an excelent article but i had a little detail, my database is in linux and i believe that exist some differentes....


Expert Comment

ID: 6462434
Not much though. For example, for the hot backups the following things are the only ones you need to change:

1) file/directory paths from '\' to '/'.
2) Oracle and Operating System commands equivalent in UNIX

      NT                        UNIX

      svrmgr30.exec             svrmgrl
      ocopy                     cp     (unix command)

      BAT files (backup.bat)    any name as long as it is a
                                executable (chmod +x

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.


Accepted Solution

UsamaMunir earned 95 total points
ID: 6463052
Online backups are also called as ARCHIVELOG backups. Your database must be running in archivelog mode
if you want to take online backups. Here are is the Step by Step Process.


SVRMGR> connect internal as sysdba
SVRMGR> startup mount db1;
SVRMGR> alter database archivelog;
SVRMGR> archive log start;
SVRMGR> alter database open;

Following command will display the current archive log status of the database within server manager.

SVRMGR> archive log list;


put your tablespaces one by one in backupmode, physically copy the datafiles asociated with the tablespace
to a different location, and put the tablespaces back in normal mode.

SVRMGR> alter tablespace SYSTEM begin backup; -- put tablespace in backup mode
SVRMGR> !tar -cvf /dev/rmt/0hc /db01/oracle/cci/sys01.dbf  -- Physically copy the datafile at a different
location (UNIX)
SVRMGR> alter tablespace SYSTEM end backup;

Repeat the above ste for all your tablespaces, one by one.


SVRMGR> archive log stop

--Now physically copy archive log files to a different location, you can use the !tar command here as

SVRMGR> archive log start


SVRMGR> alter database backup controlfile to '/db01/oracle/CCI/CCONTROLFILE.BAK'

These are the standard steps taken while taking the hot database backups. Note that we backup tablespaces
one by one, we can also do that atonce by putting all the tablespaces in backup mode, but this is recomended
coz it will generate less redo.

I hope it helps



Author Comment

ID: 6464808
Ok, i'm test this....

But whats happen with the restore....

What is the procedure ?

LVL 49

Expert Comment

ID: 7064014
Hi sokobans,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days.  I will suggest to:

    Accept UsamaMunir's comment(s) as an answer.

sokobans, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will followup.

Please do not accept this comment as an answer!

EXPERTS: Your input for closing recommendations are REQUESTED.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 7091409
Force accepted

** Mindphaser - Community Support Moderator **

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question