DG搭建逻辑备库(一)

2015-02-02 20:09:35 · 作者: · 浏览: 31

逻辑备库是在物理备库的基础上搭建的,所以需要先搭建好物理备库。

备库执行如下操作:

[oracle@localhost ~]$ 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

主库:

[oracle@localhost ~]$ 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>

备库

[oracle@localhost ~]$ 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;

Databas