In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
It is believed that many inexperienced people do not know what to do about the building record of DG. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Single instance DG Building Manual
Planning
Ip
Db_name
Db_unique_name
Sid
Tns
192.168.10.103
Test
Test
Test
Test
192.168.10.104
Test
Dgdb
Dgdb
Dgdb
Configure snooping
Main library listener.ora
# listener.ora Network Configuration File: / u01/app/oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_DG =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = / u01/app/oracle/product/11.2)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = lzl) (PORT = 1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
Reserve library listener.ora
# listener.ora Network Configuration File: / u01/app/oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_DG =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dgdb)
(ORACLE_HOME = / u01/app/oracle/product/11.2)
(SID_NAME = dgdb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = L21) (PORT = 1521))
)
)
ADR_BASE_LISTENER = / u01/app/oracle
Tnsnames.ora of the master / slave library
Test =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = lzl) (PORT = 1521))
)
(CONNECT_DATA =
(SID = test)
(SERVER = DEDICATED)
)
)
Dgdb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = L21) (PORT = 1521))
)
(CONNECT_DATA =
(SID = dgdb)
(SERVER = DEDICATED)
)
)
Main library preparation
Change log mode
Prevent data inconsistencies between primary and standby libraries caused by the use of no logging clauses
SQL > alter database force logging
2 /
Database altered.
SQL > select force_logging from v$database
FOR
-
YES
Whether to file or not
SQL > select log_mode from v$database
LOG_MODE
-
ARCHIVELOG
Change log_archive_config
SQL > alter system set log_archive_config='DG_CONFIG= (test,dgdb) 'scope=both
System altered.
SQL > show parameter archive_config
NAME TYPE VALUE
-
Log_archive_config string DG_CONFIG= (test,dgdb)
SQL >
Configure DG parameters
Alter system set log_archive_dest_1='location=/home/oracle/ VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test' scope=both
Alter system set log_archive_dest_2 = 'SERVICE=dgdb LGWR SYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgdb' scope=both
Alter system set log_archive_dest_state_1 = ENABLE
Alter system set log_archive_dest_state_2 = ENABLE
Data files are automatically added
Alter system set standby_file_management=auto scope=both
Alter system set fal_server=dgdb scope=both
Alter system set fal_client=test scope=both
1800s automatic switching redo log
Alter system set archive_lag_target=1800
File relocation
Alter system set db_file_name_convert='/u01/app/oracle/oradata/test/','/u01/app/oracle/oradata/dgdb/' scope=spfile
Alter system set log_file_name_convert='/u01/app/oracle/oradata/logfile/','/u01/app/oracle/oradata/logfile/' scope=spfile
two。 Password file
Use the previous password file or create a password file directly
[oracle@lzl ~] $orapwd password=oracle file='/home/oracle/orapwd.ora' force=y ignorecase=y
[oracle@lzl ~] $ls
Orapwd.ora
3. Backup database
Backup database
4. Generate pfile
Create pfile='/home/oracle/initdgdb.ora' from spfile
Modify parameters
* .db_unique_name='dgdb'
* .fal_client='dgdb'
* .fal_server='test'
* .service_names='dgdb'
* .log_archive_dest_1='location=/home/oracle VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dgdb'
* .log_archive_dest_2='SERVICE=dgdb LGWR SYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=test'
Db_name should be consistent with the main database
6. Generate stanby controlfile
SQL > alter database create standby controlfile as'/ home/oracle/control01.ctl'
Database altered.
Prepare for the library
Database preparation is an environment with only database software.
1. Copy the stanby controlfile,pfile,orapwd file to the standby library
Control files are copied to the directory specified by pfile
Password file change sid to / oracle/home/dbs
[oracle@l2l ~] $ls
Control01.ctl initdgdb.ora orapwd.ora
two。 Create a directory in pfile
Audit directory, control file directory, data file directory, etc.
3. Start the standby library to the mount phase
[oracle@l2l ~] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 27 17:04:07 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL > startup nomount pfile='/home/oracle/initdgdb.ora'
ORACLE instance started.
Total System Global Area 1048059904 bytes
Fixed Size 2235000 bytes
Variable Size 310379912 bytes
Database Buffers 729808896 bytes
Redo Buffers 5636096 bytes
SQL > alter database mount
Database altered.
SQL > select database_role from v$database
DATABASE_ROLE
-
PHYSICAL STANDBY
4.rman data recovery
Use rman to apply the backup of the primary library to the standby library
RMAN > catalog start with'/ home/oracle/liu/'
RMAN > restore database
5. Create standby redo log files at least twice as many as the main library
Standby redo log is very similar to redo log, but standby redo log is used to receive the redo data of the main library on the standby library.
Online redo log will not be used on the standby library
In order to facilitate arbitrary switching, it is best to create standby redo log files for both the master and backup libraries.
SQL > alter database add standby logfile group 11 ('/ u01ax size size 50m)
Database altered.
SQL > alter database add standby logfile group 12 ('/ u01ax size size 50m)
Database altered.
SQL > alter database add standby logfile group 13 ('/ u01ax size size 50m)
Database altered.
SQL > alter database add standby logfile group 14 ('/ u01ax size size 50m)
Database altered.
SQL > alter database add standby logfile group 15 ('/ u01ax size size 50m)
Database altered.
SQL > alter database add standby logfile group 16 ('/ u01ax size size 50m)
Database altered.
View v$standby_log
SQL > select group# from v$standby_log
GROUP#
-
ten
eleven
twelve
thirteen
fourteen
fifteen
6 rows selected.
SQL > select group# from v$log
GROUP#
-
one
three
two
V$logfile is still required to view files
SQL > select member from v$logfile
MEMBER
/ u01/app/oracle/oradata/test/redo03.log
/ u01/app/oracle/oradata/test/redo02.log
/ u01/app/oracle/oradata/test/redo01.log
/ u01/app/oracle/oradata/test/dg_redo11.log
/ u01/app/oracle/oradata/test/dg_redo12.log
/ u01/app/oracle/oradata/test/dg_redo13.log
/ u01/app/oracle/oradata/test/dg_redo14.log
/ u01/app/oracle/oradata/test/dg_redo15.log
/ u01/app/oracle/oradata/test/dg_redo16.log
9 rows selected.
Establish DG relationship between master and backup database
Prepare the library
SQL > alter database recover managed standby database using current logfile disconnect from session
Database altered.
Alarm log information:
Alter database recover managed standby database using current logfile disconnect from session
Attempt to start background Managed Standby Recovery process (dgdb)
Sat Jul 28 19:28:48 2017
MRP0 started with pid=25, OS id=3264
MRP0: Background Managed Standby Recovery process started (dgdb)
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 100
Completed: alter database recover managed standby database using current logfile disconnect from session
View standby roles
SQL > select PROTECTION_MODE, PROTECTION_LEVEL, GUARD_STATUS,DATABASE_ROLE,to_char (current_scn) from v$database
PROTECTION_MODE PROTECTION_LEVEL GUARD_S DATABASE_ROLE
--
TO_CHAR (CURRENT_SCN)
-
MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY NONE PHYSICAL STANDBY
2481074
Main library check
Prepare for database inspection
SQL > select PROTECTION_MODE, PROTECTION_LEVEL, GUARD_STATUS,DATABASE_ROLE,to_char (current_scn) from v$database
PROTECTION_MODE PROTECTION_LEVEL GUARD_S DATABASE_ROLE
--
TO_CHAR (CURRENT_SCN)
-
MAXIMUM AVAILABILITY RESYNCHRONIZATION NONE PRIMARY
2482972
After reading the above, have you mastered the method of building records of DG? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.