Download Whitepaper DP5.5 and Oracle Data Guard

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Serializability wikipedia , lookup

Microsoft Access wikipedia , lookup

DBase wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

IMDb wikipedia , lookup

Btrieve wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

SQL wikipedia , lookup

Ingres (database) wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

Oracle Database wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
HP Open View Storage Data Protector A.05.50
Backing up an Oracle Data Guard environment
Executive Summary .............................................................................................................................. 2
Solution Description ............................................................................................................................. 3
Solution Description ............................................................................................................................. 3
Oracle Data Guard Overview ............................................................................................................... 4
Configure Oracle Data Guard under Data Protector ................................................................................ 6
Backing up Oracle Data Guard............................................................................................................. 9
I.
Backing up the Primary database............................................................................................... 9
II.
Backing up the Standby database.............................................................................................. 9
III. Backup with RMAN................................................................................................................ 13
Restore ............................................................................................................................................. 15
I. - Instantiation of the Primary database after Failover ........................................................................ 15
II. – Datafile Loss of the Primary database ......................................................................................... 22
III. – Loss of a data file on the Standby ............................................................................................. 24
Summary .......................................................................................................................................... 27
Appendix ......................................................................................................................................... 28
Appendix A: Data Protector session report of a Standby database backup .......................................... 28
Appendix B: Target database restore using RMAN ........................................................................... 31
Appendix C: Useful Recovery Catalog Views/ V$ views.................................................................... 33
For more information.......................................................................................................................... 35
1
Executive Summary
This whitepaper describes how to use HP Open View Storage Data Protector A.05.50 to backup an
Oracle Data Guard environment.
The major benefit of Oracle Data Guard from a backup administrator perspective is the offload of
production database backups to a standby database in order to minimize the impact of running backups
to the production system. In case media recovery will be required on the Production site these backups can
be used to directly restore and recover the production system.
While HP Open View Storage Data Protector A.05.50 is provided with an interface to backup an Oracle
database online the backup and restore of Oracle Data Guard requires additional configuration steps,
which are explained in the paper on typical scenarios.
2
Solution Description
The paper contains instructions how to backup and restore Oracle Data Guard components using HP
Open View Storage Data Protector A.05.50 with the Cell Manager installed on a Windows 2000 server
and Oracle Data Guard 10g installed on HPUX 11.23 PA-RISC. Described instructions and procedures
are working on other platforms as well – please check the Data Protector A.05.50 Platform and Integration
support matrix. An updated version of this matrix is available on the web under
http://www.openview.hp.com/products/datapro/spec_0001.html
Supported Oracle releases are Oracle 9i and Oracle 10g.
Figure 1 illustrates the principle structure of an Oracle Data Guard environment. We assume that both
systems got an HP Open View Storage Data Protector A.05.50 Oracle Integration Agent installed and
belong to one and the same Data Protector cell.
Figure 1 Oracle 10g Data Guard Testing Environment
Oracle Data Guard was installed in the following environment:
•
•
•
•
•
Hardware
: 2x RP4440
Operating System: HP-UX 11.23 PA-RISC 64bit
Oracle version : Oracle 10g Enterprise Edition Release 10.1.0.3.0 – 64bit
Data Protector
: A.05.50
Oracle Recovery Catalog: Oracle10g running on Windows 2000 (oracle3)
Hostname
oracle1
oracle2
Oracle3
Oracle Database
Type
Physical Standby
Primary
Recovery Catalog
DB Unique Name
TNS Alias
DG1_stdby
DG1
RCAT
DG1_DP
DG1_DP
RCAT_ORACLE3
3
Oracle Data Guard Overview
Data Guard enables and automates the management of a disaster recovery solution for Oracle databases
located on the same campus or across the continent. Data Guard consists of a production database (also
known as the primary database) and one or more standby database(s), which are consistent copies of the
production database.
A standby database can be either a physical standby database or a logical standby database. A physical
standby database provides a physically identical copy of the primary database, with on-disk database
structures that are identical to the primary database on a block-for-block basis. The database schema,
including indexes, is the same. A physical standby database is kept synchronized with the primary
database by recovering the redo data received from the primary database.
A logical standby database contains the same logical information as the production database, although
the physical organization and structure of the data can be different. It is kept synchronized with the primary
database by transforming the data in the redo logs received from the primary database into SQL
statements and then executing the SQL statements on the standby database. A logical standby database
can be used for other business purposes in addition to disaster recovery requirements.
Physical Standby
Database
Sync or Async
Redo Shipping
Backup
Production
Database
Redo Apply
Logical Standby
Database
Transform
Redo to SQL
... up to 9 Standby
Databases supported
DIGITAL DATA STORAGE
DIGITAL DATA STORAGE
Network
Open for
Reports
SQL
Apply
Figure 2 Oracle Data Guard with Physical and Logical Standby database
Oracle Data Guard offers two easy-to-use methods to handle planned and unplanned outages of the
production site. The methods are called switchover and failover, which can be easily initiated directly
through SQL.
Switchover
The switchover is a planned role reversal of the primary and standby databases, to handle planned
maintenance on the primary database. A switchover operation does not require re-instantiation of the
database. This allows the primary database to assume the role of a standby database almost
immediately. As a result, scheduled maintenance can be performed more easily and frequently. For
example, switchover may be used to perform an upgrade on the primary site by switching over all of
the database clients to the standby.
4
A switchback operation is nothing more than a subsequent switchover operation to return the roles to
their original state.
Failover
Failover is the operation of taking the primary database offline on one site and bringing one of the
standby databases online as the new primary database. A failover operation can be invoked when
an unplanned catastrophic failure occurs on the primary database.
DG failover is a series of steps to convert a standby database into a production database. The
standby database assumes the role of production. After the failover, the secondary site contains the
production database. The former production database needs to be recreated as a new standby
database.
In a Data Guard environment, backups of data files and archive logs taken on the primary or standby
system are usable on either system for recovery. The process of backing up data files and archive logs
can be offloaded to the standby system to minimize the impact of backup operations on the
production system. These backups can be used to recover the primary or standby database.
Both the primary database and standby database should use the same recovery catalog. Even though
these databases share the same DBID, RMAN is able to differentiate the standby database from the
primary. Note that you do not need to register the standby database in the catalog, just the primary
database.
5
Configure Oracle Data Guard under Data Protector
Before it is possible to run an Oracle backup with Data Protector, the Oracle instance needs to be
configured for Data Protector. Within a Data Guard environment two instances exist - Primary and
Standby – and need to be configured for Data Protector.
While the configuration of the Primary instance is like the configuration of a normal Oracle instance
the Standby instance requires a manual configuration.
On both systems follow the steps below:
•
•
•
Install the Data Protector Oracle Integration agent on the system
Link Data Protector’s Oracle Integration library to Oracle’s Media Management API library
Add the Oracle user as member of Data Protectors Admin group
For detailed information about these steps please refer to the Data Protector Integration Guide for
Oracle (Web download under http://ovweb.external.hp.com/lpe/doc_serv).
Now start Data Protector GUI and configure the Primary instance (orcale2) for Data Protector in the
same way like a normal Oracle integration (see Figure 3).
Figure 3 Primary database configuration
After successful completion of this step, two configuration files are created on the Data Protector Cell
Manager under:
<DP_HOME>\config\server\integ\config\Oracle8
/etc/opt/omni/server/integ/config/Oracle8
The created files are:
<Full qualified hostname>%_OB2_GLOBAL
< Full qualified hostname>%<SID>
6
(Windows)
(HPUX/Sun Solaris)
Lists all configured Instances
Configuration details of <SID>
Figure 4 below lists the configuration files on the used setup as an example.
Figure 4 Primary instance - Configuration Files
Now copy both files into the same directory and replace the primary system name (oracle2 in our
example) by the standby system name (oracle1), so you should have now 4 files listed as seen in
Figure 5. There is no need to modify the contents of the files.
Figure 5 Primary and Standby Configuration Files
CAUTION
It is required to have the same Oracle Configuration settings for Primary
and Standby instance. ORACLE_HOME, ORACLE_SID, DBID might be the
same (Oracle Data Guard requirements), but database connection string is
not identically as a default – see details below how to configure tnsnames
resolution.
Data Protector stores the connection strings in encrypted way. In case primary and standby instance
are using different connection strings the described setup will fail.
7
Therefore either adds a new identifier to both tnsnames configuration files or uses an exiting one and
make sure that it exists on both systems and always points to the LOCAL instance. Use this new
identifier for your Data Protector / Oracle Integration configuration like shown in Figure 3.
Example:
On your standby system (oracle1 in our example) add a <SID>_DP to your tnsnames configuration file
(DG1_DP) that is located under:
$ORACLE_HOME/network/admin/tnsnames
%ORACLE_HOME%\network\admin\tnsnames
(UNIX)
(WINDOWS)
DG1_DP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DG1)
)
)
Now add the same entry to your primary system tnsnames file (oracle2 in our example)
DG1_DP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DG1)
)
)
Verify with Oracle’s tnsping utility the correct resolving on both systems.
oracle@oracle2[DG1] tnsping DG1_DP
TNS Ping Utility for HPUX: Version 10.1.0.3.0 - Production on 13-MAY-2005 09:07:24
Copyright (c) 1997, 2003, Oracle.
All rights reserved.
Used parameter files:
/opt/oracle/10.1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle2)(PORT =
1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DG1)))
OK (0 msec)
CAUTION
It is not possible to check the successful configuration of the Data Protector
/Standby database integration using the CLI (util_oracle8.exe –CONFIG) or the
GUI (Select “Check configuration” after right mouse click on the Oracle object in
the Backup – Source window). An error similar to Figure 6 will return, because
Data Protector is unable to query the dba_tablespaces view if the selected
database is in status “Mount”. The command works fine for the Primary database.
8
Backing up Oracle Data Guard
Once Primary and Standby instance are configured for Data Protector, it is now possible to define a
backup specification for these instances and to run online database backups.
I. Backing up the Primary database
From a Data Protector perspective, the Primary database is a normal Oracle database in status
“OPEN” and running in archive mode.
Therefore the full functionality of our Oracle Integration is available by using the Data Protector GUI
that includes browsing the database or parts of it and selecting database components for backup. It is
possible to schedule these backup specifications or to run them interactively on demand.
II. Backing up the Standby database
The major benefit of an Oracle Data Guard configuration is the possibility to offload Primary
database backups to the configured Standby database. However the Standby database is running in
status “MOUNT” and Data Protector is not able to browse it. Therefore it is not possible to configure a
backup job using the GUI. Data Protector executes the sql command below:
SQL> select tablespace_name from dba_tablespaces where rownum=1
*
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only
This command fails and Data Protector returns with the error message listed in Figure 6 .
Figure 6 Data Protector error message after Standby
database browsing attempt
Î How to create a backup specification for a Standby database?
Because of the fact that Primary and Standby database have the same configuration, structure and
connection string, you can use the backup specifications of your Primary database as a template for
your Standby database and change the database references from the Primary to the Standby
database manually.
The example below explains what entries in the backup specification need to be changed.
9
A backup specification was created for a Primary database backup based on the “Blank Backup”
Data Protector template. All Database components were marked for backup (database, archives,
controlfile) and two backup devices with concurrency 1 each were selected. The backup specification
was saved as OraPRI_DG1.
The configuration file with the same name as the backup specification is stored on the Data Protector
Cell Manager under:
/etc/opt/omni/server/barlists/oracle8
<DP_HOME>\config\server\barlists\oracle8
(UNIX)
(WINDOWS)
and contains the following lines:
BARLIST "OraPRI_DG1"
OWNER "oracle" "dba" "oracle2"
DYNAMIC 1 5
DEVICE "file_device_Writer0"
{
-sync
}
DEVICE "file_device_Writer1"
{
-sync
}
CLIENT "DG1" oracle2
{
-exec ob2rman.exe
-args {
"-backup"
}
-input {
"run {"
"allocate channel 'dev_0' type 'sbt_tape'"
" parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST= OraPRI_DG1)';"
"allocate channel 'dev_1' type 'sbt_tape'"
" parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST= OraPRI_DG1)';"
"backup incremental level <incr_level>"
" format 'OraPRI_DG1<DG1_%s:%t:%p>.dbf'"
" database;"
"sql 'alter system archive log current';"
"backup"
" format 'OraPRI_DG1<DG1_%s:%t:%p>.dbf'"
" archivelog all;"
"backup"
" format 'OraPRI_DG1<DG1_%s:%t:%p>.dbf'"
" current controlfile;"
"}"
}
-public
}
As mentioned previously, the GUI cannot be used for the backup specification definition of a Standby
database. The created Primary database backup specification needs to be modified to allow the
backup of the Standby database.
CAUTION
Editing of a backup specification with a text editor is not supported. This is
an exception. The changes have to be performed exactly as described.
Any other changes to a backup specification are not supported.
10
Two backup modifications are supported:
A. Backup specification name not changed
B. Backup specification name changed
Type A: Backup specification name not changed
In order to use an existing backup specification for Standby database backup, only two lines must be
modified:
OWNER "<user>" "<group>" "<full qualified hostname>"
CLIENT "<SID>" <full qualified hostname>
Example:
Under the assumption the same Oracle configuration is used on Primary and Standby system, only the
hostname entry has to be changed from Primary to Standby.
OWNER "oracle" "dba" "oracle1"
CLIENT "DG1" oracle1
Type B: Backup specification name changed
In case the backup specification will be saved under a new name after the modification, additional
steps are required:
•
•
•
•
•
Change of the hostname entry in the OWNER and CLIENT line (like in Type A)
Change of the BARLIST entry
Change of the OB2BARLIST entry
Change of the RMAN “format” entries
Save changed file under the new BARLIST entry name
Example:
Creating a Standby backup specification with new name OraSTBY_DG1
BARLIST "OraSTBY_DG1"
OWNER "oracle" "dba" "oracle1"
DYNAMIC 1 5
DEVICE "file_device_Writer0"
{
-sync
}
DEVICE "file_device_Writer1"
{
-sync
}
CLIENT "DG1" oracle1
{
-exec ob2rman.exe
-args {
"-backup"
11
}
-input {
"run {"
"allocate channel 'dev_0' type 'sbt_tape'"
" parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=OraSTBY_DG1)';"
"allocate channel 'dev_1' type 'sbt_tape'"
" parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=OraSTBY_DG1)';"
"backup incremental level <incr_level>"
" format 'OraSTBY_DG1<DG1_%s:%t:%p>.dbf'"
" database;"
"backup"
" format 'OraSTBY_DG1<DG1_%s:%t:%p>.dbf'"
" archivelog all;"
"backup"
" format 'OraSTBY_DG1<DG1_%s:%t:%p>.dbf'"
" current controlfile;"
"}"
}
-public
}
The manual backup specification creation is now complete and the Data Protector GUI can be used
for additional modification, like scheduling the backup specification or adjusting data and media
protection.
It is now also possible to start a Standby database backup using the normal Data Protector
possibilities like GUI, CLI (omnib) or to start the backup directly from RMAN. A session report can be
found in the Appendix A.
CAUTION
It is possible to execute sql commands within RMAN scripts. These commands will
fail for a Standby database backup if they require an open database (like “alter
system switch logfile”).
Therefore check the backup specification for such sql statements and remove them
if necessary.
Î What database components need to be backed up from the Primary and what from the physical
Standby database?
In Oracle 10g all database components can be backed up from the physical Standby database,
Datafiles
Archived Redo Log files
Control File
and in case of a disaster they can be restored into the Primary database. The Standby database
Control File can not be restored into a Primary database, but in case of a disaster the Standby
database becomes the new Primary database (Failover) and the former Primary will become the
Standby database. So, from an Oracle perspective a restore of the Standby database is performed
and the Control File can be restored from the (former) Standby database backup. More information
about restore is described in the next main chapter “Restore”.
12
In Oracle 9i it is not possible to backup the current control file from the Standby database backup.
The best way to get a control file backup is to create a separate backup specification using the DP
GUI and in the Source Window select the current control file only. This backup will be taken directly
from the Production database, but the impact on the running production instance can be ignored.
To backup the control file of the Standby database in the same backup job do the following:
•
•
•
Save the new backup specification and go back to “Options – Application Specific Options”
Click on Advanced and hit the “Edit” button to get an Editor Window with the RMAN script
Add a new backup statement with “backup … current control file for standby;” as shown in
the example below
run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=DG1_CTL_ONLY)';
backup
format 'DG1_CTL_ONLY<DG1_%s:%t:%p>.dbf'
current controlfile;
backup
format 'DG1_CTL_ONLY<DG1_%s:%t:%p>.dbf'
current controlfile for standby;
}
III. Backup with RMAN
The backup of a Standby database is also possible by calling Oracle’s RMAN utility directly.
To control the way how Data Protector will deal with the Oracle data, four Data Protector specific
options must be specified in the “allocate channel” command:
•
•
•
•
OB2BARTYPE
OB2APPNAME
OB2BARHOSTNAME
OB2BARLIST
=
=
=
=
Oracle8
<SID>
<Oracle Database system>
<Name of the Backup Specification>
While OB2BARTYPE, OB2APPNAME and OB2BARHOSTNAME are required by the backup Session
Manager (BSM) to resolve the instance details on the Data Protector Cell Manager, the OB2BARLIST
setting is used to allocate and start the backup tape devices that are specified in the named backup
specification.
13
Below an example of an RMAN script that allocates two channels and performs a database backup.
run {
allocate channel 'dev_0' type 'sbt_tape'
parms='ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1, OB2BARLIST=OraSTBY_DG1,
OB2BARHOSTNAME=oracle1)';
allocate channel 'dev_1' type 'sbt_tape'
parms='ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1, OB2BARLIST=OraSTBY_DG1,
OB2BARHOSTNAME=oracle1)';
backup incremental level 0
format 'OraSTBY_DG1<DG1_%s:%t:%p>.dbf'
database;
}
Make sure that the number of allocated channels is the same as the number of backup devices and
their concurrency settings.
In case 2 backup devices should be used and each device can deal with 2 parallel streams, then 4
channels have to be allocated within the RMAN script.
14
Restore
In this section, we will describe 3 possible restore scenarios, and for each of them document
the needed steps to bring the data guard configuration back online.
We will consider 3 different scenarios:
I. – Instantiation of the Primary database after a Failover (Loss of the primary database)
II. – Datafile loss on the primary Database. Restore using backup of the Standby
III. – Loss of a data file on the Standby
CAUTION
It is only possible to run restores directly from RMAN. The Data Protector GUI can
not be used for restores in an Oracle Data Guard environment-
I. - Instantiation of the Primary database after Failover
As mentioned in the Data Guard overview, if we loose the primary site, a data guard failover
needs to be performed, and the primary database needs to be recreated to become the new
standby.
Before performing the failover, we must create a full backup with RMAN on the standby
database (SITE oracle1), as described in the section Backup.
Figure 7 Restore Scenario 1
15
In our case, we simulate a site failure by shutting down (abort) the primary database oracle2
and deleting all database files:
SQL> shutdown abort
ORACLE instance shut down.
SQL>
On the standby, verify that there are no gaps in the archived redo log files by querying the
v$archive_gap view. In case there are some, try to copy the missing archive logs and register
them on the standby (this procedure is described in the Oracle Data Guard manual):
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;
no rows selected
SQL>
Start the failover operation on the physical standby database. The command below assumes
you have standby redo log files. If not, include the clause “finish skip standby logfile” at the
end.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Database altered.
SQL>
Once the recovery is finished in the standby, switch the standby (oracle1) to primary, and
startup the new primary database:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
Database opened.
SQL>
536870912
1310536
157548728
377487360
524288
bytes
bytes
bytes
bytes
bytes
Now we have the former standby (SITE oracle1) running as primary. The former primary
database (SITE oracle2) is down because the db files were deleted.
16
For recreating the SITE oracle2, first we need to create a standby database on SITE oracle2
and afterwards perform a switchover. With the switchover, the database roles will be switched
again: SITE oracle2 will become primary and SITE oracle1 standby, as it was originally
Startup nomount the new standby;
With this in place and assuming the need tapes are available on SITE oracle2, we can then
execute the RMAN script to recreate a standby database using an existing backup;
The script used is the following:
oracle@oracle2[DG1]:/oradata/DG1$ cat recreate_standby.rcv
run {
allocate auxiliary channel 'dev_0' type 'sbt_tape' parms
'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
allocate auxiliary channel 'dev_1' type 'sbt_tape' parms
'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
duplicate target database for standby nofilenamecheck ;
}
Basically, the script uses the RMAN “duplicate target database for standby” command, which
creates a copy of the primary, performing afterwards a recovery of the database.
For recreating the standby using RMAN and the existing backup you need to connect to the
new standby (SITE oracle2) as auxiliary, to the primary as target and to the recovery catalog:
oracle@oracle2[DG1]:/oradata/DG1$ rman auxiliary / target \ sys/xxxx@dg1_stdby catalog
rman/xxxx@rcat_oracle3
Recovery Manager: Release 10.1.0.3.0 - 64bit Production
Copyright (c) 1995, 2004, Oracle.
All rights reserved.
connected to target database: DG1 (DBID=1531960840)
connected to recovery catalog database
connected to auxiliary database: DG1 (not mounted)
RMAN>
The script to create the target standby can be seen below; the RMAN protocol for the
duplicate database is in the appendix for completeness:
RMAN> @recreate_standby.rcv
RMAN> run {
2> allocate auxiliary channel 'dev_0' type 'sbt_tape'
3> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
4> allocate auxiliary channel 'dev_1' type 'sbt_tape'
5> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
6> duplicate target database for standby nofilenamecheck ;
7> }
After running the scripts, the new standby has been created and is already started:
17
oracle@oracle2[DG1]:/oradata/DG1$ sqlplus " /as sysdba"
SQL*Plus: Release 10.1.0.3.0 - Production on Wed May 4 07:54:13 2005
Copyright (c) 1982, 2004, Oracle.
All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
With the Partitioning and Data Mining options
SQL> select DATABASE_ROLE from v$database;
DATABASE_ROLE
---------------PHYSICAL STANDBY
Before setting the new standby in recovery mode, we need to recreate the standby redo logs
(only for 10g databases running in maximum protection and maximum availability):
SQL> alter database add standby logfile '/oradata/DG1/stbredo1.log' size 10m;
Database altered.
SQL> alter database add standby logfile '/oradata/DG1/stbredo2.log' size 10m;
Database altered.
SQL> alter database add standby logfile '/oradata/DG1/stbredo3.log' size 10m;
Database altered.
SQL> select * from v$logfile;
GROUP# STATUS
---------- ------3
2
1
4
5
6
TYPE
------ONLINE
ONLINE
ONLINE
STANDBY
STANDBY
STANDBY
MEMBER
-------------------------------------------------/oradata/DG1/redo03.log
/oradata/DG1/redo02.log
/oradata/DG1/redo01.log
/oradata/DG1/stbredo1.log
/oradata/DG1/stbredo2.log
/oradata/DG1/stbredo3.log
IS_
--NO
NO
NO
NO
NO
NO
6 rows selected.
SQL>
Before the failover was performed, our Data Guard setup was running in maximum availability
mode (see data guard documentation). We need to set the new primary in this mode:
SQL> select PROTECTION_MODE, SWITCHOVER_STATUS from v$database;
PROTECTION_MODE
SWITCHOVER_STATUS
-------------------- -------------------MAXIMUM PERFORMANCE TO STANDBY
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
18
Total System Global Area 536870912 bytes
Fixed Size
1310536 bytes
Variable Size
157548728 bytes
Database Buffers
377487360 bytes
Redo Buffers
524288 bytes
Database mounted.
SQL> alter database set standby to maximize availability;
Database altered.
SQL> alter database open;
Database altered.
SQL>
We can now set the standby database in recovery mode:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM
SESSION;
Database altered.
To verify the standby is receiving the redo information from the primary, perform the
following on the actual primary (SITE oracle1):
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/oradata/DG1/archive
Oldest online log sequence
724
Next log sequence to archive
725
Current log sequence
725
SQL> alter system archive log current;
System altered.
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/oradata/DG1/archive
Oldest online log sequence
724
Next log sequence to archive
726
Current log sequence
726
Now, on the standby (SITE oracle2):
SQL> archive log list;
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/oradata/DG1/archive
Oldest online log sequence
722
Next log sequence to archive
0
Current log sequence
726
To bring both sites to the role they had before the site failover, we need to perform a
switchover, where SITE oracle2 will become primary and SITE oracle1 standby;
As done previously after the failover, we need to set the primary in maximum availability
mode:
19
SQL> select PROTECTION_MODE, SWITCHOVER_STATUS from v$database;
PROTECTION_MODE
SWITCHOVER_STATUS
-------------------------------MAXIMUM AVAILABILITY TO STANDBY
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 536870912 bytes
Fixed Size
1310536 bytes
Variable Size
157548728 bytes
Database Buffers
377487360 bytes
Redo Buffers
524288 bytes
Database mounted.
SQL> alter database set standby to maximize availability;
Database altered.
SQL> alter database open;
Database altered.
SQL>
To initiate the switchover, on the primary (SITE oracle1) perform a switchover to physical
standby
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
SQL>
536870912
1310536
157548728
377487360
524288
bytes
bytes
bytes
bytes
bytes
On SITE oracle2, the standby site:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-------------------TO PRIMARY
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
20
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 536870912 bytes
Fixed Size
1310536 bytes
Variable Size
157548728 bytes
Database Buffers
377487360 bytes
Redo Buffers
524288 bytes
Database mounted.
SQL> alter database set standby to maximize availability;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/oradata/DG1/archive
Oldest online log sequence
731
Next log sequence to archive
732
Current log sequence
732
On SITE oracle1, bring the database in managed recovery:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM
SESSION;
Database altered.
SQL> archive log list
Database log mode
Archive Mode
Automatic archival
Enabled
Archive destination
/oradata/DG1/archive
Oldest online log sequence
729
Next log sequence to archive
0
Current log sequence
732
SQL>
At this point, we have the initial setup, where oracle2 is the Primary database and oracle1 the
Standby database.
21
II. – Datafile Loss of the Primary database
For this scenario, we will simulate the loss of a datafile on the Primary site, by renaming the
file, and use a full backup taken on the standby to perform a full recovery of the tablespace. In
this case, we recover the tablespace on the primary without forcing a failover to the standby.
Figure 8 Restore scenario 2
For the purpose of the testing, we create a new tablespace called payroll, perform a full backup
on the standby using the Oracle Recovery Manager. When finished, we delete the created
datafile.
SQL> create tablespace PAYROLL datafile '/oradata/DG1/payroll01.dbf' size 100M;
Tablespace created.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit
Production
With the Partitioning and Data Mining options
oracle@oracle2[DG1]:/oradata/DG1$ rm payroll01.dbf
When trying to create an object on the tablespace PAYROLL, we receive an error:
SQL> create table test (name varchar2(60));
create table test (name varchar2(60))
*
ERROR at line 1:
ORA-01116: error in opening database file 6
ORA-01110: data file 6: '/oradata/DG1/payroll01.dbf'
ORA-27041: unable to open file
HP-UX Error: 2: No such file or directory
Additional information: 3
22
Using the full backup previously taken at the standby, we perform a recovery of the tablespace
on the primary, using RMAN. For the restore, the tablespace needs to be offline.
oracle@oracle2[DG1]:/oradata/DG1$ cat restore_payroll.rcv
run {
allocate channel 'dev_0' type 'sbt_tape'
parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
sql 'alter tablespace payroll offline immediate ';
restore tablespace payroll;
recover tablespace payroll;
sql 'alter tablespace payroll online ';
}
oracle@oracle2[DG1]:/oradata/DG1$ rman target / catalog rman/xxx@rcat_oracle3
Recovery Manager: Release 10.1.0.3.0 - 64bit Production
Copyright (c) 1995, 2004, Oracle.
All rights reserved.
connected to target database: DG1 (DBID=1531960840)
connected to recovery catalog database
RMAN> @restore_payroll.rcv
RMAN> run {
2> allocate channel 'dev_0' type 'sbt_tape'
3> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
4> sql 'alter tablespace payroll offline immediate ';
5> restore tablespace payroll;
6> recover tablespace payroll;
7> sql 'alter tablespace payroll online ';
8> }
allocated channel: dev_0
channel dev_0: sid=107 devtype=SBT_TAPE
channel dev_0: Data Protector A.05.50/330
sql statement: alter tablespace payroll offline immediate
Starting restore at 2005-05-04
channel dev_0: starting datafile backupset restore
channel dev_0: specifying datafile(s) to restore from backup set
restoring datafile 00006 to /oradata/DG1/payroll01.dbf
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 09:07:23
Starting OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_428:557398844:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 09:08:25
Completed OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_428:557398844:1>.dbf "Oracle8"
channel dev_0: restored backup piece 1
piece handle=Ora1_DG1_Online<DG1_428:557398844:1>.dbf tag=TAG20050504T090043
channel dev_0: restore complete
Finished restore at 2005-05-04
Starting recover at 2005-05-04
starting media recovery
media recovery complete
Finished recover at 2005-05-04
sql statement: alter tablespace payroll online
released channel: dev_0
RMAN> **end-of-file**
23
III. – Loss of a data file on the Standby
As in the previous scenario, we delete a datafile on the standby database and using the full
backup taken on the standby, restore the datafile to disk.
Figure 9 Restore scenario 3
Once the file has been restored, we start the redo apply which will perform the recovery on the
tablespace (assuming all needed archived logs are on disk)
We delete the payroll01.dbf file:
oracle@oracle1[DG1]:/oradata/DG1$ mv payroll01.dbf payroll01.dbf.orig
Looking into the instance alert file, we can see that the datafile 6 cannot be accessed:
Errors in file /opt/oracle/admin/DG1/bdump/dg1_dbw0_7374.trc:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/oradata/DG1/payroll01.dbf'
ORA-27037: unable to obtain file status
HP-UX Error: 2: No such file or directory
Additional information: 3
Before performing the restore, we need to stop the redo apply on the standby:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;
Database altered.
SQL>
24
We restore the datafile from the backup taken from the standby database:
oracle@oracle1[DG1]:/oradata/DG1$ rman target / catalog rman/xxxx@rcat_oracle3
Recovery Manager: Release 10.1.0.3.0 - 64bit Production
Copyright (c) 1995, 2004, Oracle.
All rights reserved.
connected to target database: DG1 (DBID=1531960840)
connected to recovery catalog database
RMAN> @restore_payroll.rcv
RMAN> run {
2> allocate channel 'dev_0' type 'sbt_tape'
3> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
4> restore tablespace payroll;
5> }
allocated channel: dev_0
channel dev_0: sid=94 devtype=SBT_TAPE
channel dev_0: Data Protector A.05.50/330
Starting restore at 2005-05-11
channel dev_0: starting datafile backupset restore
channel dev_0: specifying datafile(s) to restore from backup set
restoring datafile 00006 to /oradata/DG1/payroll01.dbf
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 05/11/05 17:49:57
Starting OB2BAR Restore: oracle1:dtgk5ru6_1_1 "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 05/11/05 17:50:32
Completed OB2BAR Restore: oracle1:dtgk5ru6_1_1 "Oracle8"
channel dev_0: restored backup piece 1
piece handle=dtgk5ru6_1_1 tag=TAG20050511T174013
channel dev_0: restore complete
Finished restore at 2005-05-11
released channel: dev_0
RMAN> **end-of-file**
RMAN>
Start redo apply on the standby:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT
FROM SESSION;
Database altered.
Looking into the instance alert file, we can see that the datafile 6 cannot be accessed:
Errors in file /opt/oracle/admin/DG1/bdump/dg1_dbw0_7374.trc:
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/oradata/DG1/payroll01.dbf'
ORA-27037: unable to obtain file status
HP-UX Error: 2: No such file or directory
Additional information: 3
25
After the file restore, the payroll.dbf datafile has an SCN number, which is lower than the
Database SCN number as seen in the alert logfile:
Wed May 11 17:50:23 2005
Full restore complete of datafile 6 /oradata/DG1/payroll01.dbf
checkpoint is 3519499
If we query the actual SCN number of the database:
SQL> select CURRENT_SCN from v$database;
CURRENT_SCN
----------3539521
After restarting the redo apply on the standby, we can see that file 6 has been successfully
recovered:
SQL> select file#,CHECKPOINT_CHANGE# from v$datafile;
FILE# CHECKPOINT_CHANGE#
---------- -----------------1
3544336
2
3544336
3
3544336
4
3544336
5
3544336
6
3544336
6 rows selected.
SQL>
26
Summary
The whitepaper describes how to configure, backup and restore an Oracle Data Guard environment
using HP Open View Storage Data Protector.
27
Appendix
Appendix A:
Data Protector session report of a Standby database backup
[Normal] From: BSM@oracle3 "OraSTBY_DG1_WholeOnline" Time: 17.05.2005 17:30:05
OB2BAR application on "oracle1" successfully started.
ob2rman.exe started with arguments:
-backup -full
Recovery Manager: Release 10.1.0.3.0 - 64bit Production
Copyright (c) 1995, 2004, Oracle.
All rights reserved.
RMAN>
connected to target database: DG1 (DBID=1531960840)
RMAN>
connected to recovery catalog database
RMAN>
RMAN> run {
2> allocate channel 'dev_0' type 'sbt_tape'
3> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=OraSTBY_DG1_WholeOnline,OB2BARHOSTNAME=oracle1)';
4> backup incremental level 0
5> filesperset 1
6> format 'OraSTBY_DG1_WholeOnline<DG1_%s:%t:%p>.dbf'
7> database
8> include current controlfile archivelog all;
9> }
allocated channel: dev_0
channel dev_0: sid=91 devtype=SBT_TAPE
channel dev_0: Data Protector A.05.50/330
Starting backup at 05/17/2005 [17:29:25]
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00001 name=/oradata/DG1/system01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:29:30]
[Normal] From: BMA@oracle1 "file_device_Writer0" Time: 17.05.2005 17:29:36
STARTING Media Agent "file_device_Writer0"
[Normal] From: BMA@oracle1 "file_device_Writer0" Time: 17.05.2005 17:29:36
Loading medium from slot /oradata/DP/cb19880f5428a0e1c5020450074.fd to device file_device_Writer0
[Normal] From: BMA@oracle1 "file_device_Writer0" Time: 17.05.2005 17:29:36
/oradata/DP/cb19880f5428a0e1c5020450074.fd
Initializing new medium: "file_device_MediaPool_37"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:29:36
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_471:558541770:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:02
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_471:558541770:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:30:05]
piece handle=OraSTBY_DG1_WholeOnline<DG1_471:558541770:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:35
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00003 name=/oradata/DG1/sysaux01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:30:06]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:06
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_472:558541806:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:24
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_472:558541806:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:30:31]
piece handle=OraSTBY_DG1_WholeOnline<DG1_472:558541806:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:25
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00005 name=/oradata/DG1/example01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:30:31]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:31
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_473:558541831:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:39
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_473:558541831:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:30:46]
piece handle=OraSTBY_DG1_WholeOnline<DG1_473:558541831:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:15
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00002 name=/oradata/DG1/undotbs01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:30:46]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:46
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_474:558541846:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:30:56
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_474:558541846:1>.dbf "Oracle8"
28
channel dev_0: finished piece 1 at 05/17/2005 [14:31:01]
piece handle=OraSTBY_DG1_WholeOnline<DG1_474:558541846:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:15
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00006 name=/oradata/DG1/payroll01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:31:01]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:01
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_475:558541861:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:06
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_475:558541861:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:31:08]
piece handle=OraSTBY_DG1_WholeOnline<DG1_475:558541861:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:07
channel dev_0: starting archive log backupset
channel dev_0: specifying archive log(s) in backup set
input archive log thread=1 sequence=848 recid=410 stamp=558528474
channel dev_0: starting piece 1 at 05/17/2005 [14:31:09]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:10
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_476:558541869:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:12
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_476:558541869:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:31:17]
piece handle=OraSTBY_DG1_WholeOnline<DG1_476:558541869:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:08
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
input datafile fno=00004 name=/oradata/DG1/users01.dbf
channel dev_0: starting piece 1 at 05/17/2005 [14:31:17]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:17
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_477:558541877:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:19
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_477:558541877:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:31:24]
piece handle=OraSTBY_DG1_WholeOnline<DG1_477:558541877:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:07
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
including current controlfile in backupset
channel dev_0: starting piece 1 at 05/17/2005 [14:31:24]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:24
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_478:558541884:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:27
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_478:558541884:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:31:39]
piece handle=OraSTBY_DG1_WholeOnline<DG1_478:558541884:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:15
channel dev_0: starting incremental level 0 datafile backupset
channel dev_0: specifying datafile(s) in backupset
including current SPFILE in backupset
channel dev_0: starting piece 1 at 05/17/2005 [14:31:41]
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:41
Starting OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_479:558541900:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:42
Completed OB2BAR Backup: oracle1:OraSTBY_DG1_WholeOnline<DG1_479:558541900:1>.dbf "Oracle8"
channel dev_0: finished piece 1 at 05/17/2005 [14:31:44]
piece handle=OraSTBY_DG1_WholeOnline<DG1_479:558541900:1>.dbf comment=API Version 2.0,MMS Version 65.5.50.74
channel dev_0: backup set complete, elapsed time: 00:00:04
Finished backup at 05/17/2005 [17:31:44]
released channel: dev_0
RMAN> **end-of-file**
RMAN>
Recovery Manager complete.
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:31:49
Oracle RMAN successfully finished.
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:31:49
Issuing DP Managed Control File Backup ...
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:51
Starting OB2BAR Backup: oracle1:DG1 DP Managed Control File Backup "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:31:52
Completed OB2BAR Backup: oracle1:DG1 DP Managed Control File Backup "Oracle8"
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:31:52
Starting backup of the Oracle Recovery Catalog Database ...
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:31:53
Getting NLS_LANG and setting it into the environment ....
AMERICAN_AMERICA.WE8ISO8859P15
Default exp binary /opt/oracle/10.1/bin/exp is used for catalog export.
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:33:30
Export of the Recovery Catalog succeeded. Proceeding to backup.
29
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:33:30
Starting OB2BAR Backup: oracle1:Oracle Recovery Backup Catalog "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle1 "DG1" Time: 17.05.2005 17:33:33
Completed OB2BAR Backup: oracle1:Oracle Recovery Backup Catalog "Oracle8"
[Normal] From: ob2rman.exe@oracle1 "DG1" Time: 05/17/05 17:33:33
Backup of the Oracle Catalog Database succeeded.
[Normal] From: BSM@oracle3 "OraSTBY_DG1_WholeOnline" Time: 17.05.2005 17:34:34
OB2BAR application on "oracle1" disconnected.
[Normal] From: BMA@oracle1 "file_device_Writer0" Time: 17.05.2005 17:33:33
Unloading medium to slot /oradata/DP/cb19880f5428a0e1c5020450074.fd from device file_device_Writer0
[Normal] From: BMA@oracle1 "file_device_Writer0" Time: 17.05.2005 17:33:33
COMPLETED Media Agent "file_device_Writer0"
[Normal] From: BSM@oracle3 "OraSTBY_DG1_WholeOnline"
Time: 17.05.2005 17:34:34
Backup Statistics:
Session Queuing Time (hours)
0,00
---------------------------------------Completed Disk Agents ........
11
Failed Disk Agents ...........
0
Aborted Disk Agents ..........
0
---------------------------------------Disk Agents Total ...........
11
========================================
Completed Media Agents .......
1
Failed Media Agents ..........
0
Aborted Media Agents .........
0
---------------------------------------Media Agents Total ..........
1
========================================
Mbytes Total ................. 769 MB
Used Media Total .............
1
Disk Agent Errors Total ......
0
30
Appendix B:
Target database restore using RMAN
RMAN> @recreate_standby.rcv
RMAN> run {
2> allocate auxiliary channel 'dev_0' type 'sbt_tape'
3> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
4> allocate auxiliary channel 'dev_1' type 'sbt_tape'
5> parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=DG1,OB2BARLIST=Ora1_DG1_Online)';
6> duplicate target database for standby nofilenamecheck ;
7> }
starting full resync of recovery catalog
full resync complete
allocated channel: dev_0
channel dev_0: sid=105 devtype=SBT_TAPE
channel dev_0: Data Protector A.05.50/330
allocated channel: dev_1
channel dev_1: sid=104 devtype=SBT_TAPE
channel dev_1: Data Protector A.05.50/330
Starting Duplicate Db at 2005-05-04
contents of Memory Script:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting restore at 2005-05-04
channel dev_0: starting datafile backupset restore
channel dev_0: restoring controlfile
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:49:35
Starting OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_413:557389582:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:49:36
Completed OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_413:557389582:1>.dbf "Oracle8"
channel dev_0: restored backup piece 1
piece handle=Ora1_DG1_Online<DG1_413:557389582:1>.dbf tag=TAG20050504T062622
channel dev_0: restore complete
output filename=/oradata/DG1/control01.ctl
output filename=/oradata/DG1/control02.ctl
output filename=/oradata/DG1/control03.ctl
Finished restore at 2005-05-04
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for datafile 1
"/oradata/DG1/system01.dbf";
set newname for datafile 2
"/oradata/DG1/undotbs01.dbf";
set newname for datafile 3
"/oradata/DG1/sysaux01.dbf";
set newname for datafile 4
"/oradata/DG1/users01.dbf";
set newname for datafile 5
"/oradata/DG1/example01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
to
to
to
to
to
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 2005-05-04
channel dev_0: starting datafile backupset restore
channel dev_0: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /oradata/DG1/sysaux01.dbf
restoring datafile 00005 to /oradata/DG1/example01.dbf
channel dev_1: starting datafile backupset restore
channel dev_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oradata/DG1/system01.dbf
restoring datafile 00002 to /oradata/DG1/undotbs01.dbf
restoring datafile 00004 to /oradata/DG1/users01.dbf
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:50:31
Starting OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_406:557389454:1>.dbf "Oracle8"
31
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:50:36
Starting OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_407:557389454:1>.dbf "Oracle8"
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:52:14
Completed OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_407:557389454:1>.dbf "Oracle8"
channel dev_0: restored backup piece 1
piece handle=Ora1_DG1_Online<DG1_407:557389454:1>.dbf tag=TAG20050504T062414
channel dev_0: restore complete
[Normal] From: OB2BAR_Oracle8@oracle2 "DG1" Time: 05/04/05 07:52:31
Completed OB2BAR Restore: oracle1:Ora1_DG1_Online<DG1_406:557389454:1>.dbf "Oracle8"
channel dev_1: restored backup piece 1
piece handle=Ora1_DG1_Online<DG1_406:557389454:1>.dbf tag=TAG20050504T062414
channel dev_1: restore complete
Finished restore at 2005-05-04
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafilecopy recid=11 stamp=557394759
datafile 2 switched to datafile copy
input datafilecopy recid=12 stamp=557394759
datafile 3 switched to datafile copy
input datafilecopy recid=13 stamp=557394759
datafile 4 switched to datafile copy
input datafilecopy recid=14 stamp=557394759
datafile 5 switched to datafile copy
input datafilecopy recid=15 stamp=557394759
Finished Duplicate Db at 2005-05-04
released channel: dev_0
released channel: dev_1
filename=/oradata/DG1/system01.dbf
filename=/oradata/DG1/undotbs01.dbf
filename=/oradata/DG1/sysaux01.dbf
filename=/oradata/DG1/users01.dbf
filename=/oradata/DG1/example01.dbf
RMAN> **end-of-file**
RMAN>
32
Appendix C:
Useful Recovery Catalog Views/ V$ views1
Recovery Catalog View
Corresponding V$ View
Catalog View Describes ...
RC_ARCHIVED_LOG
V$ARCHIVED_LOG
Archived and unarchived redo
logs
RC_BACKUP_CONTROLFILE
V$BACKUP_DATAFILE
Control files in backup sets
RC_BACKUP_CORRUPTION
V$BACKUP_CORRUPTION
Corrupt block ranges in datafile
backups
RC_BACKUP_DATAFILE
V$BACKUP_DATAFILE
Datafiles in backup sets
RC_BACKUP_FILES
V$BACKUP_FILES
RMAN backups and copies
known to the repository.
RC_BACKUP_PIECE
V$BACKUP_PIECE
Backup pieces
RC_BACKUP_REDOLOG
V$BACKUP_REDOLOG
Archived redo logs in backup
sets
RC_BACKUP_SET
V$BACKUP_SET
Backup sets for all incarnations
of the database
RC_BACKUP_SPFILE
V$BACKUP_SPFILE
Server parameter files in
backups
RC_CHECKPOINT
Deprecated in favor of
RC_RESYNC
RC_CONTROLFILE_COPY
V$DATAFILE_COPY
Control file copies on disk
RC_COPY_CORRUPTION
V$COPY_CORRUPTION
Corrupt block ranges in datafile
copies
RC_DATABASE
V$DATABASE
Databases registered in the
recovery catalog
RC_DATABASE_BLOCK_CORRUPTI
ON
V$DATABASE_BLOCK_CORRU Database blocks marked as
PTION
corrupted in the most recent
RMAN backup or copy
RC_DATABASE_INCARNATION
V$DATABASE_INCARNATION Database incarnations
registered in the recovery
catalog
RC_DATAFILE
V$DATAFILE
Datafiles registered in the
recovery catalog
RC_DATAFILE_COPY
V$DATAFILE_COPY
Datafile copies on disk
RC_LOG_HISTORY
V$LOG_HISTORY
Online redo log history
indicating when log switches
occurred
1
(taken from the RMAN reference guide)
33
Recovery Catalog View
Corresponding V$ View
Catalog View Describes ...
RC_OFFLINE_RANGE
V$OFFLINE_RANGE
Offline ranges for datafiles
RC_PROXY_ARCHIVEDLOG
V$PROXY_ARCHIVEDLOG
Archived log backups taken
with the proxy copy
functionality
RC_PROXY_CONTROLFILE
V$PROXY_DATAFILE
Control file backups taken with
the proxy copy functionality
RC_PROXY_DATAFILE
V$PROXY_DATAFILE
Datafile backups that were
taken using the proxy copy
functionality
RC_REDO_LOG
V$LOG and V$LOGFILE
Online redo logs for all
incarnations of the database
since the last catalog
resynchronization
RC_REDO_THREAD
V$THREAD
All redo threads for all
incarnations of the database
since the last catalog
resynchronization
RC_RESYNC
n/a
Recovery catalog
resynchronizations
RC_RMAN_CONFIGURATION
V$RMAN_CONFIGURATION
RMAN configuration settings
RC_RMAN_STATUS
V$RMAN_STATUS
Historical status information
about RMAN operations.
RC_STORED_SCRIPT
n/a
Names of scripts stored in the
recovery catalog
RC_STORED_SCRIPT_LINE
n/a
Contents of the scripts stored in
the recovery catalog
RC_TABLESPACE
V$TABLESPACE
All tablespaces registered in
the recovery catalog, all
dropped tablespaces, and
tablespaces that belong to old
incarnation
34
For more information
HP Open View Data Protector Overview & Features
http://www.hp.com/go/dataprotector
HP Open View Data Protector support matrices
http://www.openview.hp.com/products/datapro/spec_0001.html
Oracle Data Guard
http://www.oracle.com/technology/deploy/availability/htdocs/DataGuardOverview.html
Oracle Recovery Manager (RMAN)
http://www.oracle.com/technology/deploy/availability/htdocs/rman_overview.htm
Oracle10g Data Guard Concepts and Administration guide. Oracle Technology Network
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10823/toc.htm
Maximum Availability Architecture Oracle White Paper
http://www.oracle.com/technology/deploy/availability/pdf/MAA_WP.pdf
Using Recovery Manager with Data Guard in Oracle9i Oracle White Paper
http://www.oracle.com/technology/deploy/availability/pdf/RMAN_DataGuard_9iR2_wp.pdf
Oracle 10g Recovery Catalog views. Oracle Technology Network
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10770/rcviews.htm
Whitepaper: “HP Open View Storage Data Protector A.05.50
Backing up an Oracle Data Guard environment”
Author:
Version :
Joerg Richter/Jaime Blasco
1.1 (01/2006)
© 2005 Hewlett-Packard Development Company, L.P. The information
contained herein is subject to change without notice. The only warranties for
HP products and services are set forth in the express warranty statements
accompanying such products and services. Nothing herein should be construed
as constituting an additional warranty. HP shall not be liable for technical or
editorial errors or omissions contained herein.
Itanium is a trademark or registered trademark of Intel Corporation in the U.S.
and other countries and is used under license.
35