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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now