ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DataGuard构建完成后常用命令(zt)

DataGuard构建完成后常用命令(zt)

原创 Linux操作系统 作者:yexichang 时间:2009-04-26 10:11:26 0 删除 编辑
--备库启动归档日志应用
alter database recover managed standby database disconnect from session;

--备库停止归档日志应用
alter database recover managed standby database cancel;

--查询归档日志是否被应用,查询V$archived_log视图的applied列
select sequence#,dest_id,first_time,next_time,archvied,applied from v$archived_log;

--查看备库是否和主库同步,查询V$archive_dest_status视图
select archived_thread#,archived_seq#,applied_thread#,applied_seq#from v$archive_dest_status;

--监控日志传送状态,V$archive_gap记录当前备库mrp进程恢复需要的但是还没有传到备库的日志更简单的是查看主备库的归档日志的序列号相差多少
select * from v$archive_gap;

--查看当前主机的运行状态(主库/备库/保护模式)
select switchover_status,database_role,protection_mode from v$database

--查看备库接收、应用redo数据的过程
select message from v$dataguard_status

--备库端查看RFS(Remote File Service)接收日志情况和MRP应用日志同步主数据库的情况(Physical Standby Database Only)   记录当前备库的一些进程情况和进程ID
select process,status,thread#,sequence#,block#,blocks from v$managed_standby;

--V$STANDBY_LOG备用数据库的备用日志的数量与当前状态等信息
SELECT * FROM V$STANDBY_LOG;

-- From eygle  http://www.eygle.com/archives/2009/03/oracle_dataguard_manual.html

Start Standby Database

startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect;


Disable/Enable archive log destinations

alter system set log_archive_dest_state_2 = 'defer';
alter system set log_archive_dest_state_2 = 'enable';

To remove a delay from a standby

alter database recover managed standby database cancel;

alter database recover managed standby database nodelay disconnect;

Stop and Start of Logical standby apply

alter database stop logical standby apply;
alter database start logical standby apply;

Physical Standby switchover:
In Primary Database:

ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;

In standby Database:

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
SHUTDOWN IMMEDIATE;
STARTUP;

In Primary Database:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

If the primary Database is down,we can use fllowing step to active standby database:

Alter DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Alter DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
SHUTDOWN IMMEDIATE;
STARTUP;


Register missing archive log file
Find archive log gap by query:

SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

register using:
ALTER DATABASE REGISTER PHYSICAL LOGFILE 'filespec1';



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/317003/viewspace-591830/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-08-30

  • 博文量
    32
  • 访问量
    35344