In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. preliminary preparation
When preparing to build DATAGARD, I read many tutorials, followed the tutorials, had problems, and then didn't know how to take the next step.
Later, I went to see the official documents and sorted out my train of thought. Things were much easier.
Taking a master database and a standby database as an example, the idea of building a DG is as follows:
Turn off the firewall.
Configure ssh mutual trust (optional, reduce the number of passwords entered during SCP)
Operations on the main library:
1) enable archiving mode and forced logging
2) add one more standby logfile,standby logfile group than logfile group
3) modify the parameter file
4) configure listener.ora and tnsnames.ora
5) backup database and control files
Prepare the library and prepare:
1) copy the parameter file and password file on the main library to the standby library, and modify the parameter file
2) copy the listener.ora and tnsnames.ora on the main library to the standby library, and modify the listener.ora file
3) copy the backup to the standby database
4) create a corresponding folder on the repository
5) start the standby library to nomount mode
6) restore the database using RMAN on the standby database
7) add standby logfile to the standby library
8) Application archiving
9) View status
II. Basic configuration preparation
2.1 primary server installs database software and installs ORCL database, installs on standby server
2.2 turn off the firewall
The primary server turns off the firewall:
The standby server turns off the firewall
2.3 configure ssh mutual trust
Baidu under the "linux scp password-free", casually find an article to read.
[oracle@primary dbs] $ssh-keygen-t rsa
[oracle@primary dbs] $scp ~ / .ssh/id_rsa.pub oracle@192.168.62.202:/home/oracle/.ssh/authorized_keys
III. Configuration of the main library
1) enable forced logging:
SQL > ALTER DATABASE FORCE LOGGING
Check to see if it is already in archive mode, and if it is unarchived, modify it to archive mode.
SQL > SHUTDOWN IMMEDIATE
SQL > STARTUP MOUNT
SQL > ALTER DATABASE ARCHIVELOG
SQL > ALTER DATABASE OPEN
3) configure the standby logfile file to receive logs from the slave database when the master database becomes a slave database.
Alter database add standby logfile group 4 ('/ u01ax size size 50m)
Alter database add standby logfile group 5 ('/ u01ax size size 50m)
Alter database add standby logfile group 6 ('/ u01ax size size 50m)
Alter database add standby logfile group 7 ('/ u01ax size size 50m)
3) configure the parameters of the main library: there are two ways, one is to use alter system to modify the parameters, the other is to modify the parameters after generating the static parameter file; I use the latter configuration method.
For the configuration of parameters, refer to pages 3-3 and 3-4 of Oracle Data Guard Concepts and Administration 11g Release 2 (11.2) E41134-03.
Initorcl.ora already has parameters that do not need to be configured.
SQL > create pfile from spfile
[oracle@primary ~] $cd $ORACLE_HOME/dbs
[oracle@primary dbs] $vim initorcl.ora
# primary
# * .db _ name='orcl'
* .db_unique_name=pri
* .LOG_ARCHIVE_CONFIG='DG_CONFIG= (pri,sty)'
# * .control _ files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
* .LOG_ARCHIVE_DEST_1= 'LOCATION=/u01/app/oracle/arch VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=pri'
* .LOG_ARCHIVE_DEST_2= 'SERVICE=sty ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty'
* .LOG_ARCHIVE_DEST_STATE_1=ENABLE
* .LOG_ARCHIVE_DEST_STATE_2=ENABLE
* .remote_login_passwordfile='EXCLUSIVE'
* .LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
# standby role
* .FAL_SERVER=sty
* .DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl'
* .App'/ u01qr LOG_FILE_NAME_CONVERT='/ u01According to oracleplicas oradatas, orclases, magnolias, magnolias, marbles, orclas, etc.
* .STANDBY_FILE_MANAGEMENT=AUTO
SQL > shutdown immediate
SQL > create spfile from pfile
4) configure listener.ora and tnsnames.ora on the main library
Listener.ora on the main library:
[oracle@primary admin] $cat listener.ora
# listener.ora Network Configuration File: / u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = / u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.201) (PORT = 1521))
)
ADR_BASE_LISTENER = / u01/app/oracle
Tnsnames.ora on the main library:
[oracle@primary admin] $cat tnsnames.ora
# tnsnames.ora Network Configuration File: / u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
PRI =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.201) (PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
)
)
STY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.62.202) (PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
)
)
Restart monitoring after the modification is completed.
5) backup database and control files
[oracle@primary admin] $rman target sys/asd@pri
RMAN > backup database format'/ u01ActionAccording to oracleUniplex backuppluctionfullAccordDB% U'
SQL > ALTER DATABASE CREATE STANDBY CONTROLFILE AS'/ u01max appplet oracle.ctl'
Fourth, the operation on the preparation database
1) copy the parameter file and password file on the main library to the standby library, and modify the parameter file
[oracle@primary admin] $cd $ORACLE_HOME/dbs
[oracle@primary dbs] $scp initorcl.ora orapworcl oracle@192.168.62.202:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/
Modify the parameter file:
Vim / u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora
* .db_name='orcl'
* .DB_UNIQUE_NAME=sty
* .control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
* .DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl'
* .App'/ u01qr LOG_FILE_NAME_CONVERT='/ u01According to oracleplicas oradatas, orclases, magnolias, magnolias, marbles, orclas, etc.
* .LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
* .LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/arch VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sty'
* .LOG_ARCHIVE_DEST_2='SERVICE=pri ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pri'
* .LOG_ARCHIVE_DEST_STATE_1=ENABLE
* .LOG_ARCHIVE_DEST_STATE_2=ENABLE
* .REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
* .STANDBY_FILE_MANAGEMENT=AUTO
* .FAL_SERVER=pri
The red mark is the modified part.
Password file description: when the sysdba is authorized or withdrawn on the main library, the password file on the standby library should be updated.
2) copy the listener.ora and tnsnames.ora on the main library to the standby library, and modify the listener.ora file
Execute on the main library:
[oracle@primary admin] $scp listener.ora tnsnames.ora oracle@192.168.62.202:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
Execute on the repository:
[oracle@standby ~] $cd / u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@standby admin] $vim listener.ora
Change the 201 in host to 202, that is, change the host to the IP,tnsnames.ora on the repository machine without modification.
Restart the monitoring after the modification is completed
3) copy the backup to the standby database
[oracle@primary backup] $scp / u01ActionPlacleBackup * oracle@192.168.62.202:/u01/app/oracle/backup
4) create a corresponding folder on the repository
[oracle@standby oracle] $cd $ORACLE_BASE
[oracle@standby oracle] $ls
Arch backup checkpoints database product
[oracle@standby oracle] $mkdir-p oradata/orcl
[oracle@standby oracle] $mkdir-p admin/orcl/adump
[oracle@standby oracle] $mkdir-p admin/orcl/dpdump
[oracle@standby oracle] $mkdir-p admin/orcl/pfile
5) start the standby library to nomount mode
SQL > create spfile from pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora'
SQL > startup nomount
6) restore the database using RMAN on the standby database
[oracle@standby ~] $rman target sys/asd@pri
RMAN > connect auxiliary /
Run {
Allocate auxiliary channel c1 device type disk
Allocate auxiliary channel c2 device type disk
Duplicate target database for standby nofilenamecheck dorecover
Release channel c1
Release channel c2
}
Although this problem occurred in the end, the repository can still be opened.
RMAN-00571: =
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =
RMAN-00571: =
RMAN-03002: failure of Duplicate Db command at 06/08/2016 17:38:36
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 1 with sequence 16 and starting SCN of 1010403 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 15 and starting SCN of 1009794 found to restore
7) add standby logfile to the standby library
Add standby logfile to the repository. When I do the test, there are standby logfile group4 to group 7 in the v$logfile view, but these files are not available in / u01/app/oracle/oradata/orcl, so delete these groups of logs before rebuilding:
SQL > alter database open;# has not attempted to create standby logs in mount state
SQL > alter database drop logfile group 4
SQL > alter database drop logfile group 5
SQL > alter database drop logfile group 6
SQL > alter database drop logfile group 7
SQL > alter database add standby logfile group 4 ('/ u01ax size size 50m)
SQL > alter database add standby logfile group 5 ('/ u01ax size size 50m)
SQL > alter database add standby logfile group 6 ('/ u01ax size size 50m)
SQL > alter database add standby logfile group 7 ('/ u01ax size size 50m)
8) Application archiving
-- Application archiving
SQL > shutdown immediate
SQL > startup mount
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION
-- exit the archive
Alter database recover managed standby database cancel
9) View status
SQL > SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#
SEQUENCE# FIRST_TIME NEXT_TIME APPLIED
--
15 08-JUN-16 08-JUN-16 YES
16 08-JUN-16 08-JUN-16 YES
17 08-JUN-16 08-JUN-16 YES
18 08-JUN-16 08-JUN-16 YES
19 08-JUN-16 08-JUN-16 YES
20 08-JUN-16 08-JUN-16 YES
21 08-JUN-16 08-JUN-16 IN-MEMORY
It shows that DG has been built successfully.
Note: if the slave database is in open status, the alarm log will appear: ORA-16058: alarm information of the standby database instance is not loaded.
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.