当前位置:Gxlcms > mysql > log_archive_dest_n和standby_archive_dest

log_archive_dest_n和standby_archive_dest

时间:2021-07-01 10:21:17 帮助过:26人阅读

今天查看资料,对log_archive_dest_n和standby_archive_dest的关系有点模糊了,做个简单的测试,缕清关系、加深记忆。 首先看一下我们的实验环境,10grac,双节点:node1和node2 SQL host hostnamenode1SQL select * from v$version;BANNER------------------

今天查看资料,对log_archive_dest_n和standby_archive_dest的关系有点模糊了,做个简单的测试,缕清关系、加深记忆。

首先看一下我们的实验环境,10grac,双节点:node1和node2

SQL> host hostname
node1

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE	10.2.0.1.0	Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

SQL> show parameter archvie;
SQL> show parameter archvie
SQL> show parameter archive

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target		     integer	 0
log_archive_config		     string
log_archive_dest		     string
log_archive_dest_1		     string	 location=/home/oracle/11
log_archive_dest_10		     string
log_archive_dest_2		     string	 service=racdb2
log_archive_dest_3		     string
log_archive_dest_4		     string
log_archive_dest_5		     string
log_archive_dest_6		     string
log_archive_dest_7		     string

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_8		     string
log_archive_dest_9		     string
log_archive_dest_state_1	     string	 enable
log_archive_dest_state_10	     string	 enable
log_archive_dest_state_2	     string	 enable
log_archive_dest_state_3	     string	 enable
log_archive_dest_state_4	     string	 enable
log_archive_dest_state_5	     string	 enable
log_archive_dest_state_6	     string	 enable
log_archive_dest_state_7	     string	 enable
log_archive_dest_state_8	     string	 enable

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_9	     string	 enable
log_archive_duplex_dest 	     string
log_archive_format		     string	 %t_%s_%r.dbf
log_archive_local_first 	     boolean	 TRUE
log_archive_max_processes	     integer	 2
log_archive_min_succeed_dest	     integer	 1
log_archive_start		     boolean	 FALSE
log_archive_trace		     integer	 0
remote_archive_enable		     string	 true
standby_archive_dest		     string	 ?/dbs/arch

SQL> host clear

SQL> host hostname
node2

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE	10.2.0.1.0	Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

SQL> show parameter archive

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target		     integer	 0
log_archive_config		     string
log_archive_dest		     string
log_archive_dest_1		     string	 location=/home/oracle/21
log_archive_dest_10		     string
log_archive_dest_2		     string	 service=racdb1
log_archive_dest_3		     string	 LOCATION=/home/oracle/22 VALID
						 _FOR=(standby_logfiles, all_ro
						 les)
log_archive_dest_4		     string
log_archive_dest_5		     string

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_6		     string
log_archive_dest_7		     string
log_archive_dest_8		     string
log_archive_dest_9		     string
log_archive_dest_state_1	     string	 enable
log_archive_dest_state_10	     string	 enable
log_archive_dest_state_2	     string	 enable
log_archive_dest_state_3	     string	 enable
log_archive_dest_state_4	     string	 enable
log_archive_dest_state_5	     string	 enable
log_archive_dest_state_6	     string	 enable

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_7	     string	 enable
log_archive_dest_state_8	     string	 enable
log_archive_dest_state_9	     string	 enable
log_archive_duplex_dest 	     string
log_archive_format		     string	 %t_%s_%r.dbf
log_archive_local_first 	     boolean	 TRUE
log_archive_max_processes	     integer	 2
log_archive_min_succeed_dest	     integer	 1
log_archive_start		     boolean	 FALSE
log_archive_trace		     integer	 0
remote_archive_enable		     string	 true

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest		     string	 ?/dbs/arch
在node1下执行如下命令:alter system archive log current;
SQL> alter system archive log current;

System altered.

SQL> 
在节点2下,查看
[oracle@node2 ~]$ cd 22
[oracle@node2 22]$ ll
total 852
-rw-r----- 1 oracle oinstall 854528 Jul  7 15:09 1_70_790532232.dbf
-rw-r----- 1 oracle oinstall   8704 Jul  7 15:11 1_71_790532232.dbf
[oracle@node2 22]$ cd ..
[oracle@node2 ~]$ cd 21
[oracle@node2 21]$ ll
total 836
-rw-r----- 1 oracle oinstall 846848 Jul  7 15:09 2_52_790532232.dbf
-rw-r----- 1 oracle oinstall   3072 Jul  7 15:11 2_53_790532232.dbf
[oracle@node2 21]$ cd $ORACLE_HOME/dbs
[oracle@node2 dbs]$ ll
total 44
-rw-rw---- 1 oracle oinstall  1552 Jul  7 15:07 hc_racdb2.dat
-rw-r----- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r----- 1 oracle oinstall    24 Aug  5  2012 initracdb2.ora
-rw-r----- 1 oracle oinstall  1536 Aug  5  2012 orapwracdb2
-rw-r----- 1 oracle oinstall  1536 Jul  7 15:07 spfileracdb2.ora
在节点2上设置standby_archvie_dest
SQL> alter system set standby_archive_dest='/home/oracle/33' sid='racdb2';

System altered.
在节点1,归档
SQL> alter system archive log current;

System altered.
查看节点2
[oracle@node2 ~]$ cd 33
[oracle@node2 33]$ ll
total 4
-rw-r----- 1 oracle oinstall 2048 Jul  7 15:14 1_72_790532232.dbf
[oracle@node2 33]$ cd ../22
[oracle@node2 22]$ ll
total 852
-rw-r----- 1 oracle oinstall 854528 Jul  7 15:09 1_70_790532232.dbf
-rw-r----- 1 oracle oinstall   8704 Jul  7 15:11 1_71_790532232.dbf
[oracle@node2 22]$ 
结论:

在没有设置standby_archvie_Dest的情况下,数据库会将归档放置在standby数据库的log_Archive_dest_n指定的目录下,如果指定了STANDBY_ARCHIVE_DEST则存放在standby_archive_Dest指定的目录下。

人气教程排行