逻辑备库是在物理备库的基础上搭建的,所以需要先搭建好物理备库。
备库执行如下操作:
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production onFri Nov 7 15:03:30 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle LabelSecurity, OLAP, Data Mining,
Oracle Database Vault and Real ApplicationTesting options
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> exit
Disconnected from Oracle Database 11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle LabelSecurity, OLAP, Data Mining,
Oracle Database Vault and Real ApplicationTesting options
主库:
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production onFri Nov 7 15:04:46 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle LabelSecurity, OLAP, Data Mining,
Oracle Database Vault and Real ApplicationTesting options
SQL> alter database force logging; ---强制日志记录
Database altered.
SQL> alter database add supplemental log data; ----增加附加日志
Database altered.
SQL> exec dbms_logstdby.build; ---脚本
PL/SQL procedure successfully completed.
SQL>
备库
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production onFri Nov 7 15:11:37 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle LabelSecurity, OLAP, Data Mining,
Oracle Database Vault and Real ApplicationTesting options
SQL> alter database recover to logical standby jadl11g;
Database altered.
SQL> shutdown immediate----注意必须一致性性关闭数据库
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 626327552 bytes
Fixed Size 2230952 bytes
Variable Size 268436824 bytes
Database Buffers 352321536 bytes
Redo Buffers 3338240 bytes
Database mounted.
SQL> alter database open resetlogs; *********
Database altered.
SQL> alter database start logical standby apply;
Database altered.
登录DGMGRL:
DGMGRL> createconfiguration dgc as primary database is pjadl11g connect identifier ispjadl11g;
Configuration "dgc" created withprimary database "pjadl11g"
DGMGRL> add database sjadl11g as connect identifier issjadl11g maintained as logical;
Database "sjadl11g" added
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
Configuration - dgc
Protection Mode: MaxPerformance
Databases:
pjadl11g - Primary database
sjadl11g - Logical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
至此逻辑备库搭建完毕!!!!!!!
DGMGRL> show configuration verbose;
Configuration - dgc
Protection Mode: MaxPerformance
Databases:
pjadl11g - Primary database
sjadl11g - Logical standby database
Properties:
FastStartFailoverThreshold =‘30‘
OperationTimeout =‘30‘
FastStartFailoverLagLimit =‘30‘
CommunicationTimeout =‘180‘
FastStartFailoverAutoReinstate =‘TRUE‘
FastStartFailoverPmyShutdown =‘TRUE‘
BystandersFollowRoleChange =‘ALL‘
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> show database verbose sjadl11g;
Database - sjadl11g
Role: LOGICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Instance(s):
jadl11g
Properties:
DGConnectIdentifier =‘sjadl11g‘
ObserverConnectIdentifier =‘‘
LogXptMode = ‘ASYNC‘
DelayMins =‘0‘
Binding =‘optional‘
MaxFailure =‘0‘
MaxConnections =‘1‘
ReopenSecs =‘300‘
NetTimeout =‘30‘
RedoCompression =‘DISABLE‘
LogShipping =‘ON‘
PreferredApplyInstance = ‘‘
ApplyInstanceTimeout =‘0‘
LsbyASkipTxnCfgPr =‘0,0,0‘
LsbyDSkipTxnCfgPr =‘0,0,0‘
LsbyASkipCfgPr =‘‘
LsbyDSkipCfgPr =‘‘
LsbyASkipErrorCfgPr = ‘‘
LsbyDSkipErrorCfgPr =‘‘
LsbyMaxEventsRecorded =‘0‘
LsbyPreserveCommitOrder =‘‘
LsbyRecordSkipErrors =‘‘
LsbyRecordSkipDdl =‘‘
LsbyRecordAppliedDdl =‘‘
ArchiveLagTarget =‘0‘
LogArchiveMaxProcesses =‘4‘
LogArchiveMinSucceedDest =‘1‘
FastStartFailoverTarget =‘‘
InconsistentProperties =‘(monitor)‘
InconsistentLogXptProps =‘(monitor)‘
SendQEntries =‘(monitor)‘
LogXptStatus =‘(monitor)‘
RecvQEntries =‘(monitor)‘
LsbyParameters =‘(monitor)‘
LsbySkipTxnTable =‘(monitor)‘
LsbySkipTable =‘(monitor)‘
LsbyFailedTxnInfo =‘(monitor)‘
SidName =‘jadl11g‘
StaticConnectIdentifier =‘(DESCRIPTION=(ADDRESS=(PROTOCOL=tc =localhost.localdomain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sjadl11g_D INSTANCE_NAME=jadl11g)(SERVER=DEDICATED)))‘
StandbyArchiveLocation =‘USE_DB_RECOVERY_FILE_DEST‘
AlternateLocation = ‘‘
LogArchiveTrace =‘0‘
LogArchiveFormat =‘%t_%s_%r.dbf‘
LsbyMaxSga =‘0‘
LsbyMaxServers =‘0‘
TopWaitEvents =‘(monitor)‘
Database Status:
SUCCESS
DGMGRL> edit database sjadl11g set propertylogxptmode=‘sync‘;---修改参数
Property"logxptmode" updated