檢查開啟狀態
-- 請全貼
-- ===check===
select dbid,name from v$database;
select
log_mode , OPEN_MODE , DATABASE_ROLE
from v$database;
--DataGuard
select SWITCHOVER_STATUS , PROTECTION_MODE , PROTECTION_LEVEL
from
v$database;
-- ===check===
select dbid,name from v$database;
select
log_mode , OPEN_MODE , DATABASE_ROLE
from v$database;
--DataGuard
select SWITCHOVER_STATUS , PROTECTION_MODE , PROTECTION_LEVEL
from
v$database;
Process 要找 MRP0
SELECT
PROCESS,STATUS,CLIENT_PROCESS,SEQUENCE#, BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
LOG APPLY START
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE USING CURRENT LOGFILE DISCONNECT;
LOG APPLY STOP
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE CANCEL;
4.8 啟動listener on standby server
Standby
lsnrctl start
範列︰
cdTNS
vi listener.ora
===================================================================================
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.221.20)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
===================================================================================
lsnrctl start
範列︰
cdTNS
vi listener.ora
===================================================================================
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.221.20)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
===================================================================================
開始apply
SQL> ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE USING CURRENT LOGFILE DISCONNECT;
ALTER DATABASE RECOVER
MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT
*
ERROR at
line 1:
ORA-38500: USING CURRENT LOGFILE option not available without
stand
出現 ORA-38500 使用以下部驟
4.7.7 Create Standby logfile
先使用下列語法查詢,Primary有幾個online redo log,以及online redo log file的size。
SQL>
select group#,bytes from v$log;
GROUP# BYTES
---------- ----------
1 52428800
3 52428800
2
52428800
SQL>
SQL>
select group#,bytes from v$log;
GROUP# BYTES
---------- ----------
1 52428800
3 52428800
2
52428800
SQL>
使用下列語法新增stnadby logfile,所需standby
logfile數量為Primary
logfile
數+1,size大小與Primary一致,
因上一步驟查詢Primary logfile數為3,size大小為50M,故需新增standby
logfile數量為4,size大小為50M
,紅字部份請依環境進行調整。
[oracle]$
LPATH=/oracle/oradata/redo
mkdir -p
$LPATH
for i in `seq 1 4`
do
echo " alter database add standby
logfile '$LPATH/redo${i}_std.log' size 50M; "
done
alter
database add standby logfile '/oracle/oradata/redo/redo1_std.log' size 50M;
alter database add standby logfile '/oracle/oradata/redo/redo2_std.log' size
50M;
alter database add standby logfile
'/oracle/oradata/redo/redo3_std.log' size 50M;
alter database add standby
logfile '/oracle/oradata/redo/redo4_std.log' size 50M;
LPATH=/oracle/oradata/redo
mkdir -p
$LPATH
for i in `seq 1 4`
do
echo " alter database add standby
logfile '$LPATH/redo${i}_std.log' size 50M; "
done
alter
database add standby logfile '/oracle/oradata/redo/redo1_std.log' size 50M;
alter database add standby logfile '/oracle/oradata/redo/redo2_std.log' size
50M;
alter database add standby logfile
'/oracle/oradata/redo/redo3_std.log' size 50M;
alter database add standby
logfile '/oracle/oradata/redo/redo4_std.log' size 50M;
SQL>
alter database add standby logfile
'/oracle/oradata/redo/redo1_std.log' size 50M;
alter database add standby
logfile '/oracle/oradata/redo/redo2_std.log' size 50M;
alter database add
standby logfile '/oracle/oradata/redo/redo3_std.log' size 50M;
alter
database add standby logfile '/oracle/oradata/redo/redo4_std.log' size 50M;
alter database add standby logfile
'/oracle/oradata/redo/redo1_std.log' size 50M;
alter database add standby
logfile '/oracle/oradata/redo/redo2_std.log' size 50M;
alter database add
standby logfile '/oracle/oradata/redo/redo3_std.log' size 50M;
alter
database add standby logfile '/oracle/oradata/redo/redo4_std.log' size 50M;
重新apply
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE USING CURRENT LOGFILE DISCONNECT;
Database altered.
檢查process
SQL>
SELECT
PROCESS,STATUS,CLIENT_PROCESS,SEQUENCE#, BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
PROCESS STATUS CLIENT_P SEQUENCE# BLOCK#
BLOCKS
--------- ------------ -------- ---------- ---------- ----------
ARCH CONNECTED ARCH 0 0 0
ARCH CONNECTED ARCH 0 0 0
MRP0
WAIT_FOR_GAP N/A 27 0 0
以上紅色有落差
SQL>
select * from v$recovery_log;
THREAD# SEQUENCE# TIME
---------- ---------- ---------
ARCHIVE_NAME
--------------------------------------------------------------------------------
1 27 14-APR-17
/oracle/u01/app/oracle/product/10.2.0/dbs/arch1_27_940991096.dbf
SQL>
SELECT
PROCESS,STATUS,CLIENT_PROCESS,SEQUENCE#, BLOCK#,BLOCKS FROM
V$MANAGED_STANDBY;
PROCESS STATUS CLIENT_P SEQUENCE# BLOCK#
BLOCKS
--------- ------------ -------- ---------- ---------- ----------
ARCH CLOSING ARCH 28 6145 581
ARCH CLOSING ARCH 29 1 22
MRP0
APPLYING_LOG N/A 30 15727 102400
RFS IDLE
UNKNOWN 0 0 0
RFS IDLE LGWR 30 15729 1
以上紅色為正常
4.10.5 開啟檔案自動管理
SQL> alter system set standby_file_management = auto;
SQL> show parameter standby ;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
standby_archive_dest string
?/dbs/arch
standby_file_management string
AUTO
SQL> show parameter standby ;
NAME TYPE VALUE
------------------------------------ -----------
------------------------------
standby_archive_dest string
?/dbs/arch
standby_file_management string
AUTO
4.11 停止Standby database apply
SQL>
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE CANCEL;
ALTER DATABASE RECOVER MANAGED STANDBY
DATABASE CANCEL;
沒有留言:
張貼留言