Link to home
Start Free TrialLog in
Avatar of sokobans
sokobans

asked on

Hot Backup

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 ....

Avatar of mathavra
mathavra

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
Type:  BULLETIN
Status:  PUBLISHED
 Content Type:  TEXT/PLAIN
Creation Date:  03-NOV-1998
Last Revision Date:  23-JUL-2001
 

INTRODUCTION

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
databases.

'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.
 
DEFINITIONS

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.

PROCEDURES
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.

A. PERFORMING A FULL COLD BACKUP.

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

       SET ORACLE_SID=ORCL
       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
       exit

3. Create a file called 'startup.sql' containing
       connect internal/password
       startup
       exit
 
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.

B.  PERFORMING A FULL HOT BACKUP.

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
datafiles.

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

       SET ORACLE_SID=ORCL
       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.
.

Avatar of sokobans

ASKER

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

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

   Ex.
      NT                        UNIX

      svrmgr30.exec             svrmgrl
      ocopy                     cp     (unix command)

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


ASKER CERTIFIED SOLUTION
Avatar of UsamaMunir
UsamaMunir

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, i'm test this....

But whats happen with the restore....

What is the procedure ?

Avatar of DanRollins
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
Force accepted

** Mindphaser - Community Support Moderator **