Oracle 11g R2 ADG 營運

來源:互聯網
上載者:User

標籤:ima   acl   date   base   least   使用   syn   sum   action   

--================ Oracle ADG 營運 ================


--========測試日誌傳輸========

1.在primary上,查看最後歸檔的日誌,強制日誌切換

ALTER SESSION SET nls_date_format=‘DD-MON-YYYY HH24:MI:SS‘;

SELECT sequence#, first_time, next_time
FROM?? v$archived_log
ORDER BY sequence#;

ALTER SYSTEM SWITCH LOGFILE;

2.在standby上,查看新歸檔的日誌已經到達standby,並應用。

ALTER SESSION SET nls_date_format=‘DD-MON-YYYY HH24:MI:SS‘;

SELECT sequence#, first_time, next_time, applied
FROM?? v$archived_log
ORDER BY sequence#;


--=========保護模式==========

primary database有三種保護模式:
???? 【Maximum availability】
???? Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If no standby location is available, it acts in the same manner as maximum performance mode until a standby becomes available again.

??? 【Maximum Performance】
???? Transactions on the primary commit as soon as redo information has been written to the online redo log. Transfer of redo information to the standby server is asynchronous, so it does not impact on performance of the primary.

??? 【Maximum Protection】
???? Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If not suitable standby location is available, the primary database shuts down.

預設,對於一個新建立的standby database,primary database是maximum performance模式。
select protection_mode from v$database;

可以使用以下命令切換。

-- Maximum Availability.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;

-- Maximum Performance.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;

-- Maximum Protection.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
ALTER DATABASE OPEN;


--========Switchover========

primary和standby切換角色,而不遺失資料或者reset of redo logs。

--在primary上執行以下命令

-- Convert primary database to standby
CONNECT / AS SYSDBA
ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;

-- Shutdown primary database
SHUTDOWN IMMEDIATE;

-- Mount old primary database as standby database
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

--在standby上執行以下命令

-- Convert standby database to primary
CONNECT / AS SYSDBA
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

-- Shutdown standby database
SHUTDOWN IMMEDIATE;

-- Open old standby database as primary
STARTUP;

完成後,像之前一樣測試日誌傳輸。如果都工作正常,可實施另一個switchover,也叫做switchback,將primary database切換回原來伺服器。


--============Failover=============

如果primary database不可用,standby database可以使用如下語句啟用為primary。
## alter database recover managed standby database finish force;
## alter database commit to switchover to primary;
## alter database open;

-- Note:Oracle Corporation recommends that you perform a failover operation
-- using the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement
-- with the FINISH or FINISH SKIP keywords rather than a forced failover operation whenever possible.
-- A forced failover operation renders other standby databases that
-- are not participating in the failover operation
-- unusable as standby databases to the newly activated primary database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

-- This statement performs a forced failover operation,
-- in which the primary database is removed from the Data Guard environment and
-- a standby database assumes the primary database role.
-- The standby database must be mounted before it can be activated with this statement.
ALTER DATABASE ACTIVATE STANDBY DATABASE;

因為standby database現在是primary database,應該立即備份。

原來的primary database等故障恢複後,可以配置為standby。


--===========DG Gap手動同步=============

select process,sequence#,status from v$managed_standby;
select * from v$archive_gap;
select sequence#,applied from v$archived_log order by sequence#;
select name from v$archived_log where thread#=1 and dest_id=1 and sequence# between 7 and 10;

scp *4* [email protected]:/data/ora11g/archivelog

--單個檔案註冊
alter database register logfile ‘/data/ora11g/archivelog/arch_1_41_830282966.log‘;

select max(sequence#) from v$archived_log;

--多個檔案註冊
scp gap* [email protected]:/data/ora11g/archivelog/
rman target /
catalog start with ‘/data/ora11g/archivelog/‘;

Oracle 11g R2 ADG 營運

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.