m6米乐安卓版下载-米乐app官网下载
暂无图片
1
暂无图片
暂无图片
暂无图片

oracle 19c rac dataguard 配置 -m6米乐安卓版下载

原创 许玉冲 2023-08-05
442
  主库 备库
架构 rac rac
版本 19.20 19.20
db_name cdb cdb
db_unique_name cdb sbcdb
实例信息 cdb1/cdb2 sbcdb1/sbcdb2



#主库信息
192.168.123.110 rac01 192.168.123.111 rac01-vip 192.168.123.112 rac02 192.168.123.113 rac02-vip #备库信息 192.168.123.200 rac03 192.168.123.201 rac03-vip 192.168.123.202 rac04 192.168.123.203 rac04-vip


1,主数据库开启归档


alter system set log_archive_dest_1='location= data';
alter database force logging;


2,建立备库


参考命令:

#-gdbname cdb -sid sbcdb:目标库的db_name 和 sid
dbca -silent -createduplicatedb \
-syspassword oracle \
-primarydbconnectionstring rac01:1521/cdb \
-databaseconfigtype rac \
-adminmanaged -nodelist rac03,rac04 \
-sid sbcdb -dbuniquename sbcdb \
-gdbname cdb \
-storagetype asm \
-datafiledestination  data \
-initparams db_create_file_dest=' data' \
-createasstandby


执行日志:

#本次操作在备库1号节点操作。[oracle@rac03 ~]$ dbca -silent -createduplicatedb \
> -syspassword oracle \
> -primarydbconnectionstring rac01:1521/cdb \
> -databaseconfigtype rac \
> -adminmanaged -nodelist rac03,rac04 \
> -sid sbcdb -dbuniquename sbcdb \
> -gdbname cdb \
> -storagetype asm \
> -datafiledestination  data \
> -initparams db_create_file_dest=' data' \
> -createasstandby
prepare for db operation
22% complete
listener config step
44% complete
auxiliary instance creation
67% complete
rman duplicate
89% complete
post duplicate database operations
100% complete
look at the log file "/u01/app/oracle/cfgtoollogs/dbca/sbcdb/sbcdb.log" for further details.


dbca自动建立一个静态监听,用户rman duplicate;



[oracle@rac03 admin]$ cat listener.ora 
# listener.ora network configuration file: /u01/app/oracle/product/19.0.0/db_1/network/admin/listener.ora
# generated by oracle configuration tools.
sid_list_listener20230805041403 =
  (sid_list =
    (sid_desc =
      (sid_name = sbcdb1)
    )
  )
listener20230805041403 =
  (address_list =
    (address = (protocol = tcp)(host = rac03)(port = 1522))
  )
[oracle@rac03 admin]$ lsnrctl status listener20230805041403
lsnrctl for linux: version 19.0.0.0.0 - production on 05-aug-2023 16:29:15
米乐app官网下载 copyright (c) 1991, 2023, oracle.  all rights reserved.
connecting to (address=(protocol=tcp)(host=rac03)(port=1522))
status of the listener
------------------------
alias                     listener20230805041403
version                   tnslsnr for linux: version 19.0.0.0.0 - production
start date                05-aug-2023 16:14:21
uptime                    0 days 0 hr. 14 min. 53 sec
trace level               off
security                  on: local os authentication
snmp                      off
listener parameter file   /u01/app/oracle/product/19.0.0/db_1/network/admin/listener.ora
listener log file         /u01/app/oracle/diag/tnslsnr/rac03/listener20230805041403/alert/log.xml
listening endpoints summary...
  (description=(address=(protocol=tcp)(host=rac03)(port=1522)))  <==============================================由于集群已经使用了1521端口,自动建立了1522端口的监听。
services summary...
service "sbcdb1" has 1 instance(s).
  instance "sbcdb1", status unknown, has 1 handler(s) for this service...
the command completed successfully


3,所有节点配置tnsnames.ora


[oracle@rac04 admin]$ pwd
/u01/app/oracle/product/19.0.0/db_1/network/admin
[oracle@rac04 admin]$ cat tnsnames.ora 
# tnsnames.ora network configuration file: /u01/app/oracle/product/19.0.0/db_1/network/admin/tnsnames.ora
# generated by oracle configuration tools.
cdb =
  (description =
    (address = (protocol = tcp)(host = rac01-vip)(port = 1521))
    (address = (protocol = tcp)(host = rac02-vip)(port = 1521))
    (connect_data =
      (service_name = cdb)
    )
  )
