单实例文件管理的数据库迁移到RAC+ASM

对于想升级到rac的系统,同时又不想将生产库停机,唯一的办法恐怕就是用dataguard的switchover来实现了。

首先创建一个单实例的数据库。

1、确定单实例是归档模式
SQL> archive log list;
Database log mode        No Archive Mode
Automatic archival        Disabled
Archive destination        /usr/oracle/product/10.2.0/dbs/arch
Oldest online log sequence     1
Current log sequence        1
SQL> set linesize 200
SQL> show parameter archive log;

NAME         TYPE      VALUE
------------------------------------ ---------------------- ------------------------------
archive_lag_target       integer      0
log_archive_config       string
log_archive_dest       string
log_archive_dest_1       string
log_archive_dest_10       string
log_archive_dest_2       string
log_archive_dest_3       string
log_archive_dest_4       string
log_archive_dest_5       string
log_archive_dest_6       string
log_archive_dest_7       string

NAME         TYPE      VALUE
------------------------------------ ---------------------- ------------------------------
log_archive_dest_8       string
log_archive_dest_9       string
log_archive_dest_state_1      string      enable
log_archive_dest_state_10      string      enable
log_archive_dest_state_2      string      enable
log_archive_dest_state_3      string      enable
log_archive_dest_state_4      string      enable
log_archive_dest_state_5      string      enable
log_archive_dest_state_6      string      enable
log_archive_dest_state_7      string      enable
log_archive_dest_state_8      string      enable

NAME         TYPE      VALUE
------------------------------------ ---------------------- ------------------------------
log_archive_dest_state_9      string      enable
log_archive_duplex_dest       string
log_archive_format       string      %t_%s_%r.dbf
log_archive_local_first       boolean      TRUE
log_archive_max_processes      integer      2
log_archive_min_succeed_dest      integer      1
log_archive_start       boolean      FALSE
log_archive_trace       integer      0
remote_archive_enable       string      true
standby_archive_dest       string      ?/dbs/arch
SQL> create pfile from spfile;

File created.

SQL> create pfile from spfile;

File created.

SQL> alter system set log_archive_dest_1='LOCATION=/usr/oracle/oradata/orcl/archivelog';

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@xxtdwhtest orcl]$ export ORACLE_SID=orcl
[oracle@xxtdwhtest orcl]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on 星期四 3月 3 20:15:27 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size      2085776 bytes
Variable Size    163581040 bytes
Database Buffers   427819008 bytes
Redo Buffers      6299648 bytes
SQL> alter database mount;

Database altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode        Archive Mode
Automatic archival        Enabled
Archive destination        /usr/oracle/oradata/orcl/archivelog
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence        1
SQL> alter system switch logfile;

System altered.

2、设置数据库为强制归档模式
SQL> select name,log_mode,force_logging from v$database;

NAME     LOG_MODE      FORCE_
------------------ ------------------------ ------
ORCL     ARCHIVELOG      NO

SQL> alter database force logging;

Database altered.

SQL> select name,log_mode,force_logging from v$database;

NAME     LOG_MODE      FORCE_
------------------ ------------------------ ------
ORCL     ARCHIVELOG      NO

SQL> alter database force logging;

Database altered.


3、standby为rac, 添加另一个undo表空间,和thread2的日志
SQL> select name  from v$datafile;

NAME
--------------------------------------------------------------------------------
/usr/oracle/oradata/orcl/system01.dbf
/usr/oracle/oradata/orcl/undotbs01.dbf
/usr/oracle/oradata/orcl/sysaux01.dbf
/usr/oracle/oradata/orcl/users01.dbf
/usr/oracle/oradata/orcl/tbtest01.dbf
SQL> create undo tablespace undotbs2 datafile '/usr/oracle/oradata/orcl/undotbs02.dbf' size 25m ;

Tablespace created.
SQL> select name  from v$datafile;

NAME
--------------------------------------------------------------------------------
/usr/oracle/oradata/orcl/system01.dbf
/usr/oracle/oradata/orcl/undotbs01.dbf
/usr/oracle/oradata/orcl/sysaux01.dbf
/usr/oracle/oradata/orcl/users01.dbf
/usr/oracle/oradata/orcl/tbtest01.dbf
/usr/oracle/oradata/orcl/undotbs02.dbf

6 rows selected.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/usr/oracle/oradata/orcl/redo03.log
/usr/oracle/oradata/orcl/redo02.log
/usr/oracle/oradata/orcl/redo01.log

SQL> alter database add logfile thread 2 group 4 '/usr/oracle/oradata/orcl/redo04.log' size 50m;

Database altered.

SQL> alter database add logfile thread 2 group 5 '/usr/oracle/oradata/orcl/redo05.log' size 50m;

