时间:2021-07-01 10:21:17 帮助过:2人阅读
角色也变为physical standby
Primary>select database_role from v$database; DATABASE_ROLE -------------------------------- PHYSICAL STANDBY
如果此时打开数据库,为只读状态
Primary>alter database open; Database altered. Primary>select open_mode from v$database; OPEN_MODE ---------------------------------------- READ ONLY Primary>
StandBy--->Primary
StandBy>select switchover_status from v$database; SWITCHOVER_STATUS ---------------------------------------- TO PRIMARY StandBy> alter database commit to switchover to primary; Database altered. StandBy>alter database open; Database altered. StandBy>select open_mode from v$database; OPEN_MODE ---------------------------------------- READ WRITE StandBy>select database_role from v$database; DATABASE_ROLE -------------------------------- PRIMARY StandBy>
1、当前的Primay数据库插入一条数据
Primay>select * from scott.dept; DEPTNO DNAME LOC ---------- ---------------------------- -------------------------- ACCOUNTING NEW YORK RESEARCH DALLAS SALES CHICAGO OPERATIONS BOSTON OPERATIONS OPERATIONS OPERATIONS OPERATIONS rows selected. Primay>INSERT INTO "SCOTT"."DEPT" ("DEPTNO", "DNAME", "LOC") VALUES (‘14‘, ‘OPERATIONS‘, ‘OPERATIONS‘); row created. StandBY>commit; Commit complete. Primay>select * from scott.dept; DEPTNO DNAME LOC ---------- ---------------------------- -------------------------- OPERATIONS OPERATIONS ACCOUNTING NEW YORK RESEARCH DALLAS SALES CHICAGO OPERATIONS BOSTON OPERATIONS OPERATIONS OPERATIONS OPERATIONS rows selected.
2、当前的StandBy启用redo应用
实时redo应用的情况
Primary>alter database recover managed standby database using current logfile disconnect from session; Database altered.
非实时redo应用的情况
alter database recover managed standby database disconnect from session; --应用redo
alter database recover managed standby database cancel; --暂停redo应用
查询
Primary>select * from scott.dept; DEPTNO DNAME LOC ---------- ---------------------------- -------------------------- OPERATIONS OPERATIONS ACCOUNTING NEW YORK RESEARCH DALLAS SALES CHICAGO OPERATIONS BOSTON OPERATIONS OPERATIONS OPERATIONS OPERATIONS rows selected.
1、如果无法同步,切换日志试试
StandBY>alter system switch logfile;
查询Priamry和StandBy的归档日志编号是否相同
StandBY>select max(sequence#) from v$archived_log; MAX(SEQUENCE#) -------------- 22
2、查看配置的服务名中的service_name 和lsnrctl status中的是否相同
DataGuard---->物理StandBy的角色切换之switchover
标签:complete red 插入 lte color rom 相同 alter status