sbcdb =
  (description =
    (address = (protocol = tcp)(host = rac03-vip)(port = 1521))
    (address = (protocol = tcp)(host = rac04-vip)(port = 1521))
    (connect_data =
      (service_name = sbcdb)
    )
  )


4,配置dataguard 日志同步


#主配置alter system set log_archive_config='dg_config=(cdb,sbcdb)';
alter system set log_archive_dest_2='service=sbcdb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=sbcdb';
alter system set fal_server=sbcdb;
alter system set standby_file_management=auto;

#备配置 alter system set log_archive_config='dg_config=(cdb,sbcdb)'; alter system set log_archive_dest_2='service=cdb lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=cdb'; alter system set fal_server=cdb; alter system set standby_file_management=auto;


5,配置 standby redologs(配置个数为n 1)


alter database add standby logfile thread 1 ' data' size 200m;
alter database add standby logfile thread 1 ' data' size 200m;
alter database add standby logfile thread 2 ' data' size 200m;
alter database add standby logfile thread 2 ' data' size 200m;


6,启动同步(19c 默认为real-time query)


sql> alter database recover managed standby database disconnect;
database altered.
sql> select open_mode from v$database;
open_mode
--------------------
read only with apply

#停止命令:alter database recover managed standby database cancel;

this also automatically enables real-time apply provided the standby database is configured with a standby redo log and is in 

archivelog  mode.

sql> alter database recover managed standby database using archived logfile disconnect;

this statement starts a detached server process and immediately returns control to the user. while the managed recovery process is performing recovery in the background, the foreground process that issued the 

recover  statement can continue performing other tasks. this command does not disconnect the current sql session.





7,检查同步(备库查询即可)


select process,status,sequence#,thread#,block# from v$managed_standby;
-- 12c 以后新视图v$dataguard_proce
select name,type,role,action,group# from v$dataguard_process;
set linesize 500;
col value format a20;
select * from v$dataguard_stats;

#主切换归档
alter system archive log current;

#同步状态查询process status sequence# thread# block# --------- ------------ ---------- ---------- ---------- arch connected 0 0 0 dgrd allocated 0 0 0 dgrd allocated 0 0 0 arch connected 0 0 0 arch connected 0 0 0 arch connected 0 0 0 mrp0 applying_log 26 1 104 rfs idle 0 1 0 rfs idle 12 2 97 rfs idle 0 1 0 rfs idle 26 1 105 process status sequence# thread# block# --------- ------------ ---------- ---------- ---------- rfs idle 0 0 0 rfs idle 0 0 0 rfs idle 0 0 0 14 rows selected. sql> sql> sql> name typ role action group# ----- --- ------------------------ ------------ ---------- lgwr ksb log writer idle 0 tmon ksb redo transport monitor idle 0 tt00 ksv gap manager idle 0 tt01 ksv redo transport timer idle 0 arc0 ksb archive local idle 0 arc1 ksb archive redo idle 0 arc2 ksb archive redo idle 0 arc3 ksb archive redo idle 0 rfs net rfs ping idle 0 rfs net rfs ping idle 0 rfs net rfs archive idle 0 name typ role action group# ----- --- ------------------------ ------------ ---------- rfs net rfs archive idle 0 rfs net rfs archive idle 0 rfs net rfs async idle 5 rfs net rfs async idle 7 mrp0 ksb managed recovery idle 0 pr00 ksv recovery logmerger applying_log 0 pr01 ksv recovery apply slave idle 0 pr02 ksv recovery apply slave idle 0 pr03 ksv recovery apply slave idle 0 pr04 ksv recovery apply slave idle 0 21 rows selected. sql> sql> sql> source_dbid source_db_unique_name name value unit time_computed datum_time con_id ----------- -------------------------------- -------------------------------- -------------------- ------------------------------ ------------------------------ ------------------------------ ---------- 0 transport lag 00 00:00:00 day(2) to second(0) interval 08/05/2023 17:21:22 08/05/2023 17:21:20 0 0 apply lag 00 00:00:00 day(2) to second(0) interval 08/05/2023 17:21:22 08/05/2023 17:21:20 0 0 apply finish time day(2) to second(3) interval 08/05/2023 17:21:22 0 0 estimated startup time 26 second 08/05/2023 17:21:22 0 sql



参考:

https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/managing-oracle-data-guard-physical-standby-databases.html#guid-194b1448-84fb-4357-a6ad-72a77701f918
https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/-data-guard-redo-apply-services.html#guid-54fa44f8-1eda-4caf-8b04-90cc6108fed8
































































最后修改时间:2023-08-05 17:41:45
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图