In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the method of configuring Data Guard physical standby library with Data Guard Broker". In the daily operation, it is believed that many people have doubts about the method of configuring Data Guard physical standby library using Data Guard Broker. The editor consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the question of "what is the method of using Data Guard Broker to configure Data Guard physical standby library"! Next, please follow the editor to study!
1. The master server configures 1.1 archiving mode
Check that the primary database is in archive log mode.
SELECT log_mode FROM vault database; LOG_MODE-NOARCHIVELOG SQL >
If it is NOARCHIVELOG mode, switch to ARCHIVELOG mode.
SHUTDOWN IMMEDIATE;STARTUP MOUNT;ALTER DATABASE ARCHIVELOG;ALTER DATABASE OPEN
Enable forced logging by issuing the following command.
ALTER DATABASE FORCE LOGGING;-- ensures that at least one log file exists. ALTER SYSTEM SWITCH LOGFILE
Create a standby redo log on the primary database (in the case of a switch). The alternate redo log should be at least as large as the largest online redo log, and each thread should have an additional group compared to the online redo log. In my example, the following alternate redo logs must be created on both servers.
If you use Oracle Managed Files (OMF). ALTER DATABASE ADD STANDBY LOGFILE SIZE 50Minto alter DATABASE ADD STANDBY LOGFILE SIZE 50m * alter DATABASE ADD STANDBY LOGFILE SIZE 50M * * alter DATABASE ADD STANDBY LOGFILE SIZE 50M * * if Oracle Managed Files (OMF) is not used. ALTER DATABASE ADD STANDBY LOGFILE ('/ u01aporadataUniverse redo01.log') SIZE 50MmitAlter DATABASE ADD STANDBY LOGFILE ('/ u01aporadataUniverse redo02.log') SIZE 50MmitAlter DATABASE ADD STANDBY LOGFILE ('/ u01aporadataUniverse cdb1Universe standbyhorse redo03.log') SIZE 50Mmitter DATABASE ADD STANDBY LOGFILE ('/ u01oradataUniverse cdb1andstandbycircle redo04.log') SIZE 50m
If you want to use a flashback database, enable it immediately on the primary database, so it will also be enabled on the standby database. It is very useful and you can enable flashback using the following command:
ALTER DATABASE FLASHBACK ON;1.2 initialization parameters
Check the settings of the DB_NAME and DB_UNIQUE_NAME parameters. In this case, it is set to "cdb1" on the primary database.
SQL > show parameter db_nameNAME TYPE VALUE---db_name string cdb1SQL > show parameter db_unique_nameNAME TYPE VALUE-- db_unique_name string cdb1SQL >
The DB_NAME of the standby database is the same as the DB_NAME of the primary database, but it must have a different DB_UNIQUE_NAME value. For this example, the value of the standby database is "cdb1_stby".
Ensure that the STANDBY_FILE_MANAGEMENT parameter is set. You can set it using the following command:
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;1.3 service configuration
Entries for the primary and standby databases are required in the "$ORACLE_HOME/network/admin/tnsnames.ora" file on both servers. You can use the Network configuration Utility (netca) or create these manually. The following entries are used in this example. Note that you use SID instead of SERVICE_NAME in the entry. This is important because the agent needs to connect to the database when it shuts down, so the service will not exist.
Cdb1 = (DESCRIPTION = (ADDRESS_LIST = (PROTOCOL = TCP) (HOST = ol7-19-dg1) (PORT = 1521)) (CONNECT_DATA = (SID = cdb1) cdb1_stby = (DESCRIPTION = (ADDRESS_LIST = (PROTOCOL = TCP) (HOST = ol7-19-dg2) (PORT = 1521)) (CONNECT_DATA = (SID = cdb1))
The "$ORACLE_HOME/network/admin/listener.ora" file on the primary server contains the following configuration.
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ol7-19-dg1) (PORT = 1521)) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = cdb1_DGMGRL) (ORACLE_HOME = / u01/app/oracle/product/19.0.0/db_1)) (SID_NAME = cdb1) ADR_BASE_LISTENER = / u01/app/oracle
The "$ORACLE_HOME/network/admin/listener.ora" file on the standby server contains the following configuration. Because the agent needs to connect to the database when it is shut down, we cannot rely on the automatic registration of the listener, so the explicit entry of the database.
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = ol7-19-dg2) (PORT = 1521) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = cdb1_stby_DGMGRL) (ORACLE_HOME = / u01/app/oracle/product/19.0.0/db_1) ) (SID_NAME = cdb1) ADR_BASE_LISTENER = / u01/app/oracle
After completing the listener.ora modification, restart the listener on both servers using the following command.
Lsnrctl stoplsnrctl start2, standby server configuration 2.1 prepare DUPLICATE
Create a parameter file named "/ tmp/initcdb1" for the standby database as follows:
* .db_name='cdb1'
Create the necessary directories on the standby server.
Mkdir-p / u01/app/oracle/oradata/cdb1/pdbseedmkdir-p / u01/app/oracle/oradata/cdb1/pdb1mkdir-p / u01/app/oracle/fast_recovery_area/cdb1mkdir-p / u01/app/oracle/admin/cdb1/adump
Create a password file with the SYS password matching the password of the primary database.
$orapwd file=/u01/app/oracle/product/19.0.0/db_1/dbs/orapwcdb1 password=Password1 entries=102.2 uses DUPLICATE to create a backup
Use the temporary "init.ora" file to start the secondary instance on the standby server.
$export ORACLE_SID=cdb1 $sqlplus / as sysdba SQL > STARTUP NOMOUNT PFILE='/tmp/initcdb1_stby.ora'
Connect to RMAN and specify the full connection string for the TARGET and AUXILIARY instances. Do not attempt to use OS authentication.
$rman TARGET sys/Password1@cdb1 AUXILIARY sys/Password1@cdb1_stby
Now issue the following DUPLICATE command:
DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE DORECOVER SPFILESET db_unique_name='cdb1_stby' COMMENT'Is standby' NOFILENAMECHECK
If you need to convert the file location or change any initialization parameters, you can do so using the SET command during DUPLICATE. As follows:
DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE DORECOVER SPFILESET db_unique_name='cdb1_stby' COMMENT'Is standby'SET db_file_name_convert='/original/directory/path2/','/new/directory/path2/','/original/directory/path3/','/new/directory/path3/'SET log_file_name_convert='/original/directory/path2/','/new/directory/path2/','/original/directory/path3/','/new/directory/path3/'SET job_queue_processes='0' NOFILENAMECHECK
A brief description of each item in the command is as follows:
FOR STANDBY: this tells DUPLICATE that the command will be used for the standby database, so it does not force changes to the DBID.
The FROM ACTIVE DATABASE:DUPLICATE will be created directly from the source data file without additional backup steps.
The DORECOVER:DUPLICATE will include recovery steps to bring the standby state to the current point in time.
SPFILE: allows us to reset the spfile when we copy it from the source server.
NOFILENAMECHECK: does not check the target file location.
After the above command is complete, we can start using Broker.
3. Enable Broker
At this point we have a primary database and a standby database, so now we need to start using Data Guard Broker to manage them. Connect to two databases (primary and standby) and issue the following command:
ALTER SYSTEM SET dg_broker_start=true
On the primary server, issue the following command to register the primary server with the agent:
Dgmgrl sys/Password1@cdb1DGMGRL for Linux: Release 19.0.0.0.0-Production on Tue Feb 26 22:39:33 2018Version 19.2.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information.Connected as SYSDBA.DGMGRL > CREATE CONFIGURATION my_dg_config AS PRIMARY DATABASE IS cdb1 CONNECT IDENTIFIER IS cdb1;Configuration "my_dg_config" created with primary database "cdb1" DGMGRL >
Now add the standby database.
DGMGRL > ADD DATABASE cdb1_stby AS CONNECT IDENTIFIER IS cdb1_stby MAINTAINED AS PHYSICAL;Database "cdb1_stby" addedDGMGRL >
Now let's enable the new configuration.
DGMGRL > ENABLE CONFIGURATION;Enabled.DGMGRL >
The following command shows how to check the configuration and status of the database from broker:
DGMGRL > SHOW CONFIGURATION; Configuration-my_dg_config Protection Mode: MaxPerformanceMembers:cdb1-Primary databasecdb1_stby-Physical standby database Fast-Start Failover: DISABLED Configuration Status:SUCCESS (status updated 26 seconds ago) DGMGRL > SHOW DATABASE cdb1; Database-cdb1 Role: PRIMARYIntended State: TRANSPORT-ONInstance (s): cdb1 Database Status:SUCCESS DGMGRL > SHOW DATABASE cdb1_stby Database-cdb1_stby Role: PHYSICAL STANDBYIntended State: APPLY-ONTransport Lag: 0 seconds (computed 1 second ago) Apply Lag: 0 seconds (computed 1 second ago) Average Apply Rate: 5.00 KByte/sReal Time Query: OFFInstance (s): cdb1 Database Status:SUCCESS DGMGRL > 4, database switching
The database can be one of two mutually exclusive modes (active or standby). These roles can be changed at run time without losing data or resetting the log. This process is called "switching" and can be performed using the following command. Connect to the primary database (cdb1) and switch to the standby database (cdb1_stby).
Dgmgrl sys/Password1@cdb1DGMGRL for Linux: Release 19.0.0.0.0-Production on Tue Feb 26 22:39:33 2018Version 19.2.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information.Connected as SYSDBA.DGMGRL > SWITCHOVER TO cdb1_stby;Performing switchover NOW, please wait...Operation requires a connection to instance "cdb1" on database "cdb1_stby" Connecting to instance "cdb1"... Connected as SYSDBA.New primary database "cdb1_stby" is opening...Operation requires start up of instance "cdb1" on database "cdb1" Starting instance "cdb1"... ORACLE instance started.Database mounted.Switchover succeeded, new primary is "cdb1_stby" DGMGRL >
Let's switch back to the original master database. Connect to the new primary server (cdb1_stby) and switch to the new standby database (cdb1).
Dgmgrl sys/Password1@cdb1_stbyDGMGRL for Linux: Release 19.0.0.0.0-Production on Tue Feb 26 22:53:36 2018Version 19.2.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information.Connected as SYSDBA.DGMGRL > SWITCHOVER TO cdb1;Performing switchover NOW, please wait...Operation requires a connection to instance "cdb1" on database "cdb1" Connecting to instance "cdb1"... Connected as SYSDBA.New primary database "cdb1" is opening...Operation requires start up of instance "cdb1" on database "cdb1_stby" Starting instance "cdb1"... ORACLE instance started.Database mounted.Switchover succeeded, new primary is "cdb1" DGMGRL > 5, database failover
If the primary database is not available, you can activate the standby database as the primary database using the following statement. Connect to the standby database (cdb1_stby) and fail over.
Dgmgrl sys/Password1@cdb1_stbyDGMGRL for Linux: Release 19.0.0.0.0-Production on Tue Feb 26 22:53:36 2018Version 19.2.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Welcome to DGMGRL, type "help" for information.Connected as SYSDBA.DGMGRL > FAILOVER TO cdb1_stby;Performing failover NOW, please wait...Failover succeeded, new primary is "cdb1_stby" DGMGRL >
Since the standby database is now the primary database, a database backup should be performed immediately.
The original primary database can now be configured as a standby database. If the flashback database is enabled on the primary database, you can do this relatively easily using the following command.
DGMGRL > REINSTATE DATABASE cdb1;Reinstating database "cdb1", please wait...Operation requires shut down of instance "cdb1" on database "cdb1" Shutting down instance "cdb1"... ORACLE instance shut down.Operation requires start up of instance "cdb1" on database "cdb1" Starting instance "cdb1"... ORACLE instance started.Database mounted.Continuing to reinstate database "cdb1"... Reinstatement of database "cdb1" succeededDGMGRL >
If the flashback database is not enabled, you must manually recreate the cdb1 as a standby database. The basic process is the opposite of what you did before. The following command:
# 1) Clean up old instances. Sqlplus / as sysdba CONVERT DATABASE cdb1_stby TO PHYSICAL STANDBY;Converting database "cdb1_stby" to a Physical Standby database, please wait...Operation requires shut down of instance "cdb1" on database "cdb1_stby" Shutting down instance "cdb1"... Database closed.Database dismounted.ORACLE instance shut down.Operation requires start up of instance "cdb1" on database "cdb1_stby" Starting instance "cdb1"... ORACLE instance started.Database mounted.Continuing to convert database "cdb1_stby"... Database "cdb1_stby" converted successfullyDGMGRL >
The standby database is once again in a managed recovery state and resumes archive log delivery. Note that the flashback database is still not enabled.
DGMGRL > SHOW CONFIGURATION; Configuration-my_dg_config Protection Mode: MaxPerformanceMembers:cdb1-Primary databasecdb1_stby-Physical standby database Fast-Start Failover: DISABLED Configuration Status:SUCCESS (status updated 38 seconds ago) DGMGRL > this is the end of the study on "what is the method of using Data Guard Broker for Data Guard physical standby library configuration". I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.