Database altered.

SQL> alter database add logfile thread 2 group 6 '/usr/oracle/oradata/orcl/redo06.log' size 50m;

Database altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/usr/oracle/oradata/orcl/redo03.log
/usr/oracle/oradata/orcl/redo02.log
/usr/oracle/oradata/orcl/redo01.log
/usr/oracle/oradata/orcl/redo04.log
/usr/oracle/oradata/orcl/redo05.log
/usr/oracle/oradata/orcl/redo06.log

6 rows selected.

SQL> select thread#,group#,members from v$log;

   THREAD#     GROUP#  MEMBERS
---------- ---------- ----------
  1     1        1
  1     2        1
  1     3        1
  2     4        1
  2     5        1
  2     6        1

6 rows selected.
SQL> select thread#,group#,members,status from v$log;

   THREAD#     GROUP#  MEMBERS STATUS
---------- ---------- ---------- --------------------------------
  1     1        1 CURRENT
  1     2        1 INACTIVE
  1     3        1 INACTIVE
  2     4        1 UNUSED
  2     5        1 UNUSED
  2     6        1 UNUSED

6 rows selected.

SQL> alter database enable thread 2;

Database altered.

SQL> select thread#,group#,members,status from v$log;

   THREAD#     GROUP#  MEMBERS STATUS
---------- ---------- ---------- --------------------------------
  1     1        1 CURRENT
  1     2        1 INACTIVE
  1     3        1 INACTIVE
  2     4        1 CURRENT
  2     5        1 UNUSED
  2     6        1 UNUSED

6 rows selected.

SQL>

4、备份数据库,将数据文件,归档日志,控制文件,备份到/usr/oracle/backup/ 下面

[oracle@xxtdwhtest ~]$ export ORACLE_SID=orcl
[oracle@xxtdwhtest ~]$ rlwrap rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on 星期四 3月 3 20:41:30 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1272619553)


rman >backup as backupset database format='/usr/oracle/backup/orcl_%U.bak';
rman >sql 'alter system archive log current';

sql >alter database create standby controlfile as '/usr/oracle/backup/orclcontrol01.ctl';
rman >backup archivelog all format='/usr/oracle/backup/orclarchivelog_%U.bak';

Starting backup at 03-3月 -11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 03-3月 -11
channel ORA_DISK_1: finished piece 1 at 03-3月 -11
piece handle=/usr/oracle/backup/orclcontrol01.ctl tag=TAG20110303T210622 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 03-3月 -11

Starting backup at 03-3月 -11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/usr/oracle/oradata/orcl/system01.dbf
input datafile fno=00003 name=/usr/oracle/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/usr/oracle/oradata/orcl/tbtest01.dbf
input datafile fno=00002 name=/usr/oracle/oradata/orcl/undotbs01.dbf
input datafile fno=00006 name=/usr/oracle/oradata/orcl/undotbs02.dbf
input datafile fno=00004 name=/usr/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 03-3月 -11
channel ORA_DISK_1: finished piece 1 at 03-3月 -11
piece handle=/usr/oracle/backup/orcl_0em6aqmg_1_1.bak tag=TAG20110303T210623 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 03-3月 -11
channel ORA_DISK_1: finished piece 1 at 03-3月 -11
piece handle=/usr/oracle/backup/orcl_0fm6aqn9_1_1.bak tag=TAG20110303T210623 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 03-3月 -11

sql statement: alter system archive log current

Starting backup at 03-3月 -11
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=1 stamp=744840984
input archive log thread=1 sequence=2 recid=2 stamp=744842802
input archive log thread=1 sequence=3 recid=3 stamp=744842802
input archive log thread=1 sequence=4 recid=4 stamp=744842877
input archive log thread=1 sequence=5 recid=5 stamp=744842988
input archive log thread=1 sequence=6 recid=6 stamp=744842988
input archive log thread=1 sequence=7 recid=8 stamp=744843805
input archive log thread=1 sequence=8 recid=10 stamp=744843805
input archive log thread=1 sequence=9 recid=12 stamp=744844011
input archive log thread=1 sequence=10 recid=14 stamp=744844011
input archive log thread=2 sequence=1 recid=7 stamp=744843805
input archive log thread=2 sequence=2 recid=9 stamp=744843805
input archive log thread=2 sequence=3 recid=11 stamp=744844011
input archive log thread=2 sequence=4 recid=13 stamp=744844011
channel ORA_DISK_1: starting piece 1 at 03-3月 -11
channel ORA_DISK_1: finished piece 1 at 03-3月 -11
piece handle=/usr/oracle/backup/orclarchivelog_0gm6aqnb_1_1.bak tag=TAG20110303T210651 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 03-3月 -11

5、配置源数据库的tnsnames.ora

ORCLRAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.22)(PORT = 1521))
    (CONNECT_DATA =
      (SID = ORCLRAC1)
      (SERVER = DEDICATED)
    )
  )

添加后可以进行测试
[oracle@xxtdwhtest dbs]$ tnsping orclrac

TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 03-3月 -2011 21:44:56

Copyright (c) 1997,  2007, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.22)(PORT = 1521)) (CONNECT_DATA = (SID = ORCLRAC1) (SERVER = DEDICATED)))
OK (0 msec)
[oracle@xxtdwhtest dbs]$

6、修改主库的参数

ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLRAC)';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/usr/oracle/oradata/orcl/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORCL';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=ORCLRAC LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=ORCLRAC';
ALTER SYSTEM SET FAL_SERVER=ORCLRAC;
ALTER SYSTEM SET FAL_CLIENT=ORCL;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLRAC)';

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/usr/oracle/oradata/orcl/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORCL';

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=ORCLRAC LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=ORCLRAC';

System altered.

SQL> SHOW PARAMETER ARCHIVE LOG;

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
archive_lag_target       integer
0
log_archive_config       string
DG_CONFIG=(ORCL,ORCLRAC)
log_archive_dest       string

log_archive_dest_1       string
LOCATION=/usr/oracle/oradata/o
rcl/archivelog VALID_FOR=(ALL_

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
LOGFILES,ALL_ROLES) DB_UNIQUE_
NAME=ORCL
log_archive_dest_10       string

log_archive_dest_2       string
SERVICE=ORCLRAC LGWR ASYNC VAL
ID_FOR=(ONLINE_LOGFILES,PRIMAR
Y_ROLES) DB_UNIQUE_NAME=ORCLRA
C

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
log_archive_dest_3       string

log_archive_dest_4       string

log_archive_dest_5       string

log_archive_dest_6       string

log_archive_dest_7       string

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------

log_archive_dest_8       string

log_archive_dest_9       string

log_archive_dest_state_1      string
enable
log_archive_dest_state_10      string
enable

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
log_archive_dest_state_2      string
enable
log_archive_dest_state_3      string
enable
log_archive_dest_state_4      string
enable
log_archive_dest_state_5      string
enable
log_archive_dest_state_6      string

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
enable
log_archive_dest_state_7      string
enable
log_archive_dest_state_8      string
enable
log_archive_dest_state_9      string
enable
log_archive_duplex_dest       string


NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
log_archive_format       string
%t_%s_%r.dbf
log_archive_local_first       boolean
TRUE
log_archive_max_processes      integer
2
log_archive_min_succeed_dest      integer
1
log_archive_start       boolean

NAME         TYPE
------------------------------------ ----------------------
VALUE
------------------------------
FALSE
log_archive_trace       integer
0
remote_archive_enable       string
true
standby_archive_dest       string
?/dbs/arch

SQL> ALTER SYSTEM SET FAL_SERVER=ORCLRAC;

System altered.

SQL> ALTER SYSTEM SET FAL_CLIENT=ORCL;

System altered.
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

System altered.

SQL>

7、创建主库的pfile,并修改,作为standby rac的启动参数文件。
SQL> create pfile from spfile;

File created.

在文件
[oracle@xxtdwhtest backup]$ cd /usr/oracle/product/10.2.0/dbs/
[oracle@xxtdwhtest dbs]$ cat initorcl.ora
orcl.__db_cache_size=427819008
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=155189248
orcl.__streams_pool_size=0
*.audit_file_dest='/usr/oracle/admin/orcl/adump'
*.background_dump_dest='/usr/oracle/admin/orcl/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/usr/oracle/oradata/orcl/control01.ctl','/usr/oracle/oradata/orcl/control02.ctl','/usr/oracle/oradata/orcl/control03.ctl'
*.core_dump_dest='/usr/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.fal_client='ORCL'
*.fal_server='ORCLRAC'
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(ORCL,ORCLRAC)'
*.log_archive_dest_1='LOCATION=/usr/oracle/oradata/orcl/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ORCL'
*.log_archive_dest_2='SERVICE=ORCLRAC LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=ORCLRAC'
*.open_cursors=300
*.pga_aggregate_target=199229440
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=597688320
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/usr/oracle/admin/orcl/udump'

