1,构建一个物理备库,我们已经有了,哈哈,对吧
2,停止物理备库日志应用
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
3,调整主库用于支持逻辑备库
如主库切换为逻辑备库
配置如下参数
LOG_ARCHIVE_DEST_3=
'LOCATION=/oracle/centos/
VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE)
DB_UNIQUE_NAME=centos'
LOG_ARCHIVE_DEST_STATE_3=ENABLE
4,在重作数据中构建数据字典
在主库
EXECUTE DBMS_LOGSTDBY.BUILD;
5,转变为逻辑备库
在备库
alter database recover to logical standby logic; --为新的逻辑备库起的新db_name
orapwd file=./orapwrhel password=system entries=10 force=y --为新logical standby db构建password file
6,为逻辑备库调节某些参数
shutdown immediate;
startup mount;
*.log_archive_config='dg_config=(centos,rhel)'
*.log_archive_dest_1='location=/oracle/rhelarch valid_for=(online_logfiles,all_roles) db_unique_name=rhel' --logical standby db本地日志的归档所有
*.log_archive_dest_2='location=/oracle/receive_centos_arch valid_for=(standby_logfiles,standby_role) db_unique_name=rhel' ---主库归档传送过来,接收所在地
7,打开逻辑备库
ALTER DATABASE OPEN RESETLOGS;
8,开始逻辑备库日志应用
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
9,备库重作日志的(standby logfile)的相关信息
SQL> select group#,dbid,archived,status from v$standby_log;
GROUP# DBID ARC STATUS
---------- ---------------------------------------- --- ----------
4 UNASSIGNED NO UNASSIGNED
5 3004476886 YES ACTIVE
6 UNASSIGNED YES UNASSIGNED
SQL>
10,以上日志添加,可采用如下操作
Example 3-2 Adding a Standby Redo Log File Group to a Specific Group Number
You can also specify a number that identifies the group using the GROUP clause:
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 10
2> ('/oracle/dbs/log1c.rdo','/oracle/dbs/log2c.rdo') SIZE 500M;
Using group numbers can make administering standby redo log file groups easier. However, the group number must be between 1 and the value of the MAXLOGFILES clause. Do not skip log file group numbers (that is, do not number groups 10, 20, 30, and so on), or you will use additional space in the standby database control file.
Note:
Although the standby redo log is only used when the database is running in the standby role, Oracle recommends that you create a standby redo log on the primary database so that the primary database can switch over quickly to the standby role without the need for additional DBA intervention. Consider using Oracle Enterprise Manager to automatically configure standby redo log on both your primary and standby databases.
Step 5 Verify the standby redo log file groups were created.
To verify the standby redo log file groups are created and running correctly, invoke a log switch on the primary database, and then query either the V$STANDBY_LOG view or the V$LOGFILE view on the standby database once it has been created. For example:
SQL> SELECT GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
GROUP# THREAD# SEQUENCE# ARC STATUS
---------- ---------- ---------- --- ----------
3 1 16 NO ACTIVE
4 0 0 YES UNASSIGNED
5 0 0 YES UNASSIGNED
11,最后一点,因为我们是基于物理备库,转换为逻辑备库,所以逻辑备库采用了新的db_name,故主备库的tnsnames.ora及listener.ora文件要重建,及重启
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-625525/ ,如需转载,请注明出处,否则将追究法律责任。