SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY, UNIQUE INDEX) COLUMNS;
If you do not do this, then any logical standby that is also in the same Data Guard configuration will be unusable if a switchover or failover is performed to one of the physical standby databases. If a switchover or failover has already occurred and supplemental logging was not enabled, then you must recreate all logical standby databases
第三步:在备库告诉mrp继续应用redo,达到字典构建时的scn;
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 313159680 bytes Fixed Size 2252824 bytes Variable Size 171970536 bytes Database Buffers 134217728 bytes Redo Buffers 4718592 bytes Database mounted. SQL> alter database recover to logical standby Amy; Database altered.
这时我们修改几个地方,首先是db_name;
SQL> alter system set db_name=Amy scope=spfile; System 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
另外还有log_archive_dest_n 参数配置:
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,a
ll_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=dg1 lgwr sync valid_fo
r=(online_logfiles,primary_rol
e) db_unique_name=dg1
log_archive_dest_20 string
这里需要说明第一个log_archive_dest_1 为什么是all_logfiles呢?因为我们是创建的逻辑备库,逻辑备库除了维护主库的对象外,还可以自己进行其他对象的修改操作那么这些对象的redo,是需要归档的,逻辑备库是一个真实数据库啊,另外如果不指定快速闪回区,那么应该在加一个log_archive_dest_3,将日志分开,另外如果是快速闪回区,可以省略valid_for,因为默认就是all_logfiles,all_roles。
另外要注意:如果逻辑备库和主库在一个相同的数据存储管理上,那么需要使用dbms_logstdby.skip去跳过alter tablespace dml的操作,不然可能产生误修改主库的表空间问题。
第四步:完成逻辑dg的创建:
SQL> shutdown immediat; SP2-0717: illegal SHUTDOWN option SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 313159680 bytes Fixed Size 2252824 bytes Variable Size 171970536 bytes Database Buffers 134217728 bytes Redo Buffers 4718592 bytes Dat