您的位置:首页 > 数据库 > Oracle

Oracle单实例数据库迁移到Oracle RAC 环境之(3)--主备库Switchover

2015-03-31 12:02 405 查看
Oracle单实例数据库迁移到Oracle RAC 环境之(3)--主备库Switchover系统环境:操作系统:RedHat EL55Oracle : Oracle 11.2.0.1.0集群软件:Oracle GI 11.2.0.1.0[b]本案例采用的是基于DataGuard的迁移方式[/b]




主备库实施切换,将RAC database切换成主库,既可以完成数据的迁移。

主库:
8:18:00 SYS@ cuug>select name,dbid,database_role,protection_mode,switchover_status from v$database;
NAME            DBID DATABASE_ROLE    PROTECTION_MODE      SWITCHOVER_STATUS
--------- ---------- ---------------- -------------------- --------------------
CUUG      1329392875 PRIMARY          MAXIMUM PERFORMANCE  TO STANDBY
备库:

SQL> select name,dbid,database_role,protection_mode,switchover_status from v$database;
NAME            DBID DATABASE_ROLE    PROTECTION_MODE      SWITCHOVER_STATUS
--------- ---------- ---------------- -------------------- --------------------
CUUG      1329392875 PHYSICAL STANDBY MAXIMUM PERFORMANCE  NOT ALLOWED

1、首先将主库(单实例)切换成备库

[code=java;toolbar:false">18:20:51 SYS@ cuug>alter database commit to switchover to standby with session shutdown ;
Database altered.

18:21:25 SYS@ cuug>shutdown
ORA-01507: database not mounted
ORACLE instance shut down.

18:21:55 SYS@ cuug>startup mount;
ORACLE instance started.
Total System Global Area  418484224 bytes
Fixed Size                  1336932 bytes
Variable Size             264243612 bytes
Database Buffers          146800640 bytes
Redo Buffers                6103040 bytes
Database mounted.

18:22:03 SYS@ cuug>select name,dbid,database_role,protection_mode,switchover_status from v$database;
NAME            DBID DATABASE_ROLE    PROTECTION_MODE      SWITCHOVER_STATUS
--------- ---------- ---------------- -------------------- --------------------
CUUG      1329392875 PHYSICAL STANDBY MAXIMUM PERFORMANCE  TO PRIMARY
Elapsed: 00:00:00.01
18:22:08 SYS@ cuug>recover managed standby database disconnect from session;
Media recovery complete.SQL> alter database add logfile thread 2 ('+dg1','+rcy1') size 50m;
Database altered.

SQL> alter database add logfile thread 2 ('+dg1','+rcy1') size 50m;
Database altered.

SQL> alter database add logfile thread 2 ('+dg1','+rcy1') size 50m;
Database altered.

SQL> select group#,member from v$logfile order by 1;
    GROUP# MEMBER
---------- --------------------------------------------------
         1 +DG1/stddb/onlinelog/redo01a.log
         1 +RCY1/stddb/onlinelog/redo01b.log
         2 +RCY1/stddb/onlinelog/redo02b.log
         2 +DG1/stddb/onlinelog/redo02a.log
         3 +DG1/stddb/onlinelog/redo03a.log
         3 +RCY1/stddb/onlinelog/redo03b.log
         4 +DG1/stddb/onlinelog/group_4.280.848169735
         4 +RCY1/stddb/onlinelog/group_4.287.848169817
         5 +DG1/stddb/onlinelog/group_5.281.848169749
         5 +RCY1/stddb/onlinelog/group_5.288.848169827
         6 +DG1/stddb/onlinelog/group_6.282.848169759
    GROUP# MEMBER
---------- --------------------------------------------------
         6 +RCY1/stddb/onlinelog/group_6.289.848169831
12 rows selected.[oracle@node1 ~]$ srvctl start database -d stddb
通过node1连接:
[oracle@node1 ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Wed May 21 19:18:37 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name,status from gv$instance;
INSTANCE_NAME    STATUS
---------------- ------------
stddb1           OPEN
stddb2           OPEN
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: