In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Hardware and system software description:
Operating system: Oracle Linux 5.864 bit
Oracle software: oracle 11.2.0.1
Role hostname IP address database service name
Primary dg1 192.168.3.70 orcl tong
Standby dg2 192.168.3.80 orcl cheng
I. primary main library operation
1. Install the oracle software on the primary server and create the database. Install only oracle software on the standby server and do not create a database.
two。 Configure snooping
[oracle@dg1 dbs] $cd / u01/product/11.2.0.1/db_1/network/admin/
[oracle@dg1 admin] $vim listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)-- name of the primary library
(ORACLE_HOME = / u01/product/11.2.0.1/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.70) (PORT = 1521))-- IP address of the prmary library
)
ADR_BASE_LISTENER = / U01
[oracle@dg1 admin] $vim tnsnames.ora
Tong =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.70) (PORT = 1521))-- IP address of the primary library
)
(CONNECT_DATA =
(SERVICE_NAME = tong)-- the service name must be the same as the service name above
)
)
Cheng =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.80) (PORT = 1521)-- IP address of the standby library
)
(CONNECT_DATA =
(SERVICE_NAME = cheng)
)
)
[oracle@dg1 admin] $lsnrctl stop
[oracle@dg1 admin] $lsnrctl start
3. Enable archiving and logging in the primary library to force writing to redo files
[oracle@dg1 ~] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 16 14:38:46 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL > shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL > startup mount
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 528484424 bytes
Database Buffers 297795584 bytes
Redo Buffers 2433024 bytes
Database mounted.
SQL > alter database archivelog;-enable archiving
Database altered.
SQL > alter database flashback on;-enable flashback
Database altered.
SQL > alter database open
Database altered.
SQL > alter database force logging;-- forced archiving of logs
Database altered.
SQL > select force_logging from v$database
FOR
-
YES
SQL >
4. Add standbt log files to the primary library (standby files and redo files up to size, one more files than redo)
SQL > select group#,type,member,IS_RECOVERY_DEST_FILE from v$logfile
GROUP# TYPE MEMBER IS_
3 ONLINE / u01/oradata/orcl/redo03.log NO
2 ONLINE / u01/oradata/orcl/redo02.log NO
1 ONLINE / u01/oradata/orcl/redo01.log NO
SQL > alter database add standby logfile group 4 ('/ u01max oradata size size 50m)
Database altered.
SQL > alter database add standby logfile group 5 ('/ u01max oradata size size 50m)
Database altered.
SQL > alter database add standby logfile group 6 ('/ u01max oradata size size 50m)
Database altered.
SQL > alter database add standby logfile group 7 ('/ u01max oradata size size 50m)
Database altered.
SQL > select * from v$logfile order by 1
GROUP# STATUS TYPE MEMBER IS_
-
1 ONLINE / u01/oradata/orcl/redo01.log NO
2 ONLINE / u01/oradata/orcl/redo02.log NO
3 ONLINE / u01/oradata/orcl/redo03.log NO
4 STANDBY / u01/oradata/orcl/sredo04.log NO
5 STANDBY / u01/oradata/orcl/sredo05.log NO
6 STANDBY / u01/oradata/orcl/sredo06.log NO
7 STANDBY / u01/oradata/orcl/sredo07.log NO
7 rows selected.
SQL >
5. Using the contents of spfile file to generate pfile file
SQL > create pfile='/tmp/2.txt' from spfile;-- create a pfile file and modify the contents of the pfile file
File created.
SQL > shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL > exit
6. Modify the contents of the pfile file
[oracle@dg1 ~] $vim / tmp/2.txt
* .db_unique_name=tong-the unique name of the database node
* .fal_server='cheng'-the network service name of the standby library
* .fal_client='tong'-the network service name of the primary library
* .standby_file_management=auto
* .log_archive_start=true
* .log_archive_config='dg_config= (tong,cheng)'- the unique name of the two database nodes
* .log_archive_dest_1='LOCATION=/u01/oradata/tong/archive valid_for= (all_logfiles,all_roles) db_unique_name=tong'-the network service name of the primary library
* .log_archive_dest_2='service=cheng LGWR SYNC AFFIRM valid_for= (online_logfiles,all_roles) db_unique_name=cheng'-the network service name of the standby library
* .log_archive_dest_state_1='ENABLE'
* .log_archive_dest_state_2='ENABLE'
* .log_file_name_convert='/u01/oradata/tong','/u01/oradata/tong'
* .db_file_name_convert='/u01/oradata/tong','/u01/oradata/tong'
[oracle@dg1] $mkdir-p / u01/oradata/tong/archive-- Storage of archived files
[oracle@dg1 dbs] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 9 11:56:26 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL > create spfile from pfile='/tmp/2.txt';-- create spfile files using pfile files
File created.
SQL > startup
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 536873032 bytes
Database Buffers 289406976 bytes
Redo Buffers 2433024 bytes
Database mounted.
Database opened.
SQL > alter database set standby database to maximize availability;-- set to maximum performance mode
Database altered.
SQL >
8. Backup database (backup files in the flash recovery area)
[oracle@dg1 dbs] $rman target /
RMAN > backup database plus archivelog
RMAN > backup current controlfile for standby
Mirror database:
Rman target sys/oracle@orclpr auxiliary sys/oracle@orclst nocatalog
Duplicate target database for standby from active database nofilenamecheck
9. Create a directory on the standby server
[oracle@dg2 U01] $cd / U01
[oracle@dg2 U01] $mkdir flash_recovery_area oradata admin
[oracle@dg2 U01] $mkdir-p / u01/admin/orcl/adump
[oracle@dg2 U01] $mkdir-p / u01/admin/orcl/pfile
[oracle@dg2 U01] $mkdir-p / u01/admin/orcl/dpdump
[oracle@dg2 U01] $mkdir-p / u01/oradata/orcl
[oracle@dg2 U01] $mkdir-p / u01/oradata/tong/archive-the directory where the archived files are stored
10. Cobbe files to standby server
[oracle@dg1 dbs] $cd / u01/flash_recovery_area/-backup files from Cobbe's flashback recovery area
[oracle@dg1 flash_recovery_area] $scp * oracle@dg2;/u01/flash_recovery_area/
[oracle@dg1 flash_recovery_area] $cd / u01/product/11.2.0.1/db_1/dbs/
[oracle@dg1 dbs] $scp * .ora orapwtong oracle@dg2:/u01/product/11.2.0.1/db_1/dbs/-- Cobbe pfile,spfile parameter file and password file (orapwtong)
[oracle@dg1 dbs] $cd / u01/product/11.2.0.1/db_1/network/admin/
[oracle@dg1 admin] $scp listener.ora tnsnames.ora oracle@dg2:/u01/product/11.2.0.1/db_1/network/admin/-- Corbe listens for files
[oracle@dg1 admin] $
II. Standby slave operation
11. Modify the address of the monitor
[oracle@dg2 ~] $cd / u01/product/11.2.0.1/db_1/network/admin/
[oracle@dg2 admin] $vim listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = cheng)
(ORACLE_HOME = / u01/product/11.2.0.1/db_1)
(SID_NAME = cheng)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.80) (PORT = 1521))
)
ADR_BASE_LISTENER = / U01
[oracle@dg2 admin] $vim tnsnames.ora
Tong =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.70) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = tong)
)
)
Cheng =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.3.80) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = cheng)
)
)
[oracle@dg2 admin] $cd / u01/product/11.2.0.1/db_1/dbs/
[oracle@dg2 dbs] $mv inittong.ora initcheng.ora-- modify the pfile file name
[oracle@dg2 dbs] $mv orapwtong orapwcheng-- change the password file name
[oracle@dg2 dbs] $lsnrctl stop
[oracle@dg2 dbs] $lsnrctl start
twelve。 Restore the database
[oracle@dg2] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 16 17:06:55 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL > startup nomount-- Boot to nomount state
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 490735688 bytes
Database Buffers 335544320 bytes
Redo Buffers 2433024 bytes
[oracle@dg2 ~] $rman target sys/system@tong auxiliary /-- restore the database
RMAN > duplicate target database for standby nofilenamecheck
13. Modify pfile parameter file
SQL > shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL >
[oracle@dg2 dbs] $cd / u01/product/11.2.0.1/db_1/dbs/
[oracle@dg2 dbs] $vim initcheng.ora
* .db_unique_name=cheng-the unique name of the database node
* .fal_server='tong'-the unique name of the primary library node
* .fal_client='cheng'-the unique name of the standby library node
* .standby_file_management=auto
* .log_archive_start=true
* .log_archive_config='dg_config= (tong,cheng)'
* .log_archive_dest_1='LOCATION=/u01/oradata/tong/archive valid_for= (all_logfiles,all_roles) db_unique_name=cheng'-- standby library network service name
* .log_archive_dest_2='service=tong LGWR SYNC AFFIRM valid_for= (online_logfiles,all_roles) db_unique_name=tong'-- primary library network service name
* .log_archive_dest_state_1='ENABLE'
* .log_archive_dest_state_2='ENABLE'
* .log_file_name_convert='/u01/oradata/tong','/u01/oradata/tong'
* .db_file_name_convert='/u01/oradata/tong','/u01/oradata/tong'
[oracle@dg2] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 16 17:06:55 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL > create spfile from pfile
File created.
SQL >
14. Start the standby library
SQL > startup nomount
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2217912 bytes
Variable Size 490735688 bytes
Database Buffers 335544320 bytes
Redo Buffers 2433024 bytes
SQL > alter database mount standby database
Database altered.
SQL > alter database add standby logfile
Database altered.
SQL > alter database add standby logfile
Database altered.
SQL > alter database add standby logfile
Database altered.
SQL > alter database add standby logfile
Database altered.
SQL > alter database recover managed standby database using current logfile disconnect from session
Database altered.
SQL >
15. Check standby's log
[root@dg2 ~] # tailf / u01/diag/rdbms/cheng/cheng/trace/alert_cheng.log
Thu Nov 17 13:08:20 2016
Alter database recover managed standby database using current logfile disconnect from session
Attempt to start background Managed Standby Recovery process (cheng)
Thu Nov 17 13:08:20 2016
MRP0 started with pid=30, OS id=5815
MRP0: Background Managed Standby Recovery process started (cheng)
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Thu Nov 17 13:08:27 2016
Archiver process freed from errors. No longer stopped
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 11
Fetching gap sequence in thread 1, gap sequence 11-11
Thu Nov 17 13:08:27 2016
RFS [4]: Opened log for thread 1 sequence 11 dbid 1455843223 branch 928062493
Archived Log entry 9 added for thread 1 sequence 11 rlc 928062493 ID 0x56c6d297 dest 2:
Completed: alter database recover managed standby database using current logfile disconnect from session
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_11_928062493.dbf
Datafile 1 added to flashback set
Datafile 2 added to flashback set
Datafile 3 added to flashback set
Datafile 4 added to flashback set
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_12_928062493.dbf
Thu Nov 17 13:08:34 2016
Standby controlfile consistent with primary
RFS [2]: Selected log 6 for thread 1 sequence 22 dbid 1455843223 branch 928062493
Thu Nov 17 13:08:51 2016
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_13_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_14_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_15_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_16_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_17_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_18_928062493.dbf
Media Recovery Log / u01/product/11.2.0.1/db_1/dbs/arch2_19_928062493.dbf
Thu Nov 17 13:09:03 2016
Media Recovery Waiting for thread 1 sequence 20 (in transit)
Recovery of Online Redo Log: Thread 1 Group 4 Seq 20 Reading mem 0
Mem# 0: / u01/flash_recovery_area/TONG/onlinelog/o1_mf_4_d2r8rhpj_.log
Media Recovery Waiting for thread 1 sequence 21 (in transit)
Recovery of Online Redo Log: Thread 1 Group 5 Seq 21 Reading mem 0
Mem# 0: / u01/flash_recovery_area/TONG/onlinelog/o1_mf_5_d2r8rqpl_.log
16. Verify that dataguard is successful
Dg1 node:
[oracle@dg1 dbs] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 17 13:50:58 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination / u01/oradata/tong/archive
Oldest online log sequence 24
Next log sequence to archive 26
Current log sequence 26-- this value is equal to the following value.
SQL >
Dg2 node:
[oracle@dg2 dbs] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 17 13:53:33 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL > archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination? / dbs/arch
Oldest online log sequence 25
Next log sequence to archive 0
Current log sequence 26
SQL >
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.