oracle之DG搭建

1、    测试环境
ORACLE主库 IP10.1.1.14  SID:YEYEAI
ORACLE 从库 IP10.1.1.25  SID:STANDBY
2、    修改主库参数文件为:fuck.ora (红色为修改的部分)
YEYEAI.__db_cache_size=88080384
YEYEAI.__java_pool_size=4194304
YEYEAI.__large_pool_size=4194304
YEYEAI.__shared_pool_size=67108864
YEYEAI.__streams_pool_size=0
*.audit_file_dest='/oracle/app/admin/YEYEAI/adump'
*.background_dump_dest='/oracle/app/admin/YEYEAI/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oracle/app/oradata/YEYEAI/control01.ctl','/oracle/app/oradata/YEYEAI/control02.ctl','/oracle/app/oradata/YEYEAI/co
ntrol03.ctl'
*.core_dump_dest='/oracle/app/admin/YEYEAI/cdump'
*.db_block_size=8192
*.db_name='YEYEAI'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_recovery_file_dest='/oracle/app/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=YEYEAIXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/admin/YEYEAI/udump'
STANDBY_ARCHIVE_DEST='/oracle/app/flash_recovery_area/YEYEAI/archivelog'
db_unique_name='yeyeai'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(yeyeai,standby)'
LOG_ARCHIVE_DEST_1='LOCATION=/oracle/app/flash_recovery_area/YEYEAI/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=YEYEAI'
LOG_ARCHIVE_DEST_2='SERVICE=standby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby'
FAL_SERVER=standby
FAL_CLIENT=yeyeai
DB_FILE_NAME_CONVERT='/oracle/app/oradata/YEYEAI','/oracle/oradata/STANDBY'
LOG_FILE_NAME_CONVERT='/oracle/app/oradata/YEYEAI','/oracle/oradata/STANDBY'
STANDBY_FILE_MANAGEMENT=AUTO
3、    修改从库的配置文件为:fuck.ora
*.audit_file_dest='/oracle/app/admin/STANDBY/adump'
*.background_dump_dest='/oracle/app/admin/STANDBY/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oracle/oradata/STANDBY/control01.ctl','/oracle/oradata/STANDBY/control02.ctl','/oracle/oradata/STANDBY/control03.ctl'
*.core_dump_dest='/oracle/app/admin/STANDBY/cdump'
*.db_16k_cache_size=16777216
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_recovery_file_dest='/oracle/app/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=STANDBYXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.db_name='YEYEAI'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/oracle/app/admin/STANDBY/udump'
DB_UNIQUE_NAME='YEYEAI'
LOG_ARCHIVE_CONFIG='DG_CONFIG=(yeyeai,standby)'
DB_FILE_NAME_CONVERT='/oracle/app/oradata/YEYEAI','/oracle/oradata/STANDBY'
LOG_FILE_NAME_CONVERT='/oracle/app/oradata/YEYEAI','/oracle/oradata/STANDBY'
LOG_ARCHIVE_DEST_1='LOCATION=/oracle/app/flash_recovery_area/YEYEAI/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
LOG_ARCHIVE_DEST_2='SERVICE=yeyeai LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=YEYEAI'
FAL_SERVER=yeyeai
FAL_CLIENT=standby
STANDBY_FILE_MANAGEMENT=AUTO
4、    修改主库的listener.ora文件
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = YEYEAI)
      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
      (SID_NAME = YEYEAI)
    )
  )
 
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.14)(PORT = 1521))
  )
5、    修改主库的tnsnames.ora文件
YEYEAI =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =10.1.1.14)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = YEYEAI)
    )
  )
STANDBY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =10.1.1.25)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = standby)
    )
  )
 
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
 
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PL***tProc)
      (PRESENTATION = RO)
    )
  )
6、    修改从库的listener.ora文件
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = STANDBY)
      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)
      (SID_NAME = STANDBY)
    )
  )
 
LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.25)(PORT = 1521))
  )
7、    修改从库的tnsnames.ora文件
 
yeyeai =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.14)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = YEYEAI)
    )
  )
8、   主库和从库都启动监听:lsnrctl start
9、设置服务器为归档模式
alter database archivelog
设置主数据库为日志强制写状态
alter database force logging;
查看状态日志强制写状态为YES
select t.FORCE_LOGGING from v$database t
10.主库的数据用RMAN进行全备份:
 RMAN > connect target /
RMAN >backup full database include current controlfile for standby;
11.备份后将备份集传到从库(注意备份集的路径要相同
主库:
   
从库:
12.在主库执行RMAN恢复备库数据:
RMAN > connect auxiliary sys/aiyeye@slave
RMAN > duplicate target database for standby nofilenamecheck;
完毕后从库回自动到 mount 状态
13 .在从库执行自动恢复状态
alter database recover managed standby database disconnect from session;
14.主库执行:
    select process from v$managed_standby;
查看进程,看有没有LNS进程,如果没有
 
测试数据库同步成功
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值