中国开发网: 论坛: 数据库: 贴子 861958
DeepBlue: [ZT] DataGuard--Oracle 9i Physical Standby Database Role Manage
我们看了下面的命令行,基本上日常的物理备用库管理基本没有问题。
----------------------------------------------------------------------------
Starting Up the Physical Standby for Managed Recovery Operation
----------------------------------------------------------------------------
1. Start the database

SQL> STARTUP NOMOUNT;

2. Mount the standby database

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

3. Start the managed recovery operation

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

---------------------------------------------------------------
Starting Up the Physical Standby for Read-Only Access
---------------------------------------------------------------
1. Start the Oracle instance for the standby database without mounting it

SQL> STARTUP NOMOUNT;

2. Mount the standby database

SQL> ALTER DATABASE MOUNT STANDBY DATABASE;

3. Open the database for read-only access

SQL> ALTER DATABASE OPEN READ ONLY;

NOTE:
Since the temporary tablespace (locally managed) existed on the primary database before the standby was created, the only thing to do is to associate a temporary file with a temporary tablespace on a read-only physical standby database.

The temporary tablespace was created with the following options:

create temporary tablespace TEMP01 tempfile
'@ORACLE_DATA@/@ORACLE_SID@/@ORACLE_SID@_temp01_01.dbf' size 512064k reuse
AUTOEXTEND ON NEXT 100M MAXSIZE 2000M
extent management local uniform size 1M;

Now, you must use the ADD TEMPFILE clause to actually create the disk file on
the standby database. In order to do it perform the following steps:

- Cancel managed recovery and open the physical standby database for
read-only access using the following SQL statements:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE OPEN READ ONLY;

Opening the physical standby database for read-only access allows you to add a
temporary file. Because adding a temporary file does not generate redo data, it
is allowed for a database that is open for read-only access.

- Create a temporary file for the temporary tablespace. The size and names for
the files can differ from the primary database.

SQL> ALTER TABLESPACE TEMP01 ADD TEMPFILE '/ORA/dbs03/oradata/rls1/rls1_temp01_01.dbf' SIZE 512064k reuse;

-----------------------------------------
Shutting down the physical standby
-----------------------------------------
1. Defer the archive log destination on the primary database (PRI)

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=defer;

2. Perform a log switch operation on the primary database (PRI)

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

3. Find out if the standby database is performing managed recovery (SEC)

SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;
PROCESS STATUS
------- ------------
ARCH CLOSING
ARCH CLOSING
RFS WRITING
MRP0 WAIT_FOR_LOG
RFS RECEIVING
RFS RECEIVING

4. Cancel managed recovery operations (SEC)
SQL> ALTER DATABASE RECOVER MANAGE STANDBY DATABASE CANCEL;

5. Shut down the standby database (SEC)
SQL> SHUTDOWN IMMEDIATE;

----------------------------------------------------------------------------------
Switching between the Read-Only Access and Managed-Recovery Mode
----------------------------------------------------------------------------------

1. Cancel log apply services

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

2. Open the database for read-only access

SQL> ALTER DATABASE OPEN READ ONLY;

Return back to managed-recovery mode:

3. Terminate all active user sessions on the standby database.

4. Restart log apply services:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;


-------------------------------------
Role Management – Switchover
-------------------------------------
1. Verify that it is possible to perform a switchover operation (PRI)

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;

SWITCHOVER_STATUS
------------------
SESSIONS ACTIVE

2. Convert the primary database to the new standby (PRI)

SQL> alter database commit to switchover to physical standby with session shutdown;

3. Shutdown the former primary and mount as a standby database (PRI)

SQL> shutdown immediate
SQL> startup nomount
SQL> alter database mount standby database;

at this point both databases are configured as standby <=

4. Defer the remote archive destination on the old primary (OLD PRI)

SQL> alter system set log_archive_dest_state_2=defer;

5. Verify that the physical standby can be converted to the new primary (SEC)


执行力=流程+计划+组织

把理想变成计划,
把计划变成步骤,
把步骤变成行动,
把行动变成成果。

好語說盡人必易之。規矩行盡人必繁之。福若受盡緣必孤。勢若使盡禍必至。

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录