ITPub博客

首页 > 数据库 > Oracle > MAA (rac+dg)环境搭建

MAA (rac+dg)环境搭建

原创 Oracle 作者:xj951423274 时间:2015-12-01 00:25:52 0 删除 编辑
平台 OS:linux redha    ORACLE:11GR2  两个正常的RAC环境
            instance       node             
primary  RACDB    racy1,racy2
standby  SBDB     racx1,racx2 (这个集群上之前装的库不用,重新创建STANDBY )

步骤1:IP配置,4个节点能够互通 /etc/hosts 
racy1,racy2 结尾添加 racx1,racx2的public IP 和VIP
 racx1,racx2 结尾添加 racy1,racy2 的public IP 和VIP

步骤2:开启归档,强制日志 (racy1,racy2)

lter database archivelog;  //归档目的地默认
alter database open;
alter database force logging;

步骤3,racx1,racx2上之前的库关闭,检查ASM diskgroup 状态 和CRS状态   
在racy1  设置TNS 启动监听 scp 到另外3个节点

点击(此处)折叠或打开

  1. RACDB= (DESCRIPTION =
  2.      (ADDRESS_LIST =
  3.          (ADDRESS = (PROTOCOL = TCP)(HOST = racy1-vip)(PORT = 1521))
  4.          (ADDRESS = (PROTOCOL = TCP)(HOST = racy2-vip)(PORT = 1521))
  5.      )
  6.       (CONNECT_DATA = 
  7.             (SERVICE_NAME =RACDB)
  8.       )
  9. )
  10. SBDB= (DESCRIPTION =
  11.      (ADDRESS_LIST =
  12.          (ADDRESS = (PROTOCOL = TCP)(HOST = racx1-vip)(PORT = 1521))
  13.          (ADDRESS = (PROTOCOL = TCP)(HOST = racx2-vip)(PORT = 1521))
  14.      )
  15.       (CONNECT_DATA = 
  16.         (SERVICE_NAME =SBDB)
  17.       )
  18. )
步骤4,racy1 生成口令文件,PFILE
orapwd file=orapwRACDB1 password=oracle entries=3 force=y
SCP 到racx2 orapwSBDB1

create pfile='/home/oracle/initRACDB.ora' from spfile;
vi initRACDB.ora

点击(此处)折叠或打开

  1. #注释dispatchers
  2. #结尾添加如下内容
  3. DB_UNIQUE_NAME=RACDB LOG_ARCHIVE_CONFIG='DG_CONFIG=(RACDB,SBDB)' LOG_ARCHIVE_DEST_1='LOCATION=+RCV/RACDB/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=RACDB' LOG_ARCHIVE_DEST_2='SERVICE=SBDB LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SBDB'

  4. FAL_SERVER=SBDB FAL_CLIENT=RACDB
步骤5,
racy1 grid 用户创建目录ASMCMD
cd +RCV          mkdir SBDB 

cd +DATA        mkdir SBDB

racx1 grid用户创建目录ASMCMD
cd +INFO     mkdir SBDB RACDB 

cd +FBA       mkdir SBDB RACDB

racy1 ,racx1 oracle 用户创建目录

mkdir -p /u01/app/oracle/admin/SBDB/adump

chown -R oracle:dba /u01/app/oracle/admin/SBDB/adump


步骤6,改完参数文件后
racy1:
startup nomount pfile='/home/oracle/initRACDB.ora';

create spfile='+DATA/racdb/spfileracdb.ora' from pfile='/home/oracle/initRACDB.ora';

shutdown immediate;
startup mount;


步骤7,
cp initRACDB.ora     initSBDB.ora 

vi initSBDB.ora
RACDB 和SBDB 互换 包括PATH名称互换,注释下划线的参数
scp initSBDB.ora     racx1:/home/oracle/initSBDB1.ora

步骤8,利用RMAN创建STANDBY 数据库
RMAN TARGET /

CONFIGURE  BACKUP OPTIMIZATION ON;

CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/backup/%d_%T_%U.bak' MAXPIECESIZE 2G;


run{

allocate channel c1 type disk;

  
allocate channel c2 type disk;

backup database format '/u01/backup/%d_%s_%p_cold.bak';

}

将备份集SCP传到 racx1:/u01/backup
racy1: RMAN >

backup current controlfile for standby format '/home/oracle/RACDB_control.bak';

shutdown immediate;

scp RACDB_control.bak  racx1:/home/oracle


步骤9,racx1
export ORACLE_SID=SBDB1
sqlplus '/as sysdba'
startup nomount pfile='/home/oracle/initSBDB1.ora'; 

create spfile='+INFO/sbdb/spfilesbdb.ora' from pfile='/home/oracle/initSBDB1.ora';


cd $ORACLE_HOME/dbs

vi initSBDB1.ora

添加:

spfile='+INFO/sbdb/spfilesbdb.ora'

scp initSBDB1.ora      racx2:$ORACLE_HOME/dbs/initSBDB2.ora

shutdown immediate; startup nomount;


步骤10,将密码文件从racy1复制到racx1,racx2
scp orapwRACDB1  racx1:$ORACLE_HOME/dbs/orapwSBDB1
scp orapwRACDB1  racx2:$ORACLE_HOME/dbs/orapwSBDB2

export ORACLE_SID=SBDB1
rman target /

restore standby controlfile from '/home/oracle/RACDB_control.bak';
alter database mount;

run{

allocate channel c11 type disk; allocate channel c12 type disk; restore database;

}


alter database open;

步骤11,依次启动racy1,racy2,racx2节点,至此差不多结束了
先关闭primary 后关闭standby  
standby 在mount 时 使用 alter database recover managed standby database disconnect from session; 应用日志


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28275505/viewspace-1850137/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 常用命令
请登录后发表评论 登录
全部评论

注册时间:2013-07-29

  • 博文量
    22
  • 访问量
    29235