专栏首页乐沙弥的世界Migrate database from single instance to Oracle RAC

Migrate database from single instance to Oracle RAC

Migrate database from single instance to Oracle RAC

# Preparation before restore # Backup database # check listener # check ASM disk group free space is sufficient. # the following steps was completed sucessful on Oracle 10g RAC + Suse Linux 10.

Synopsis:
source DB : GOBO1 on file system
Target DB : GOBO1 on RAC +ASM
Target Instance: GOBO1A, GOBO1B
Target node: bo2dbp, bo2dbs
Source Env: Oracle 10g(10.2.0.3) + Suse 10
Target Env: Oracle 10g(10.2.0.3) RAC + ASM + RAW + Suse 10
      ORA_CRS_HOME=/u01/oracle/crs
      ORA_ASM_HOME=/u01/oracle/asm
      ORACLE_BASE=/u01/oracle
      ORACLE_HOME=/u01/oracle/db

Step 1
# restore spfile
  export ORACLE_SID=GOBO1A
  rman target /
  startup nomount;
  restore spfile to pfile '/u01/oracle/db/dbs/initGOBO1A.ora'
  from '<dir>';
  shutdown immediate;

Step 2
# create directory for instance on local file system.(two nodes)
  export ORACLE_SID=GOBO1
  mkdir -p /u01/oracle/admin/${ORACLE_SID}/{bdump,cdump,udump,adump}

Step 3
#Modify pfile
#Remove original path and or change them to new path on target server.
#Add new item for cluster 
    cp initGOBO1A.ora initGOBO1A.ora.bak
    vi initGOBO1A.ora
  GOBO1.__db_cache_size=230686720
  GOBO1.__java_pool_size=4194304
  GOBO1.__large_pool_size=4194304
  GOBO1.__shared_pool_size=289406976
  GOBO1.__streams_pool_size=0
  *.compatible='10.2.0.3.0'
  
  #*.control_files='/u02/database/GOBO1/controlf/cntl1GOBO1.ctl','/u02/database/GOBO1/controlf/cntl2GOBO1.ctl',
  #'/u02/database/GOBO1/controlf/cntl3GOBO1.ctl'
  #*.core_dump_dest='/u02/database/GOBO1/cdump'
  
  *.db_block_size=8192
  *.db_domain=''
  *.db_file_multiblock_read_count=16
  *.DB_FLASHBACK_RETENTION_TARGET=2880
  *.db_name='GOBO1'
  
  #*.db_recovery_file_dest='/u02/database/GOBO1/flash_recovery_area'
  
  *.db_recovery_file_dest_size=4G
  
  *.dispatchers='(PROTOCOL=TCP) (SERVICE=GOBO1XDB)'
  *.job_queue_processes=10
  
  #*.LOG_ARCHIVE_DEST_1='LOCATION=/u02/database/GOBO1/archive/'
  
  *.log_archive_format='arch_%r_%t_%s.arc'
  *.open_cursors=300
  *.pga_aggregate_target=199229440
  *.processes=1000
  *.remote_login_passwordfile='EXCLUSIVE'
  *.sga_target=512M
  *.shared_pool_size=256M
  
  #*.undo_management='AUTO'
  #*.undo_tablespace='UNDOTBS1'
  #*.user_dump_dest='/u02/database/GOBO1/udump'
  #*.UTL_FILE_DIR='/u02/database/GOBO1/udump'
  #*.background_dump_dest='/u02/database/GOBO1/bdump'
  
  #Added new dump directory
  *.core_dump_dest='/u01/oracle/admin/GOBO1/cdump'
  *.user_dump_dest='/u01/oracle/admin/GOBO1/udump'
  *.UTL_FILE_DIR='/u01/oracle/admin/GOBO1/udump'
  *.background_dump_dest='/u01/oracle/admin/GOBO1/bdump'
  *.audit_file_dest='/u01/oracle/admin/GOBO1/adump'
  
  *.cluster_database = TRUE 
  *.cluster_database_instances = 2 
  *.undo_management='AUTO' 
  *.control_files='+DG1/GOBO1/controlf/cntl1GOBO1.ctl','+DG1/GOBO1/controlf/cntl2GOBO1.ctl'
  
  GOBO1A.undo_tablespace='UNDOTBS1'
  GOBO1A.instance_name=GOBO1A 
  GOBO1A.instance_number=1 
  GOBO1A.thread=1 
  #GOBO1A.local_listener=<LISTENERNAME>_<HOSTNAME1>
  
  GOBO1B.undo_tablespace='UNDOTBS2' 
  GOBO1B.instance_name=GOBO1B
  GOBO1B.instance_number=2 
  #GOBO1B.thread=2 
  #GOBO1B.local_listener=<LISTENERNAME>_<HOSTNAME2>
  
  *.db_create_file_dest='+DG2'
  *.db_recovery_file_dest='+REV'
  *.log_archive_dest_1='LOCATION=+REV/GOBO1/archivelog'

