Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

DG implementation scheme (the main library is dual-node rac)-- rman duplicate mode

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Environmental Information:

Operating system version: AIX6.1

Database version: ORACLE 11.2.0.3 (psu5)

The main library is dual-node rac

1. Check whether the database supports Data Guard (DG is supported only in Enterprise Edition)

SQL > select * from v$option where parameter = 'Managed Standby'

two。 Modify the main library to archive mode and force logging status

1) SQL > archive log list

If archiving is not open, open archiving mode

Alter system set log_archive_dest_2='location=/archlog/egaa';alter system set log_archive_format='egaa_%t_%s_%r.arch' scope=spfile;-static parameter, which takes effect after restart shutdown immediate;startup mount;alter database archivelog;alter database open;archive log list

2) Open force logging

SQL > alter database force logging;Database altered.

3. Create a standby library pfile file

Create a pfile on the main library, modify, and add all the parameters of the DG slave library, and then pass it to the slave library

SQL > create pfile='/data01/pfileegaa' from spfile

1) parameters that must be added to the slave library

DB_UNIQUE_NAME;LOG_ARCHIVE_DEST_1;FAL_SERVER;FAL_CLIENT;STANDBY_FILE_MANAGEMENT=AUTO;DB_FILE_NAME_CONVERT;LOG_FILE_NAME_CONVERT

2) build it on the slave host in advance according to the path involved in pfile ()

For example, the main library * .audit _ file_dest='/apps/oracle/admin/egaadr/adump'

We need to build mkdir-p / apps/oracle/admin/egaadr/adump when preparing the library.

Cd / apps/oracle/admin

Chown-R oracle:oinstall egaadr

Chmod-R 775 egaadr

Parameter file before modification (not listed here)

Modified parameter file

* .audit_file_dest='/apps/oracle/admin/egaadr/adump'*.audit_trail='NONE'*.compatible='11.2.0.0.0'*.control_files='+DATA1/egaadr/controlfile/control01.ctl' '+ DATA1/egaadr/controlfile/control02.ctl'#Set by RMAN*.core_dump_dest='/apps/oracle/diag/rdbms/egaadr/egaadr/cdump'*.db_block_size=8192*.db_cache_size=17179869184*.db_create_file_dest='+DATA1'*.db_domain=''*.db_file_name_convert='+DATA2/EGAADB/DATAFILE','+DATA1/EGAADR/DATAFILE','+DATA2/EGAADB/TEMPFILE','+DATA1/EGAADR/TEMPFILE'*.log_file_name_convert='+DATA2/EGAADB/ONLINELOG' '+ DATA1/EGAADR/ONLINELOG','+RECODG/egAAdb/onlinelog','+DATA1/EGAADR/ONLINELOG1'*.db_name='EGAA'*.db_recovery_file_dest='+DATA1'*.db_recovery_file_dest_size=307000M*.db_unique_name='EGAADR'*.deferred_segment_creation=FALSE*.diagnostic_dest='/apps/oracle/'*.fal_client='EGAADR'*.fal_server='EGAADB1 EGAADB2'*.instance_name='egaadr'*.large_pool_size=536870912*.local_listener=' (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.48.81) (PORT=1521)'* .log _ archive_config='dg_config= (EGAADB,EGAADR)'* .log _ archive_dest_1='LOCATION=+DATA1/egaadr/archlog valid_for= (ALL_LOGFILES) ALL_ROLES) DB_UNIQUE_NAME=EGAADR'*.log_archive_dest_state_1='ENABLE'*.log_archive_dest_state_2='ENABLE'*.log_archive_format='egaadr_%t_%s_%r.arc'*.log_buffer=48857088# log buffer update*.open_cursors=1000*.optimizer_dynamic_sampling=2*.optimizer_mode='ALL_ROWS'*.parallel_max_servers=480*.pga_aggregate_target=12884901888*.plsql_warnings='DISABLE:ALL'# PL/SQL warnings at Init.ora*.processes=2000*.query_rewrite_enabled='TRUE'*.remote_listener='drdb-scan:1521'*.remote_login_passwordfile='EXCLUSIVE'*.result_cache_max_size=52448K*.sessions=3072*.sga_max_size=25769803776*.sga_target=25769803776*.shared_pool_size=4294967296*.skip_unusable_indexes=TRUE*.standby_file_management='AUTO'*.undo_management='AUTO'*.undo_retention=5400*.undo_tablespace='UNDOTBS1'## pay attention to the items specified in the parameter file Record in the slave database to exist, such as: the path specified by db_file_name_convert and log_file_name_convert parameters must exist # # remove the relevant parameters of rac database

