Solved

Hot Backup

Posted on 2001-09-06
7
1,187 Views
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 ....

0
Comment
Question by:sokobans
7 Comments
 
LVL 3

Expert Comment

by:mathavra
Comment Utility
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.
.

0
 

Author Comment

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

0
 
LVL 3

Expert Comment

by:mathavra
Comment Utility
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)


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

 
LVL 3

Accepted Solution

by:
UsamaMunir earned 95 total points
Comment Utility
Hi!
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.

1- PLACE YOUR DATABASE IN ARCHIVELOG MODE:

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;

2- TAKE A TABLESPACE BY TABLESPACE BACKUP OF THE DATAFILES:

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.

3- BACKUP THE ARCHIVED REDOLOG FILES:

SVRMGR> archive log stop

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

SVRMGR> archive log start

4- BACKUP THE CONTROL FILE

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

UsamaMunir




0
 

Author Comment

by:sokobans
Comment Utility
Ok, i'm test this....

But whats happen with the restore....

What is the procedure ?

0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
0
 
LVL 6

Expert Comment

by:Mindphaser
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

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.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

743 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

18 Experts available now in Live!

Get 1:1 Help Now