Step 4
#Create directory on ASM for new database
#Currently, seperate different file type to different disk group.

    export ORACLE_SID=+ASM1
  asmcmd
  cd +DG1
  mkdir GOBO1
  cd GOBO1
  mkdir controlf parameterf onlinelog
  
  cd +DG2
  mkdir GOBO1
  cd GOBO1
  mkdir datafile
  
Step 5
#Create password on 2 nodes.
  $ORACLE_HOME/dbs/orapwd file=?/dbs/orapwGOBO1A password=oracle entries=10
  
  $ORACLE_HOME/dbs/orapwd file=?/dbs/orapwGOBO1B password=oracle entries=10
    
Step 6
#Generate spfile from pfile
  export ORACLE_SID=GOBO1A
  sqlplus / as sysdba
  startup nomount;
  create spfile='+DG1/GOBO1/parameterf/spfileGOBO1.ora' from pfile='/u01/oracle/db/dbs/initGOBO1A.ora' 
  shutdown immediate;
  
  echo "SPFILE='+DG1/GOBO1/parameterf/spfileGOBO1.ora'" >/u01/oracle/db/dbs/initGOBO1A.ora  # on node A ( two nodes)
  echo "SPFILE='+DG1/GOBO1/parameterf/spfileGOBO1.ora'" >/u01/oracle/db/dbs/initGOBO1B.ora  # on node B ( two nodes)
  
  startup nomount;
  show parameter spfile;

Step 7
#Restore controlfile from autobackup
  export ORACLE_SID=GOBO1A
  $ORACLE_HOME/bin/rman target /
  restore controlfile from '<dir>';
  sql 'alter database mount';  
  
Step 8
#Check datafile path and convert to ASM
#Restore Database
  sys@GOBO1> select file_id,file_name from dba_data_files order by 1;
  
     FILE_ID FILE_NAME
  ---------- ------------------------------------------------------------
           1 /u02/database/GOBO1/oradata/sysGOBO1.dbf
           2 /u02/database/GOBO1/undo/undotbsGOBO1.dbf
           3 /u02/database/GOBO1/oradata/sysauxGOBO1.dbf
           4 /u02/database/GOBO1/undo/undotbsGOBO12.dbf
           5 /u02/database/GOBO1/oradata/GOBO1_account_tbl.dbf
           6 /u02/database/GOBO1/oradata/GOBO1_stock_tbl.dbf
           7 /u02/database/GOBO1/oradata/GOBO1_stock_l_tbl.dbf
           8 /u02/database/GOBO1/oradata/GOBO1_tx_tbl.dbf
           9 /u02/database/GOBO1/oradata/GOBO1_users_tbl.dbf
          10 /u02/database/GOBO1/oradata/GOBO1_account_idx.dbf
          11 /u02/database/GOBO1/oradata/GOBO1_stock_idx.dbf
          12 /u02/database/GOBO1/oradata/GOBO1_stock_l_idx.dbf
          13 /u02/database/GOBO1/oradata/GOBO1_tx_idx.dbf
          14 /u02/database/GOBO1/oradata/GOBO1_users_idx.dbf
          15 /u02/database/GOBO1/oradata/GOBO1_IES_IDX.DBF
          16 /u02/database/GOBO1/oradata/GOBO1_IES_TBL.DBF
          17 /u02/database/GOBO1/oradata/GOBO1_import_idx.dbf
          18 /u02/database/GOBO1/oradata/GOBO1_import_tbl.dbf
          19 /u02/database/GOBO1/oradata/GOBO1_fix_tx_idx.dbf
          20 /u02/database/GOBO1/oradata/GOBO1_fix_tx_tbl.dbf
          21 /u02/database/GOBO1/oradata/GOBO1_fix_users_idx.dbf
          22 /u02/database/GOBO1/oradata/GOBO1_fix_users_tbl.dbf
          23 /u02/database/GOBO1/oradata/xxxx_ipo_tbl.dbf
          24 /u02/database/GOBO1/oradata/xxxx_ipo_idx.dbf
  catalog start with '/install_source/rman_bak';    
  run { 
  set newname for datafile 1 to   '+DG2/GOBO1/datafile/sysGOBO1.dbf';             
  set newname for datafile 2 to   '+DG2/GOBO1/datafile/undotbsGOBO1.dbf';         
  set newname for datafile 3 to   '+DG2/GOBO1/datafile/sysauxGOBO1.dbf';          
  set newname for datafile 4 to   '+DG2/GOBO1/datafile/undotbsGOBO12.dbf';        
  set newname for datafile 5 to   '+DG2/GOBO1/datafile/GOBO1_account_tbl.dbf';    
  set newname for datafile 6 to   '+DG2/GOBO1/datafile/GOBO1_stock_tbl.dbf';      
  set newname for datafile 7 to   '+DG2/GOBO1/datafile/GOBO1_stock_l_tbl.dbf';    
  set newname for datafile 8 to   '+DG2/GOBO1/datafile/GOBO1_tx_tbl.dbf';         
  set newname for datafile 9 to   '+DG2/GOBO1/datafile/GOBO1_users_tbl.dbf';      
  set newname for datafile 10 to  '+DG2/GOBO1/datafile/GOBO1_account_idx.dbf';    
  set newname for datafile 11 to  '+DG2/GOBO1/datafile/GOBO1_stock_idx.dbf';      
  set newname for datafile 12 to  '+DG2/GOBO1/datafile/GOBO1_stock_l_idx.dbf';    
  set newname for datafile 13 to  '+DG2/GOBO1/datafile/GOBO1_tx_idx.dbf';         
  set newname for datafile 14 to  '+DG2/GOBO1/datafile/GOBO1_users_idx.dbf';      
  set newname for datafile 15 to  '+DG2/GOBO1/datafile/GOBO1_IES_IDX.DBF';        
  set newname for datafile 16 to  '+DG2/GOBO1/datafile/GOBO1_IES_TBL.DBF';        
  set newname for datafile 17 to  '+DG2/GOBO1/datafile/GOBO1_import_idx.dbf';     
  set newname for datafile 18 to  '+DG2/GOBO1/datafile/GOBO1_import_tbl.dbf';     
  set newname for datafile 19 to  '+DG2/GOBO1/datafile/GOBO1_fix_tx_idx.dbf';     
  set newname for datafile 20 to  '+DG2/GOBO1/datafile/GOBO1_fix_tx_tbl.dbf';     
  set newname for datafile 21 to  '+DG2/GOBO1/datafile/GOBO1_fix_users_idx.dbf';  
  set newname for datafile 22 to '+DG2/GOBO1/datafile/GOBO1_fix_users_tbl.dbf';   
  set newname for datafile 23 to  '+DG2/GOBO1/datafile/xxxx_ipo_tbl.dbf';         
  set newname for datafile 24 to  '+DG2/GOBO1/datafile/xxxx_ipo_idx.dbf';         
  restore database;   
  switch datafile all;
  switch tempfile all;
  } 

