If you do not use the Data Guard broker, you must define
the LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_DEST_STATE_n
parameters on all standby sites so that when a switchover or
failover operation occurs, all of the standby sites continue to receive
logs from the new primary database. Configurations that you set up
with the Data Guard broker command-line interface or Data Guard
Manager handle the LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_
DEST_STATE_n definitions automatically, including defining the
LOG_ARCHIVE_DEST_n parameters to point back to the primary
database and all the other standby databases.
必须明确一点,只要是主库 ,必须至少设置 一个 service 指向从库,以便传输日志,
Verify that there is network connectivity between the primary and standby
locations.
Each location in the Data Guard configuration should have connectivity
through Oracle Net to the primary database and to all associated standby
databases.
Verify that there are no active users connected to the databases.
Verify that all but one primary instance and one standby instance in a Real
Application Clusters configuration are shut down.
For a Real Application Clusters database, only one primary instance and one
standby instance can perform the switchover operation. Shut down all other
instances before the switchover operation.
For switchover operations involving a physical standby database, the primary
database instance is open and the standby database instance is mounted.
当然standby 是要mounted ,难道还可以open,也只能read only 的打开
Verify that there is network connectivity between the primary and standby
locations.
Each location in the Data Guard configuration should have connectivity
through Oracle Net to the primary database and to all associated standby
databases.
Verify that there are no active users connected to the databases.
Verify that all but one primary instance and one standby instance in a Real
Application Clusters configuration are shut down.
For a Real Application Clusters database, only one primary instance and one
standby instance can perform the switchover operation. Shut down all other
instances before the switchover operation.
For switchover operations involving a physical standby database, the primary
database instance is open and the standby database instance is mounted.
这里也说了如果 是read only open 的话,一样可以执行switchover 操作
Always initiate the
switchover operation on the primary database and complete it on the physical
standby database.
先主库, 再从库 ,完成switchover 操作
On the current primary database
Step 1 Verify that it is possible to perform a switchover operation.
On the current primary database, query the SWITCHOVER_STATUS column of the
V$DATABASE fixed view on the primary database to verify that it is possible to
perform a switchover operation. For example:
Note: Do not fail over a primary database to a physical standby
database to test whether or not the standby database is being
updated correctly. Instead, open the standby database in read-only
mode and query the database to ensure that updates made to the
primary database were propagated to the standby database.
Role Transitions Involving Physical Standby Databases
7-12 Oracle9i Data Guard Concepts and Administration
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-----------------
TO STANDBY
1 row selected
The TO STANDBY value in the SWITCHOVER_STATUS column indicates that it is
possible to switch the primary database to the standby role. If the TO STANDBY
value is not displayed, then verify that the Data Guard configuration is functioning
correctly (for example, verify that all LOG_ARCHIVE_DEST_n parameter values are
specified correctly).
Step 2 Initiate the switchover operation on the primary database.
To transition the current primary database to a physical standby database role, use
the following SQL statement on the primary database:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
After this statement completes, the primary database is converted into a standby
database. The current control file is backed up to the current SQL session trace file
before the switchover operation. This makes it possible to reconstruct a current
control file, if necessary.
Step 3 Shut down and restart the former primary instance.
Shut down the former primary instance and restart it without mounting the
database:
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP NOMOUNT;
Mount the database as a physical standby database:
SQL> ALTER DATABASE MOUNT STANDBY DATABASE;
At this point in the switchover process, both databases are configured as standby
databases
On the target physical standby database
Step 4 Verify the switchover status in the V$DATABASE view.
After you transition the primary database to the physical standby role and the
switchover notification is received by the standby databases in the configuration,
you should verify if the switchover notification was processed by the target standby
database by querying the SWITCHOVER_STATUS column of the V$DATABASE fixed
view on the target standby database.
For example:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-----------------
SWITCHOVER PENDING
1 row selected
The SWITCHOVER PENDING value of the SWITCHOVER_STATUS column indicates
the standby database is about to switch from the standby role to the primary role. If
the SWITCHOVER PENDING value is not displayed, then verify that the Data Guard
configuration is functioning correctly (for example, verify that all LOG_ARCHIVE_
DEST_n parameter values are specified correctly).
Step 5 Switch the physical standby database role to the primary role.
You can switch a physical standby database from the standby role to the primary
role when the standby database instance is either mounted in managed recovery
mode or open for read-only access. It must be mounted in one of these modes so
that the primary database switchover operation request can be coordinated.
The SQL ALTER DATABASE statement used to perform the switchover
automatically creates online redo logs if they do not already exist. This might
significantly increase the time required to complete the COMMIT operation.
Therefore, Oracle Corporation recommends that you always manually add online
redo logs to the target standby database when you create it. Use one of the
following methods to manually add the online redo logs if they do not already exist:
Copy the existing online redo logs from the initial primary database site to the
target standby database site and define the LOG_FILE_NAME_CONVERT
initialization parameter to correctly associate the standby site path names to the
new online redo logs (see Section 3.2.6).
See Also: Chapter 14 for information about other valid values for
the SWITCHOVER_STATUS column of the V$DATABASE view
Role Transitions Involving Physical Standby Databases
7-14 Oracle9i Data Guard Concepts and Administration
Drop any existing online redo logs at the target standby site and create new
ones using the ALTER DATABASE ADD STANDBY LOGFILE statement.
After you manually add the online redo logs, use the following SQL statement on
the physical standby database that you want to transition to the primary role:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Step 6 Shut down and restart the new primary database.
Shut down the target standby instance and restart it using the appropriate
initialization parameters for the primary role:
SQL> SHUTDOWN;
SQL> STARTUP;
The target physical standby database is now transitioned to the primary database
role.
On the new physical standby database
Step 7 Start managed recovery operations and log apply services.
Issue the following statement to begin managed recovery operations on the new
physical standby database:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
On the new primary database
Step 8 Begin sending redo data to the standby databases.
Issue the following statement on the new primary database:
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Initialization parameters on the primary database to transmit redo data to the
standby database 这里应该是设置一个service 指向从库吧
Initialization parameters on the standby database to prepare the standby
database to receive redo data --这里应该是fal_server,fal_client 吧,还有standby_archive_dest
A network address on the primary system for the standby database
Log Transport Services Administration
A network address on the standby system for the primary database 后面就是TNSNAME服务名了
shows the primary role initialization parameters that you maintain on
the primary database.
Example 5–6 Primary Database: Primary Role Initialization Parameters
LOG_ARCHIVE_DEST_1='LOCATION=/disk1/oracle/oradata/payroll/'
LOG_ARCHIVE_DEST_2='SERVICE=sales1'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
LOG_ARCHIVE_FORMAT=%d_%t_%s.arc
REMOTE_ARCHIVE_ENABLE=SEND
These parameters control how log transport services send redo data to the standby
system and the archiving of redo data on the local file system. The last parameter,
REMOTE_ARCHIVE_ENABLE=SEND, allows the primary database to send redo data
to the standby database, but prevents the primary database from receiving redo
data from another system.
Example 5–7 shows the additional standby role initialization parameters on the
primary database. These parameters take effect when the primary database is
transitioned to the standby role.
下面这些参数仅 数据库处于standby 角色才起作用
FAL_SERVER=sales1
FAL_CLIENT=sales
DB_FILE_NAME_CONVERT=('/standby','/primary') --这两个需要设置吗?
LOG_FILE_NAME_CONVERT=('/standby','/primary')
STANDBY_ARCHIVE_DEST=/disk1/oracle/oradata/payroll/
STANDBY_FILE_MANAGEMENT=AUTO
Specifying the initialization parameters shown in Example 5–7 sets up the primary
database to resolve gaps and convert new data and log file path names from a new
primary database and archives the incoming redo data when this database is in the
standby role.
Example 5–8 Standby Database: Standby Role Initialization Parameters
FAL_SERVER=sales
FAL_CLIENT=sales1
DB_FILE_NAME_CONVERT=("/primary","/standby")
LOG_FILE_NAME_CONVERT=("/primary","/standby")
STANDBY_ARCHIVE_DEST=/disk1/oracle/oradata/payroll/standby/arc
LOG_ARCHIVE_DEST_1='LOCATION=/disk1/oracle/oradata/payroll/standby/arc/'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_FORMAT=%d_%t_%s.arc
STANDBY_FILE_MANAGEMENT=AUTO
REMOTE_ARCHIVE_ENABLE=RECEIVE
These initialization parameters allow the standby database to:
Resolve gaps and convert new data and log file path names from the primary
database
Receive and archive the incoming redo data from the primary database, but
only while the database is running in the standby role
The last parameter allows the standby database to receive redo data from a primary
database, but it prevents the standby database from sending redo data.
standby database that take effect when the standby database is transitioned to the
primary role.
Example 5–9 Standby Database: Primary Role Initialization Parameters
LOG_ARCHIVE_DEST_2='SERVICE=sales' --只有主库才可以把日志传送给standby 的
LOG_ARCHIVE_DEST_STATE_2=ENABLE
These additional parameters control how log transport services send redo data to a
new standby system.
With the initialization parameters on both the primary and standby databases set as
described in Section 5.8.2.1 and Section 5.8.2.2, the only parameter that needs to
change after a role transition is the REMOTE_ARCHIVE_ENABLE parameter. Change
this parameter on both the original primary database and the standby database that
assumes the primary role.
On the original primary database (the new standby) set this parameter to allow the
receipt of the redo from the new primary database. For example:
SQL> ALTER SYSTEM SET REMOTE_ARCHIVE_ENABLE=RECEIVE SCOPE=MEMORY;
On the new primary database (the former standby) set this initialization parameter
to allow the sending of redo to the standby database.
SQL> ALTER SYSTEM SET REMOTE_ARCHIVE_ENABLE=SEND SCOPE=MEMORY;
Setting the initialization parameter using the SCOPE=MEMORY clause ensures that
the two databases will revert back to their original settings when the role transition
is reversed, and the databases resume their original roles. If you expect that these
databases will be restarted at some point without performing a role transition,
replace the SCOPE=MEMORY with SCOPE=BOTH. In this event, this initialization
parameter will have to be reset manually again after a new role transition.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9194732/viewspace-913050/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9194732/viewspace-913050/