通过DG_BROKE搭建Oracle11g_adg
1.环境
db_primary | db_stanby | |
---|---|---|
db版本 | 11.2.0.4.0 | 11.2.0.4.0 |
os版本 | centos 6.4 | centos 6.4 |
db_unique_name | newtest | snewtest |
db name | newtest | newtest |
ip | 10.10.0.23 | 10.10.0.24 |
2.主库配置过程
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 22:20:50 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
2.1开启 force logging
SQL> alter database force logging;
Database altered.
SQL> select force_logging from v$database;
FOR
---
YES
2.2开启归档
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 21
Next log sequence to archive 23
Current log sequence 23
SQL>
2.3password file 配置
[oracle@localhost dbs]$ export ORACLE_SID=newtest
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 22:32:40 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost dbs]$ sqlplus system/oracle
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 22:32:45 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost dbs]$ ll orapw*
-rw-r-----. 1 oracle dba 1536 Jan 31 20:18 orapwnewtest
#同步密码文件以及spfile文件到备库
[oracle@localhost dbs]$ scp orapwnewtest 10.10.0.24:/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs
oracle@10.10.0.24's password:
orapwnewtest
[oracle@localhost dbs]$ scp spfilenewtest.ora 10.10.0.24:/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs
oracle@10.10.0.24's password:
spfilenewtest.ora
3. 网路配置
3.1主库上配置listener.ora
[oracle@localhost admin]$ vi listener.ora
# listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = newtest)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1/)
(SID_NAME = newtest)
)
)
~
#启动监听
[oracle@localhost admin]$ lsnrctl restart
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 22:52:19
Copyright (c) 1991, 2013, Oracle. All rights reserved.
NL-00853: undefined command "restart". Try "help"
[oracle@localhost admin]$ lsnrctl reload
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 22:52:25
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
[oracle@localhost admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 22:52:31
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 21-MAR-2018 22:48:21
Uptime 0 days 0 hr. 4 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "newtest" has 2 instance(s).
Instance "newtest", status UNKNOWN, has 1 handler(s) for this service...
Instance "newtest", status READY, has 1 handler(s) for this service...
Service "newtestXDB" has 1 instance(s).
Instance "newtest", status READY, has 1 handler(s) for this service...
The command completed successfully
3.2主库上配置tnsnames
[oracle@localhost admin]$ vi tnsnames.ora
NEWTEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.23)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newtest)
)
)
SNEWTEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.24)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newtest)
)
)
#测试连通性
[oracle@localhost admin]$ tnsping NEWTEST
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 22:56:57
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.23)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = newtest)))
OK (20 msec)
[oracle@localhost admin]$ sqlplus system/oracle@NEWTEST
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 22:57:26 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
3.3备库上配置listener.ora
[oracle@localhost admin]$ vi listener.ora
# listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = newtest)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1/)
(SID_NAME = newtest)
)
)
3.2备库上配置tnsnames
[oracle@localhost admin]$ vi tnsnames.ora
NEWTEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.23)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newtest)
)
)
SNEWTEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.24)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = newtest)
)
)
#测试连通性
[oracle@localhost admin]$ tnsping sNEWTEST
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 23:12:09
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.24)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = newtest)))
OK (0 msec)
[oracle@localhost admin]$ tnsping NEWTEST
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 23:12:13
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.23)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = newtest)))
OK (0 msec)
[oracle@localhost admin]$ tnsping SNEWTEST
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 23:12:16
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.0.24)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = newtest)))
OK (10 msec)
4.参数设置
4.1主库设置
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 23:15:17 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL>
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string newtest
SQL> show parameter standby_file_management
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_file_management string MANUAL
SQL> alter system set standby_file_management=auto
2 ;
System altered.
SQL> show parameter standby_file_management
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_file_management string AUTO
SQL> show parameter dg_broker_start
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_start boolean FALSE
SQL> alter system set dg_broker_start = true ;
System altered.
#可以看到dg_broker已经启动
SQL> !ps -ef|grep dmon
oracle 13362 1 0 23:16 ? 00:00:00 ora_dmon_newtest
oracle 13365 13357 0 23:16 pts/0 00:00:00 /bin/bash -c ps -ef|grep dmon
oracle 13367 13365 0 23:16 pts/0 00:00:00 grep dmon
4.2备库设置
[oracle@localhost dbs]$ vi initnewtest.ora
newtest.__db_cache_size=339738624
newtest.__java_pool_size=4194304
newtest.__large_pool_size=8388608
newtest.__oracle_base='/home/oracle/app'#ORACLE_BASE set from environment
newtest.__pga_aggregate_target=272629760
newtest.__sga_target=515899392
newtest.__shared_io_pool_size=0
newtest.__shared_pool_size=155189248
newtest.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/admin/newtest/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/home/oracle/app/oradata/newtest/control01.ctl','/home/oracle/app/fast_recovery_area/newtest/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='newtest'
*.db_recovery_file_dest='/home/oracle/app/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.dg_broker_start=TRUE
*.diagnostic_dest='/home/oracle/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=newtestXDB)'
*.memory_target=786432000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sec_case_sensitive_logon=TRUE
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
db_unique_name=snewtest
#创建目录
[oracle@localhost dbs]$ cd /home/oracle/app/oradata/newtest/
-bash: cd: /home/oracle/app/oradata/newtest/: No such file or directory
[oracle@localhost dbs]$ mkdir -p /home/oracle/app/admin/newtest/adump
[oracle@localhost dbs]$ mkdir -p /home/oracle/app/oradata/newtest
[oracle@localhost dbs]$ mkdir -p /home/oracle/app/fast_recovery_area
[oracle@localhost dbs]$ mkdir -p /home/oracle/app/fast_recovery_area/newtest
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 23:32:48 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile ;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 478154296 bytes
Database Buffers 301989888 bytes
Redo Buffers 2596864 bytes
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string snewtest
SQL>
5 rman搭建standy
[oracle@localhost dbs]$ rman target sys/oracle@NEWTEST auxiliary sys/oracle@SNEWTEST nocatalog
Recovery Manager: Release 11.2.0.4.0 - Production on Wed Mar 21 23:35:59 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: NEWTEST (DBID=1783795369)
using target database control file instead of recovery catalog
connected to auxiliary database: NEWTEST (not mounted)
RMAN> Duplicate target database for standby from active database nofilenamecheck;
Starting Duplicate Db at 21-MAR-18
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=17 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwnewtest' auxiliary format
'/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwnewtest' ;
}
executing Memory Script
Starting backup at 21-MAR-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=40 device type=DISK
Finished backup at 21-MAR-18
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/home/oracle/app/oradata/newtest/control01.ctl';
restore clone controlfile to '/home/oracle/app/fast_recovery_area/newtest/control02.ctl' from
'/home/oracle/app/oradata/newtest/control01.ctl';
}
executing Memory Script
Starting backup at 21-MAR-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_newtest.f tag=TAG20180321T233805 RECID=1 STAMP=971393885
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 21-MAR-18
Starting restore at 21-MAR-18
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 21-MAR-18
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/home/oracle/app/oradata/newtest/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/home/oracle/app/oradata/newtest/system01.dbf";
set newname for datafile 2 to
"/home/oracle/app/oradata/newtest/sysaux01.dbf";
set newname for datafile 3 to
"/home/oracle/app/oradata/newtest/undotbs01.dbf";
set newname for datafile 4 to
"/home/oracle/app/oradata/newtest/users01.dbf";
set newname for datafile 5 to
"/home/oracle/app/oradata/newtest/users02.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/home/oracle/app/oradata/newtest/system01.dbf" datafile
2 auxiliary format
"/home/oracle/app/oradata/newtest/sysaux01.dbf" datafile
3 auxiliary format
"/home/oracle/app/oradata/newtest/undotbs01.dbf" datafile
4 auxiliary format
"/home/oracle/app/oradata/newtest/users01.dbf" datafile
5 auxiliary format
"/home/oracle/app/oradata/newtest/users02.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/app/oradata/newtest/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 21-MAR-18
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/home/oracle/app/oradata/newtest/sysaux01.dbf
output file name=/home/oracle/app/oradata/newtest/sysaux01.dbf tag=TAG20180321T233815
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/home/oracle/app/oradata/newtest/system01.dbf
output file name=/home/oracle/app/oradata/newtest/system01.dbf tag=TAG20180321T233815
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/home/oracle/app/oradata/newtest/users02.dbf
output file name=/home/oracle/app/oradata/newtest/users02.dbf tag=TAG20180321T233815
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/home/oracle/app/oradata/newtest/users01.dbf
output file name=/home/oracle/app/oradata/newtest/users01.dbf tag=TAG20180321T233815
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/home/oracle/app/oradata/newtest/undotbs01.dbf
output file name=/home/oracle/app/oradata/newtest/undotbs01.dbf tag=TAG20180321T233815
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 21-MAR-18
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=971394136 file name=/home/oracle/app/oradata/newtest/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=971394136 file name=/home/oracle/app/oradata/newtest/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=971394136 file name=/home/oracle/app/oradata/newtest/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=971394136 file name=/home/oracle/app/oradata/newtest/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=971394136 file name=/home/oracle/app/oradata/newtest/users02.dbf
Finished Duplicate Db at 21-MAR-18
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 23:43:33 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
6.主备库上漏掉了 log文件配置,导致log没有同步(问题1)
6.1 主库上创建log 租
SQL> desc v$standby_log
Name Null? Type
----------------------------------------- -------- ----------------------------
GROUP# NUMBER
DBID VARCHAR2(40)
THREAD# NUMBER
SEQUENCE# NUMBER
BYTES NUMBER
BLOCKSIZE NUMBER
USED NUMBER
ARCHIVED VARCHAR2(3)
STATUS VARCHAR2(10)
FIRST_CHANGE# NUMBER
FIRST_TIME DATE
NEXT_CHANGE# NUMBER
NEXT_TIME DATE
LAST_CHANGE# NUMBER
LAST_TIME DATE
SQL> select * from v$standby_log;
no rows selected
SQL> alter database add standby logfile group 4;
Database altered.
SQL> alter database add standby logfile group 5;
Database altered.
SQL> alter database add standby logfile group 6;
Database altered.
SQL> alter database add standby logfile group 7;
Database altered.
SQL> show parameter broker
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string /home/oracle/app/oracle/produc
t/11.2.0/dbhome_1/dbs/dr1snewt
est.dat
dg_broker_config_file2 string /home/oracle/app/oracle/produc
t/11.2.0/dbhome_1/dbs/dr2snewt
est.dat
dg_broker_start boolean TRUE
SQL> !ps -ef |grep dmon
oracle 13978 1 0 23:33 ? 00:00:00 ora_dmon_newtest
oracle 14051 14047 0 23:45 pts/2 00:00:00 /bin/bash -c ps -ef |grep dmon
oracle 14053 14051 0 23:45 pts/2 00:00:00 grep dmon
7.配置 dgmgrl
[oracle@localhost dbs]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration dg_newtest as primary database is newtest connect identifier is newtest;
Configuration "dg_newtest" created with primary database "newtest"
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> enble configuration;
Unrecognized command "enble", try "help"
DGMGRL> enable configuration ;
Enabled.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
Warning: ORA-16789: standby redo logs not configured
Fast-Start Failover: DISABLED
Configuration Status:
WARNING
DGMGRL> exit
这里又报了一个错:原来刚才只给主库配置了 redo logs 备库上遗漏了
#备库上配置 redo logs
[oracle@localhost dbs]$
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 23:50:38 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter database add standby logfile group 4;
Database altered.
SQL> alter database add standby logfile group 5;
Database altered.
SQL> alter database add standby logfile group 6 ;
Database altered.
SQL> alter database add standby logfile group 7;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
再次查看dgmgrl 配置
[oracle@localhost dbs]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> exit
现在么问题,success
查看主备的log_archive_dest参数,发现分别在主备的 log_archive_dest_1和 log_archive_dest_2上做了配置
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 23:52:35 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> set linesize 200
SQL> show parameter log_archive_desc_1
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string location=USE_DB_RECOVERY_FILE_
DEST, valid_for=(ALL_LOGFILES,
ALL_ROLES)
log_archive_dest_10 string
log_archive_dest_11 string
log_archive_dest_12 string
log_archive_dest_13 string
log_archive_dest_14 string
log_archive_dest_15 string
log_archive_dest_16 string
log_archive_dest_17 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_18 string
log_archive_dest_19 string
SQL> show parameter log_archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string service="snewtest", LGWR ASYNC
NOAFFIRM delay=0 optional com
pression=disable max_failure=0
max_connections=1 reopen=300
db_unique_name="snewtest" net_
timeout=30, valid_for=(all_log
files,primary_role)
log_archive_dest_20 string
log_archive_dest_21 string
log_archive_dest_22 string
log_archive_dest_23 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_24 string
log_archive_dest_25 string
log_archive_dest_26 string
log_archive_dest_27 string
log_archive_dest_28 string
log_archive_dest_29 string
SQL>
Add database to broker
[oracle@localhost dbs]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> add database snewtest as connect identifier is snewtest maintained as physical;
Database "snewtest" added
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
snewtest - Physical standby database (disabled)
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> enable database snewtest;
Enabled.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
snewtest - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
主备机更改local_listener
#主机
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
SQL> alter system set local_listener=newtest;
System altered.
#备机
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
SQL> alter system set local_listener=snewtest;
System altered.
8 测试ADG
主库创建表 插入数据
SQL> create table test (id int);
Table created.
SQL> insert into test values(1);
1 row created.
SQL> commit;
Commit complete.
备库open 查询数据
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
SQL> alter database open;
Database altered.
SQL> select *from test;
ID
----------
1
主库再次插入
SQL> insert into test values(2);
1 row created.
SQL> commit;
Commit complete.
查询备库
SQL> select *from test;
ID
----------
1
2
adg 功能实现!
通过DG_BROKE搭建Oracle11g_adg的更多相关文章
- Online Judge(OJ)搭建(第一版)
搭建 OJ 需要的知识(重要性排序): Java SE(Basic Knowledge, String, FileWriter, JavaCompiler, URLClassLoader, Secur ...
- Angular2入门系列教程1-使用Angular-cli搭建Angular2开发环境
一直在学Angular2,百忙之中抽点时间来写个简单的教程. 2016年是前端飞速发展的一年,前端越来越形成了(web component)组件化的编程模式:以前Jquery通吃一切的田园时代一去不复 ...
- 总结:Mac前端开发环境的搭建(配置)
新年新气象,在2016年的第一天,我入手了人生中第一台自己的电脑(大一时好友赠送的电脑在一次无意中烧坏了主板,此后便不断借用别人的或者网站的).macbook air,身上已无分文...接下来半年的房 ...
- Angular企业级开发(5)-项目框架搭建
1.AngularJS Seed项目目录结构 AngularJS官方网站提供了一个angular-phonecat项目,另外一个就是Angular-Seed项目.所以大多数团队会基于Angular-S ...
- 【分享】标准springMVC+mybatis项目maven搭建最精简教程
文章由来:公司有个实习同学需要做毕业设计,不会搭建环境,我就代劳了,顺便分享给刚入门的小伙伴,我是自学的JAVA,所以我懂的.... (大图直接观看显示很模糊,请在图片上点击右键然后在新窗口打开看) ...
- 一起学微软Power BI系列-使用技巧(4)Power BI中国版企业环境搭建和帐号问题
千呼万唤的Power BI中国版终于落地了,相信12月初的微软技术大会之后已经铺天盖地的新闻出现了,不错,Power BI中国版真的来了,但还有些遗憾,国际版的一些重量级服务如power bi emb ...
- 从0开始搭建SQL Server AlwaysOn 第一篇(配置域控)
从0开始搭建SQL Server AlwaysOn 第一篇(配置域控) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www.cnb ...
- 从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群)
从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www ...
- 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)
从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://w ...
随机推荐
- SQL正则表达式
(转自:http://blog.csdn.net/xu1314/article/details/10174067) 当我们要进行一些简单的糊涂查询时用百分号(%),通配符(_)就可以了.其中%表达任意 ...
- 内存保护机制及绕过方案——利用未启用SafeSEH模块绕过SafeSEH
前言:之前关于safeSEH保护机制的原理等信息,可在之前的博文(内存保护机制及绕过方案中查看). 利用未启用SafeSEH模块绕过SafeSEH ⑴. 原理分析: 一个不是仅包含中间语言(1L)且 ...
- 【python】没有root权限的时候安装Python package
下载相关位置的包 1.首先在git上下载对应的包: 搜索package github,找到地址.使用 git clone https://xxx.git 命令 2.使用python setup.py ...
- 你不知道的sticky
position:sticky,Chrome新版本已经做了支持.sticky的中文翻译是“粘性的”,position:sticky表现也符合这个粘性的表现.基本上,可以看出是position:rela ...
- selenium webdriver入门
写在前面:最近在研究UI自动化测试的过程中,发现公司里通常用的是AutomanX框架,而这个框架实际上是基于selenium webdriver框架的,所以在编写测试用例时,很多语法都是直接使用sel ...
- 《Drools7.0.0.Final规则引擎教程》第3章 3.2 KIE API解析
3.2.4 KieServices 该接口提供了很多方法,可以通过这些方法访问KIE关于构建和运行的相关对象,比如说可以获取KieContainer,利用KieContainer来访问KBase和KS ...
- 使用tor实现匿名扫描/SSH登录
你要做坏事时,最先应该想到匿名.扫描网站/主机,或利用漏洞:甚至在大天朝发帖都有风险,为了防止半夜鬼敲门,我们可以使用tor实现匿名. 如果你不知道tor是什么,看:https://zh.wikipe ...
- MpVue开发之swiper的使用
用到的关键字如下: class :class current :current bindchange @change circular 是否实现无限滑动 true/false skip-hidden ...
- 【ES6】蛋疼
- 内联元素inline-block空隙问题
1.产生的原因 当我们使用"display:inline-block"把块集元素转换为内联元素时,每两个内联元素之间有一定的空隙,既不是margin也不是padding,最终发现是 ...