修改后作为rac初始化参数文件
的结果为:
orclrac2.__db_cache_size=427819008
orclrac2.__java_pool_size=4194304
orclrac2.__large_pool_size=4194304
orclrac2.__shared_pool_size=155189248
orclrac2.__streams_pool_size=0
*.audit_file_dest='/usr/oracle/admin/orcl/adump'
*.cluster_database=true
*.cluster_database_instances=2
*.compatible='10.2.0.3.0'
*.control_files='+data/orcl/controlfile/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.fal_client='ORCLRAC'
*.fal_server='ORCL'
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(ORCL,ORCLRAC)'
*.log_archive_dest_1='LOCATION=+data/orcl/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orclrac'
*.log_archive_dest_2='SERVICE=orcl LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=orcl'
*.open_cursors=300
*.pga_aggregate_target=199229440
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=597688320
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.db_unique_name='ORCLRAC'
*.log_file_name_convert=('/usr/oracle/oradata/orcl/archivelog/', '+data/ORCL/archivelog/')
*.db_file_name_convert=('/usr/oracle/oradata/orcl/', '+data/ORCL/DATAFILE/')
orclrac1.undo_tablespace='UNDOTBS1'
orclrac2.undo_tablespace='UNDOTBS2'
orclrac1.instance_number=1
orclrac2.instance_number=2
orclrac1.thread=1
orclrac2.thread=2
orclrac1.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.12.22)(PORT=1521))'
orclrac2.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.12.24)(PORT=1521))'

 

在orclrac1节点上/usr/oracle/product/10.2.0/db_1/dbs下创建orclrac1的启动参数文件initorclrac1.ora,内容为上面内容。
8、在orclrac1节点上创建文件夹audit_file_dest='/usr/oracle/admin/orcl/adump'
[oracle@rac1 admin]$ mkdir -p /usr/oracle/admin/orcl/adump
9、在orclrac1节点上创建实例orclrac1的密码文件
[oracle@rac1 dbs]$ orapwd file='orapworclrac1' password=sys entries=10
10、在orclrac1节点上创建实例orclrac1的监听器
在SID_LIST_LISTENER中添加

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = ORCL)
      (ORACLE_HOME = /usr/oracle/product/10.2.0/db_1)
    )
    (SID_DESC =
      (SID_NAME = ORCLRAC1)
      (ORACLE_HOME = /usr/oracle/product/10.2.0/db_1)
    )
  )

11、修改orclrac1节点上添加tnsnames.ora
ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.21)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL)
      (SERVER = DEDICATED)
    )
  )

12、在节点orclrac1上创建ASM的文件夹.
需要用到的文件夹
+data/ORCL/DATAFILE
+data/ORCL/archivelog
+data/orcl/controlfile/control01.ctl

 

13、恢复orclrac1上的数据库
将主库的/usr/oracle/backup/备份的文件拷贝到orclrac1上
scp * 192.168.12.22:/usr/oracle/backup/
(1)数据库启动到nomount状态,恢复控制文件。
[oracle@rac1 dbs]$ export ORACLE_SID=ORCLRAC1
[oracle@rac1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on 星期五 3月 4 09:49:23 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup pfile='/usr/oracle/product/10.2.0/db_1/dbs/initorclrac1.ora' nomount;
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                  2085776 bytes
Variable Size             159386736 bytes
Database Buffers          432013312 bytes
Redo Buffers                6299648 bytes

[oracle@rac1 dbs]$ export ORACLE_SID=orclrac1
[oracle@rac1 dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on 星期五 3月 4 09:50:08 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> restore controlfile  from '/usr/oracle/backup/orclcontrol01.ctl';

Starting restore at 04-3月 -11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 instance=orclrac1 devtype=DISK

 

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;
RMAN> recover database;


SQL> alter database recover managed standby database disconnect from session;


SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
            22

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +DATA/orcl/archivelog
Oldest online log sequence     21
Next log sequence to archive   0
Current log sequence           23

 

14、配置rac的第二个节点。
在第二个节点上创建/usr/oracle/admin/orcl/adump
将第一个节点的启动参数文件和密码文件拷贝到第二个节点。修改名称,
并修改启动参数文件的内存分配实例名称。

15、启动第二个节点的数据库到mount状态,
SQL> startup mount
SQL> alter database recover managed standby database disconnect from session;


16、注册到crs中
由于之前已经注册过其他内容,所以自需要添加数据库即可。
[oracle@rac1 dbs]$ srvctl add database -d orcl -o $ORACLE_HOME
[oracle@rac1 dbs]$ srvctl add instance -d orcl -n rac1 -i orclrac1
[oracle@rac1 dbs]$ srvctl add instance -d orcl -n rac2 -i orclrac2

17、进行switchover切换

在切换之前保证只有第一个节点启动,关闭其他节点。
select name, db_unique_name, database_role, switchover_status  from v$database;

切换之前先
在主库上执行
alter system switch logfile;
SQL> alter database commit to switchover to physical standby with session shutdown;
在唯一一个rac的节点上:
SQL> alter database commit to switchover to primary with session shutdown ;

 

你可能感兴趣的:(thread,oracle,数据库,database,System,archive)