Step 9
#Recover database
  recover database;

Step 10
#Handle online redo log
  sys@GOBO1> select * from v$logfile;
  
      GROUP# STATUS  TYPE    MEMBER                                                       IS_
  ---------- ------- ------- ------------------------------------------------------------ ---
           1         ONLINE  /u02/database/GOBO1/redolog/log1aGOBO1.log                   NO
           1         ONLINE  /u02/database/GOBO1/redolog/log1bGOBO1.log                   NO
           3         ONLINE  /u02/database/GOBO1/redolog/log3aGOBO1.log                   NO
           3         ONLINE  /u02/database/GOBO1/redolog/log3bGOBO1.log                   NO
           2         ONLINE  /u02/database/GOBO1/redolog/log2aGOBO1.log                   NO
           2         ONLINE  /u02/database/GOBO1/redolog/log2bGOBO1.log                   NO    
  
  alter database rename file '/u02/database/GOBO1/redolog/log1aGOBO1.log' to '+DG1/GOBO1/onlinelog/log1aGOBO1.log'; 
  alter database rename file '/u02/database/GOBO1/redolog/log1bGOBO1.log' to '+DG1/GOBO1/onlinelog/log1bGOBO1.log'; 
  alter database rename file '/u02/database/GOBO1/redolog/log3aGOBO1.log' to '+DG1/GOBO1/onlinelog/log3aGOBO1.log'; 
  alter database rename file '/u02/database/GOBO1/redolog/log3bGOBO1.log' to '+DG1/GOBO1/onlinelog/log3bGOBO1.log'; 
  alter database rename file '/u02/database/GOBO1/redolog/log2aGOBO1.log' to '+DG1/GOBO1/onlinelog/log2aGOBO1.log'; 
  alter database rename file '/u02/database/GOBO1/redolog/log2bGOBO1.log' to '+DG1/GOBO1/onlinelog/log2bGOBO1.log'; 
  
  #Add online log for instance 2
  alter database add logfile thread 2 group 4 
    ('+DG1/GOBO1/onlinelog/log4aGOBO1.log','+DG1/GOBO1/onlinelog/log4bGOBO1.log') size 20M; 
  alter database add logfile thread 2 group 5 
    ('+DG1/GOBO1/onlinelog/log5aGOBO1.log','+DG1/GOBO1/onlinelog/log5bGOBO1.log') size 20M;
  alter database add logfile thread 2 group 6
    ('+DG1/GOBO1/onlinelog/log6aGOBO1.log','+DG1/GOBO1/onlinelog/log6bGOBO1.log') size 20M;
  

