Oracle学习之DATAGUARD(六) 创建和启用Broker配置
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Oracle学习之DATAGUARD(六) 创建和启用Broker配置,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含7132字,纯文字阅读大概需要11分钟。
内容图文
DataGuard Broker是一个分布式管理架构用于自动创建、维护和监视dataguard配置。你可以使用OEM(图像化界面)或者DGMGRL(命令行方式)进行以下操作:1。创建和激活dataguard配置,包括设置redo transport services and log apply services
2。可以在任何系统管理这个配置中的整个dataguard配置(所有的主库和备库)
3。管理和监视包含RAC primary或standby数据库的dataguard配置
4。简化角色切换操作,只要DGMGRL的一条命令或者OEM的一个按钮就可以进行switchover或failover
5。可以激活fast-start failover以自动进行fail over当主库不可用时。当此功能被激活,Data Guard broker决定failover是否必需,并开始自动failover到指定的目标standby数据库,不需要DBA干涉,也不会丢失数据。
下面我们演示一下,Broker如何创建和启用Broker配置。
一、 启用DataGuard Broker
在主从数据库上都需执行如下两步。
1.1 启用dg_broker
SQL> ALTER SYSTEM SET dg_broker_start=TRUE SCOPE=BOTH; System altered.
检查后台进程,你会发现Oracle多启动了一个进程
11gdg1-> ps -ef | grep ora_dmon oracle 19675 1 0 03:43 ? 00:00:00 ora_dmon_dgtst
1.2 配置静态监听器。
注:数据库上一定要配置listener的静态监听,并且GLOBAL_NAME要指定为db_unique_name_DGMGRL.domain
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = 11gdg1_DGMGRL) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1) (SID_NAME = dgtst) ) )
二、使用dgmgrl
2.1 查看dgmgrl帮助
11gdg1-> dgmgrl DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production Copyright (c) 2000, 2009, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> help The following commands are available: add Adds a standby database to the broker configuration connect Connects to an Oracle database instance convert Converts a database from one type to another create Creates a broker configuration disable Disables a configuration, a database, or fast-start failover edit Edits a configuration, database, or instance enable Enables a configuration, a database, or fast-start failover exit Exits the program failover Changes a standby database to be the primary database help Displays description and syntax for a command quit Exits the program reinstate Changes a database marked for reinstatement into a viable standby rem Comment to be ignored by DGMGRL remove Removes a configuration, database, or instance show Displays information about a configuration, database, or instance shutdown Shuts down a currently running Oracle database instance sql Executes a SQL statement start Starts the fast-start failover observer startup Starts an Oracle database instance stop Stops the fast-start failover observer switchover Switches roles between a primary and standby database Use "help <command>" to see syntax for individual commands
2.2 连接到数据库
使用dgmgrl进行任何数据库操作时,必须先连接到数据库。
DGMGRL> help connect Connects to an Oracle database instance Syntax: CONNECT <username>/<password>[@<connect identifier>]
连接到主库
DGMGRL> connect sys/oracle@11gdg1 Connected.
2.3 创建一个broker的配置文件
DGMGRL> help create Creates a broker configuration Syntax: CREATE CONFIGURATION <configuration name> AS PRIMARY DATABASE IS <database name> CONNECT IDENTIFIER IS <connect identifier>;
此步骤一定要在主库上执行,<database name>指定的是DB_UNIQUE_NAME,而不是DB_NAME
DGMGRL> CREATE CONFIGURATION DR1 AS PRIMARY DATABASE IS 11gdg1 CONNECT IDENTIFIER IS 11GDG1; Configuration "dr1" created with primary database "11gdg1"
此时,我们只是创建了一个配置,该配置存储在主数据库的配置文件中,但是我们既没有加入standby数据,也没有使配置生效。我们可以使用SHOW CONFIGURATION 查看配置。
DGMGRL> show configuration; Configuration - dr1 Protection Mode: MaxPerformance Databases: 11gdg1 - Primary database Fast-Start Failover: DISABLED Configuration Status: DISABLED
2.4 将从库添加到配置中
DGMGRL> ADD DATABASE 11GDG2; Database "11gdg2" added
因为在主库上已经配置了LOG_ARCHIVE_DEST_2,如下。
SQL> show parameter log_archive_dest_2 NAME TYPE VALUE ------------------ --------- ------------------------------ log_archive_dest_2 string service=11gdg2 ASYNC DB_UNIQUE_NAME=11gdg2 VALID_FOR=(primary_role,online_logfile)
所以添加从库执行执行
ADD DATABASE 11GDG2;
即可,如果没有配置的话,需要指定完整的信息。
ADD DATABASE 11gdg2 AS CONNECT IDENTIFIER IS 11gdg2 MAINTAINED AS PHYSICAL;
查看配置信息
DGMGRL> show configuration Configuration - dr1 Protection Mode: MaxPerformance Databases: 11gdg1 - Primary database 11gdg2 - Physical standby database Fast-Start Failover: DISABLED Configuration Status: DISABLED
standby已经被添加到配置中。
2.4 查看数据库DG配置的详细信息
DGMGRL> show database verbose 11gdg1; Database - 11gdg1 Role: PRIMARY Intended State: OFFLINE Instance(s): dgtst Properties: DGConnectIdentifier = ‘11gdg1‘ ObserverConnectIdentifier = ‘‘ LogXptMode = ‘ASYNC‘ DelayMins = ‘0‘ Binding = ‘optional‘ MaxFailure = ‘0‘ MaxConnections = ‘1‘ ReopenSecs = ‘300‘ NetTimeout = ‘30‘ RedoCompression = ‘DISABLE‘ LogShipping = ‘ON‘ PreferredApplyInstance = ‘‘ ApplyInstanceTimeout = ‘0‘ ApplyParallel = ‘AUTO‘ StandbyFileManagement = ‘AUTO‘ ArchiveLagTarget = ‘0‘ LogArchiveMaxProcesses = ‘4‘ LogArchiveMinSucceedDest = ‘1‘ DbFileNameConvert = ‘‘ LogFileNameConvert = ‘‘ FastStartFailoverTarget = ‘‘ InconsistentProperties = ‘(monitor)‘ InconsistentLogXptProps = ‘(monitor)‘ SendQEntries = ‘(monitor)‘ LogXptStatus = ‘(monitor)‘ RecvQEntries = ‘(monitor)‘ SidName = ‘dgtst‘ StaticConnectIdentifier = ‘(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11gdg1.localdomain.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=11gdg1_DGMGRL)(INSTANCE_NAME=dgtst)(SERVER=DEDICATED)))‘ StandbyArchiveLocation = ‘USE_DB_RECOVERY_FILE_DEST‘ AlternateLocation = ‘‘ LogArchiveTrace = ‘0‘ LogArchiveFormat = ‘%t_%s_%r.dbf‘ TopWaitEvents = ‘(monitor)‘ Database Status: DISABLED
2.5 使CONFIGURATION生效
DGMGRL> ENABLE CONFIGURATION; Enabled. DGMGRL> SHOW CONFIGURATION; Configuration - dr1 Protection Mode: MaxPerformance Databases: 11gdg1 - Primary database 11gdg2 - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS
本文出自 “叮咚” 博客,请务必保留此出处http://lqding.blog.51cto.com/9123978/1681701
Oracle学习之DATAGUARD(六) 创建和启用Broker配置
标签:dataguard broker 创建和启用
本文系统来源:http://lqding.blog.51cto.com/9123978/1681701
内容总结
以上是互联网集市为您收集整理的Oracle学习之DATAGUARD(六) 创建和启用Broker配置全部内容,希望文章能够帮你解决Oracle学习之DATAGUARD(六) 创建和启用Broker配置所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。