4) create a slave library spfile based on the modified pfile

Export ORACLE_SID=egaadr

Sqlplus / as sysdba

Create spfile from pfile

-- use the newly generated spfile to see if the instance can be started successfully.

4. Generate the password file for the standby library

Scp master library password file to standby library, and rename

If the main library does not have a password file, you need to create a new

Orapwd file=/oracle/app/oracle/product/v11.2.0.3/db_1/dbs/orapwegaa password=oracle entries=5 ignorecase=y

-- if the password for connecting to the Times is wrong after being created, we can scp one of the node password files in the main library to another node and standby database and rename it to use.

5. Configure active and standby database snooping and net service

1) listener

Generally speaking, monitoring will be configured after the database is built, and we no longer need to configure it.

-- prepare the library (cluster listening is used because cluster is installed)

Lsnrctl status looks at the location of the listening file and adds the following class content to the listening file (note that both nodes are configured)

LISTENER_SCAN3= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=IPC) (KEY=LISTENER_SCAN3) # line added by AgentLISTENER_SCAN2= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=IPC) (KEY=LISTENER_SCAN2) # line added by Agent#LISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=IPC) (KEY=LISTENER) # line added by AgentLISTENER_SCAN1= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=IPC) (KEY=LISTENER_SCAN1) # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by Agent## Note: after the cluster is installed The above content already exists in the monitor SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = / apps/oracle/product/11.2.0.3/db_1) (PROGRAM = extproc)) (SID_DESC = (ORACLE_HOME = / apps/oracle/product/11.2.0.3/db_1) (SID_NAME = egaa1)) LISTENER = (DESCRIPTION_LIST = (ADDRESS = (PROTOCOL)) = TCP) (HOST = 192.168.96.1) (PORT = 1521) (IP = FIRST)

2) tns

Add the following parts to the tnsnames.ora file of the main and standby libraries

EGAA1 = (DESCRIPTION = (ADDRESS_LIST = (PROTOCOL = TCP) (HOST = 192.168.48.230) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = egaa) (UR = A)) EGAA2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.48.231) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = egaa) (UR = A) ) EGAADR = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.48.81) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = egaa) (UR = A))-- you can also have only one connection string on two nodes of the main library. As follows: EGAA = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.48.230) (PORT = 1521)) (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.48.231) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = egaa) (UR = A)

6. Test the network connection

1) check whether the monitoring status is normal

Lsnrctl status

2) Test whether the connection string can connect to the specified database properly.

Tnsping EGaaDR

Tnsping EGaa1

Tnsping EGaa2

Sqlplus sys/AE8pfChcG0BBGlL73DW0@egaa1 as sysdba

Sqlplus sys/AE8pfChcG0BBGlL73DW0@egaa2 as sysdba

Sqlplus sys/AE8pfChcG0BBGlL73DW0@egaadr as sysdba

7. Copy standby library

There are two types of 1:rman online replication 2:rman backup off-machine recovery

Here because the library is relatively small, our first method, this method is relatively simple.

Method 1:rman online replication (no need to back up the main library)

This method is only suitable for ORACLE 11G, and can automatically back up files such as datafile,control to the standby database, and the main library can still run normally during the replication process, but the replication process takes a long time and will take up some network resources.

1) start the slave library to nomount state

Export ORACLE_SID=egaadr

Sqlplus / as sysdba

Startup nomount

2) execute the following command on the repository

Rman target sys/FWNgTA4XlcUuDXDiQAdT@egaa1 auxiliary sys/FWNgTA4XlcUuDXDiQAdT@EGAADR nocatalogduplicate target database for standby from active database nofilenamecheck

-- if the path of the master / slave library file remains the same, add nofilenamecheck (otherwise an error will be reported)

-- We can write a script to run in the background, and check whether the relevant log replication is successful after the estimated time. The script is as follows:

# / bin/shexport ORACLE_SID=EGMMDRrman target sys/AE8pfChcG0BBGlL73DW0@EGAA1 auxiliary sys/AE8pfChcG0BBGlL73DW0@EGAADR nocatalog log' / home/oracle/rman.log'

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report