Você está na página 1de 3

Doc ID: Note:149286.

1 Content Type: TEXT/X-


Subject: How To Create a Standby HTML
Database Creation Date: 02-MAY-2001
Type: REFERENCE Last Revision
04-MAY-2004
Status: PUBLISHED Date:

goal: How To Create a Standby Database



fact: Backup / Recovery (BR)

fact: Oracle Server - Enterprise Edition

fix:

On the Primary database:

1. Backup datafiles on the primary system.

2. ALTER DATABASE CREATE STANDBY CONTROLFILE AS ctlfilename


--Note: where ctlfilename is name of the controlfile

3. ALTER SYSTEM ARCHIVE LOG CURRENT


(This insures consistency in backup, standby controlfile, and logfiles)

4. Transfer all the duplicate files to the standby site.

5. Use the same naming convention, or in the initSID.ora for the


standby, use
the following parameters:

DB_FILE_STANDBY_NAME_CONVERT (V7)
LOG_FILE_STANDBY_NAME_CONVERT (V7)
or
DB_FILE_NAME_CONVERT (V8)
LOG_FILE_NAME_CONVERT (V8)

--Note: You must use the above parameters if the standby system is on
the same
machine as the primary.

--Note: If the above initSID.ora parameters are used, you must use:
ALTER DATABASE RENAME FILE oldname TO newname
When the standby is activated, use:
ALTER DATABASE RENAME FILE oldname TO newname

If a data or log file is renamed at the standby site, or the AS clause


is used
in an ALTER DATABASE CREATE DATAFILE, the conversion parameters will not
apply
to that file.

6. On the Standby database:

Put the standby in recovery mode, using the Oracle Server Manager
utility.

STARTUP NOMOUNT PFILE=/full/path/to/initSID.ora


ALTER DATABASE MOUNT STANDBY DATABASE
RECOVER STANDBY DATABASE

Then apply archive logs as appropriate.

SOME NOTES:
===========

- The standby database must be kept in recovery mode until it is needed


(if
ever).

- To keep the standby current, manually copy archived redo logs as they
are
generated on the primary, then apply them to the standby. (This can be
accomplished best by a batch job).

- Any physical changes that occur on the primary must be accomplished on


the
standby as well. Added datafiles are added to the standby controlfile
automatically (via redo logs). The file must be manually copied to the
standby
system. If the standby can't find a datafile, recovery will stop. Use
ALTER
DATABASE CREATE oldname AS newname or physically copy the datafile to
the
standby system.

- To maintain (only) a subset of the primary database, ALTER OFFLINE


unneeded
datafiles on the standby system; Oracle will just maintain the online
files. Offlined files are not recovered.

- You can add or drop log files on the primary without affecting the
standby.

- If an additional thread is enabled on the primary (using MTS or OPS)


you must
recreate the standby controlfile (see (2) above).

- If ALTER DATABASE CLEAR UNARCHIVED LOGFILE is performed on the


primary, the
standby is rendered invalid. This also occurs if ALTER DATABASE OPEN
RESETLOGS
is done. This is because the standby doesn't then have the archivelogs
it needs
to continue.

- If you do an ALTER DATABASE CREATE CONTROLFILE on the primary, you


must also
create a new controlfile for the standby. First, shut down the standby.
Then
do an ALTER DATABASE ARCHIVE LOG CURRENT so the standby will be current
on redo.
(Then copy the files over to the standby site). Then, at the standby
site,
STARTUP NOMOUNT, then ALTER DATABASE MOUNT STANDBY DATABASE. Finally,
RECOVER
STANDBY DATABASE.

TO ACTIVATE THE STANDBY DATABASE:


=================================

To activate the standby, first try to copy the most recent archive logs
over to
the standby, and apply them. Then ALTER DATABASE ACTIVATE STANDBY
DATABASE

Then shutdown the standby to reset file headers and clear all buffers.
You
can't copy online redo logs from the primary to the standby.

The standby is dismounted when activated.

The standby bit in the controlfile is now set, so you can never go back
- the
standby is now your primary database. Since the redo log sequence was
reset
when the standby was opened, it is a good idea to take a full backup at
this
point.

Você também pode gostar