Step 11
#open the database with resetlogs
  
  alter database open resetlogs; --> if failed, recover database using backup controlfile until cancel by sqlplus;

Step 12
#modify parameter 
  alter system set thread=1 scope=spfile sid='GOBO1A';
  alter system set thread=2 scope=spfile sid='GOBO1B';
  alter database enable thread 2;    

Step 13
#add undo tablspace for instance 2
  alter system set undo_tablespace='UNDOTBS2' scope=spfile sid='GOBO1B';  
  -->if current db has no undotbs2,create it firstly as follows
  create undo tablespace UNDOTBS2 datafile '+DG2/GOBO1/datafile/undotbs02.dbf' size 500m autoextnd on; 

Step 14
# add temporary tablespace and datafile 

  col file_name format a55
  select file_name,tablespace_name,bytes/1022/1024 from dba_temp_files;
  alter tablespace temp add tempfile '+DG2/GOBO1/datafile/temp.dbf' size 50m;
  alter tablespace goex_temp add tempfile '+DG2/GOBO1/datafile/goex_temp.dbf' size 50m;

Step 15
# check default temporary tablespace for all users. If that are different from orginal database, amend them.

  select username,default_tablespace,temporary_tablespace from dba_users; 

Step 16
#check parameter
  select * from v$option where parameter = 'Real Application Clusters';
  show parameter cluster;
  show parameter thread;
  show parameter instance_number;

Step 17
# restart instance 1
# check alert log file

Step 18
# start instance 2
# check alert log file

Step 19
# check all instance is fine.
  select instance_number,instance_name,host_name from gv$instance;

Step 20
#create cluster database specific views within the existing instance

  $ORACLE_HOME/rdbms/admin/catclust.sql
  
Step 21
# configure listener 
  by netca
  ps -ef | grep lsnr
  crs_stat -t #check listener
  
Step 22
#Add configuration to crs
  srvctl add database -d GOBO1 -o $ORACLE_HOME -p +DG1/GOBO1/parameterf/spfileGOBO1.ora 
  srvctl add instance -d GOBO1 -i GOBO1A -n bo2dbp
  srvctl add instance -d GOBO1 -i GOBO1B -n bo2dbs

  srvctl modify instance -d GOBO1 -i GOBO1A -s +ASM1
  srvctl modify instance -d GOBO1 -i GOBO1B -s +ASM2
  crs_stat -t

Step 23
#Restart database
#Author : Robinson
#Blog : http://blog.csdn.net/robinson_0612

  srvctl start database -d GOBO1  

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 自定义 RMAN 显示的日期时间格式

          缺省情况下,使用RMAN备份与恢复界面仅仅显示的是日期,而没有具体的时间。有时候需要查看具体的时间,如查看当天多个Incarnation的情形。对于...

    Leshami
  • MySQL 错误日志(Error Log)

        同大多数关系型数据库一样,日志文件是MySQL数据库的重要组成部分。MySQL有几种不同的日志文件,通常包括错误日志文件,二进制日志,通用日志,慢查询日...

    Leshami
  • MySQL数据类型 -- 字符型

    版权声明:本文为博主原创文章,欢迎扩散,扩散请务必注明出处。 https://blog.csdn.net/robinson_0612/art...

    Leshami
  • 漏洞环境搭建之Windows+IIS6.0+SqlServer+ASP

    下载地址:http://www.downza.cn/soft/182837.html SQLEXPR_CHS.exe(2005)

    HACK学习
  • 图同构下等变、计算高效,韦灵思团队提出「自然图网络」消息传递方法

    通常来说,常规神经消息传递算法在消息排列下是不变的,因此会忘记信息流如何在网络中传递。

    机器之心
  • 【Rust问答】Box 和 Cell 之间有什么本质区别?

    Box 和 Cell 之间的本质区别是什么?两者主要的应用场景为何?通过一些搜索和文档阅读,我了解到两者确实有很多不同点,但是我一直没有找到对于“本质区别”这个...

    MikeLoveRust
  • “净广大师”病毒HTTPS劫持技术深度分析

    近期,火绒团队截获一个由商业软件携带的病毒,并以其载体命名为“净广大师”病毒。在目前广为流行的“流量劫持”类病毒中,该病毒策略高明、技术暴力,并攻破HTTPS的...

    用户6477171
  • 业界关注的NFV,近况如何?

    实现了功能虚拟化的网络能够使通信服务提供商快速提供服务、分析和自动化的网络,加速新服务投向市场的周期,并有效利用数据中心的通用平台。 ? 网络功能虚拟化旨在帮助...

    SDNLAB
  • OKR: Objectives and Key Results(目标和关键成果)

    Fred Liang
  • volatile详解

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

    suveng

扫码关注云+社区

领取腾讯云代金券