alter database commit to switchover to physical standby with session shutdown; shutdown immediate; startup nomount; alter database mount standby database; SQL> select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v$database; NAME OPEN_MODE PROTECTION_MODE DATABASE_ROLE --------- ---------- -------------------- ---------------- SKYCARD MOUNTED MAXIMUM PERFORMANCE PHYSICAL STANDBY SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; Database altered.
SQL> create table test_tf (id integer ,remark varchar2(32)); Table created. SQL> insert into test_tf values (1,'tf'); 1 row created. SQL> commit; Commit complete. SQL> select * from test_tf; ID REMARK ---------- -------------------------------- 1 tf SQL> alter system switch logfile; System altered. --从库上验证 SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; Database altered. SQL> alter database open read only; Database altered. SQL> select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v$database; NAME OPEN_MODE PROTECTION_MODE DATABASE_ROLE --------- ---------- -------------------- ---------------- SKYCARD READ ONLY MAXIMUM PERFORMANCE PHYSICAL STANDBY SQL> select * from test_tf; ID REMARK ---------- -------------------------------- 1 tf
数据已经过来,测试成功。
测试二,在主库上新建表空间
1 2 3 4 5 6 7 8 9 10 11 12 13 14
SQL> select name from v$tablespace; NAME ------------------------------ SYSTEM UNDOTBS1 SYSAUX USERS TEMP TS_SKYCARD TS_TEST_02 SQL> create tablespace ts_test_03 datafile '/opt/oradata/skycard/ts_skyts_test_03.dbf' size 20M autoextend off; Tablespace created. SQL> alter system switch logfile; System altered.
备库日志情况
1 2 3 4 5 6 7 8 9 10 11
Thu Dec 1610:38:292010 RFS[1]: Archived Log: '/opt/oracle/archive/skycard/1_33_737391288.dbf' Primary database isin MAXIMUM PERFORMANCE mode Thu Dec 1610:38:342010 Media Recovery Log /opt/oracle/archive/skycard/1_33_737391288.dbf WARNING: File being created with same nameasin Primary Existing file may be overwritten Recovery created file /opt/oradata/skycard/ts_skyts_test_03.dbf Successfully added datafile 7to media recovery Datafile #7: '/opt/oradata/skycard/ts_skyts_test_03.dbf' Media Recovery Waiting for thread 1 sequence 34 (in transit)
到备库上验证一下
1 2 3 4 5 6 7 8 9 10 11 12
SQL> select name from v$tablespace; NAME ------------------------------ SYSTEM UNDOTBS1 SYSAUX USERS TEMP TS_SKYCARD TS_TEST_02 TS_TEST_03 8 rows selected.
When the LGWR and ASYNC attributes are specified, the log writer process writes to the local online redo log file, while the network server (LNSn) processes (one for each destination) asynchronously transmit the redo to remote destinations. The LGWR process continues processing the next request without waiting for the LNS network I/O to complete. If redo transport services transmit redo data to multiple remote destinations, the LNSn processes (one for each destination) initiate the network I/O to all of the destinations in parallel. When an online redo log file fills up, a log switch occurs and an archiver process archives the log file locally, as usual. ARC0 process: ARC0 process archives the local online redo log to the local destination (LOG_ARCHIVE_DEST_1)。
ARC1 process: transmits redo from the local archived redo log files (instead of the online redo log files) to the remote standby destination (LOG_ARCHIVE_DEST_2).
RFS:the remote file server process receives redo data over the network from the LGWR process and writes the redo data to the standby redo log files
MRP: Redo Apply process apply the redo to the standby database