DataGuard管理操作命令

7月 3rd, 2018

1.相关进程:
1.RFS(Remote File Server Process):接收由Primary数据库的lgwr或arch通过Oracle Net传来的redo数据,写入standby redo logs或standby archived redo logs;
2.MRP(Managed Recovery Process):管理恢复进程;
3.FAL(Fetch Archive Log):在Primary和Standby数据库的两端同时配置;Primary端是fetch archive log server,standby端是fetch archive log client,FAL是自动探测Primary/Standby数据库之间archived logs是否有有间隔的一个进程;
2.主备库切换:
1.主库切到备库(SWITCHOVER):
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;
SELECT name, open_mode, protection_mode, database_role, switchover_status from v$DATABASE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
2.备库切到主库(SWITCHOVER):
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
STARTUP
SELECT name, open_mode, protection_mode, database_role, switchover_status from v$DATABASE;
3.FAILOVER切换:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
ALTER DATABASE OPEN;
SELECT name, open_mode, protection_mode, database_role, switchover_status from v$DATABASE;
3.切换数据库模式:
STARTUP IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE/AVAILABILITY/PROTECTION;
ALTER DATABASE OPEN;
4.测试Primary的归档能否应用到Standby:
1.查看v$archive_gap:SELECT * FROM v$archive_gap;
2.ARCHIVE LOG LIST;
5.管理操作:
1.停止Standby:ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;STARTUP IMMEDIATE;
2.切换到只读模式:ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;ALTER DATABASE OPEN READ ONLY;
3.切换到管理恢复模式:ALTER DATABASE RECOVER MANAGED STANDBY DATABASE [PARALLEL 8] [USING CURRENT LOGFILE] DISCONNECT FROM SESSION;
4.查询备机归档日志应用情况:SELECT sequence#, applied FROM v$archived_log;
5.在主库上归档当前日志:ALTER SYSTEM ARCHIVE LOG CURRENT;
6.设置归档频率,强制Primary一分种归档一次:ALTER SYSTEM SET ARCHIVE_LAG_TARGET=60 SCOPE=BOTH;
6.注意事项:
1.如果在主库执行ALTER DATABASE CLEAR UNARCHIVED LOGFILE或ALTER DATABASE OPEN RESETLOGS,则DataGuard要重建;
2.出现归档日志gap时,需要找出相应的归档日志,然后将这些归档日志copy到备用节点的standby_archive_dest和log_archive_dest目录下面;需要注意的是log_archive_dest目录下也需要copy,然后ALTER DATABASE RECOVER AUTOMATIC STANDBY DATABASE;
3.新建表/表空间/datafile都能通过日志应用到备库,但新建一个临时表空间/rename datafile均不能应用到备库上;
4.应当实时察看standby库的alert文件,就能清晰明了地知道主备更新的情况,这也是排错的重要方法;
7.相关视图:
DBA_LOGSTDBY_EVENTS (Logical Standby Databases Only)
DBA_LOGSTDBY_LOG (Logical Standby Databases Only)
DBA_LOGSTDBY_NOT_UNIQUE (Logical Standby Databases Only)
DBA_LOGSTDBY_PARAMETERS (Logical Standby Databases Only)
DBA_LOGSTDBY_PROGRESS (Logical Standby Databases Only)
DBA_LOGSTDBY_SKIP (Logical Standby Databases Only)
DBA_LOGSTDBY_SKIP_TRANSACTION (Logical Standby Databases Only)
DBA_LOGSTDBY_UNSUPPORTED (Logical Standby Databases Only)
V$ARCHIVE_DEST
V$ARCHIVE_DEST_STATUS
V$ARCHIVE_GAP
V$ARCHIVED_LOG
V$DATABASE
V$DATAFILE
V$DATAGUARD_STATUS
V$LOG
V$LOGFILE
V$LOG_HISTORY
V$LOGSTDBY (Logical Standby Databases Only)
V$LOGSTDBY_STATS (Logical Standby Databases Only)
V$MANAGED_STANDBY (Physical Standby Databases Only)
V$STANDBY_LOG

标签:
目前还没有任何评论.
您必须在 登录 后才能发布评论.