君子只怕阅读答案:Oracle 10gR2 RAC+ASM 归档设置示例

来源:百度文库 编辑:偶看新闻 时间:2024/04/29 19:46:13
从Oracle 10gR2开始,对于RAC数据库设置归档模式非常方便,只需要在其中任何一个节点上操作,剩余节点instance关闭即可,下面是一个Oracle 10.2.0.2版本2个节点的RAC数据库打开归档模式的示例,归档存放在FRA磁盘组下的demo目录下第一步:规划目录实例1的归档路径:+FRA/demo/arch1实例2的归档路径:+FRA/demo/arch2[oracle@rac02] /home/oracle> export ORACLE_SID=+ASM2[oracle@rac02] /home/oracle> asmcmdASMCMD> lsDATA/FRA/ASMCMD> cd FRAASMCMD> mkdir demoASMCMD> cd demoASMCMD> mkdir arch1 arch2ASMCMD> ls -ltrType  Redund  Striped  Time             Sys  NameN    arch1/N    arch2/ASMCMD>第二步:关闭实例2 [oracle@rac02] /home/oracle> sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.2.0 - Production on Sat Oct 9 18:07:16 2010Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> exitDisconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining options在节点1上确认实例2已经关闭[oracle@rac01] /home/oracle> crs_stat -tName           Type           Target    State     Host------------------------------------------------------------ora.demo.db    application    ONLINE    ONLINE    rac02ora....o1.inst application    ONLINE    ONLINE    rac01ora....o2.inst application    OFFLINE   OFFLINE        ora....SM1.asm application    ONLINE    ONLINE    rac01ora....01.lsnr application    ONLINE    ONLINE    rac01ora.rac01.gsd  application    ONLINE    ONLINE    rac01ora.rac01.ons  application    ONLINE    ONLINE    rac01ora.rac01.vip  application    ONLINE    ONLINE    rac01ora....SM2.asm application    ONLINE    ONLINE    rac02ora....02.lsnr application    ONLINE    ONLINE    rac02ora.rac02.gsd  application    ONLINE    ONLINE    rac02ora.rac02.ons  application    ONLINE    ONLINE    rac02ora.rac02.vip  application    ONLINE    ONLINE    rac02第三步:设置归档参数在实例1上操作即可[oracle@rac01] /home/oracle> sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.2.0 - Production on Sat Oct 9 18:07:51 2010Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> show parameter cluster_databaseNAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------cluster_database                     boolean     TRUEcluster_database_instances           integer     2SQL> show parameter instance_nameNAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------instance_name                        string      demo1SQL> archive log list;Database log mode              No Archive ModeAutomatic archival             DisabledArchive destination            USE_DB_RECOVERY_FILE_DESTOldest online log sequence     3Current log sequence           4SQL> alter system set log_archive_dest_1='LOCATION=+FRA/demo/arch1' sid='demo1';System altered.SQL> alter system set log_archive_dest_1='LOCATION=+FRA/demo/arch2' sid='demo2';System altered.SQL> show parameter log_archive_dest_1NAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------log_archive_dest_1                   string      LOCATION=+FRA/demo/arch1log_archive_dest_10                  string第四步:打开归档模式继续在实例1上操作SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup mount; ORACLE instance started.Total System Global Area  218103808 bytesFixed Size                  1260032 bytesVariable Size              75499008 bytesDatabase Buffers          138412032 bytesRedo Buffers                2932736 bytesDatabase mounted.SQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            +FRA/demo/arch1Oldest online log sequence     3Next log sequence to archive   4Current log sequence           4SQL>好了,到这里就按照我预先的规划把这个2个节点的RAC数据库打开到归档模式下了,归档文件存放在FRA磁盘组中.第五步:打开剩余实例[oracle@rac01] /home/oracle> crs_stat -tName           Type           Target    State     Host------------------------------------------------------------ora.demo.db    application    ONLINE    ONLINE    rac02ora....o1.inst application    ONLINE    ONLINE    rac01ora....o2.inst application    OFFLINE   OFFLINEora....SM1.asm application    ONLINE    ONLINE    rac01ora....01.lsnr application    ONLINE    ONLINE    rac01ora.rac01.gsd  application    ONLINE    ONLINE    rac01ora.rac01.ons  application    ONLINE    ONLINE    rac01ora.rac01.vip  application    ONLINE    ONLINE    rac01ora....SM2.asm application    ONLINE    ONLINE    rac02ora....02.lsnr application    ONLINE    ONLINE    rac02ora.rac02.gsd  application    ONLINE    ONLINE    rac02ora.rac02.ons  application    ONLINE    ONLINE    rac02ora.rac02.vip  application    ONLINE    ONLINE    rac02[oracle@rac01] /home/oracle> srvctl start instance -d demo -i demo2[oracle@rac01] /home/oracle> crs_stat -tName           Type           Target    State     Host------------------------------------------------------------ora.demo.db    application    ONLINE    ONLINE    rac02ora....o1.inst application    ONLINE    ONLINE    rac01ora....o2.inst application    ONLINE    ONLINE    rac02ora....SM1.asm application    ONLINE    ONLINE    rac01ora....01.lsnr application    ONLINE    ONLINE    rac01ora.rac01.gsd  application    ONLINE    ONLINE    rac01ora.rac01.ons  application    ONLINE    ONLINE    rac01ora.rac01.vip  application    ONLINE    ONLINE    rac01ora....SM2.asm application    ONLINE    ONLINE    rac02ora....02.lsnr application    ONLINE    ONLINE    rac02ora.rac02.gsd  application    ONLINE    ONLINE    rac02ora.rac02.ons  application    ONLINE    ONLINE    rac02ora.rac02.vip  application    ONLINE    ONLINE    rac02[oracle@rac01] /home/oracle>第六步:测试验证[oracle@rac01] /home/oracle> sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.2.0 - Production on Sat Oct 9 18:26:51 2010Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> alter system archive log current;System altered.SQL>
ASMCMD> pwd+FRA/demo/arch1ASMCMD> ls -ltrType        Redund  Striped  Time             Sys  NameN    1_4_731958872.dbf => +FRA/demo/ARCHIVELOG/2010_10_09/thread_1_seq_4.256.731960815ASMCMD> cd ..ASMCMD> cd arch2ASMCMD> ls -ltrType        Redund  Striped  Time             Sys  NameN    2_2_731958872.dbf => +FRA/demo/ARCHIVELOG/2010_10_09/thread_2_seq_2.257.731960817ASMCMD>
[oracle@rac02] /home/oracle> sqlplus "/as sysdba"SQL*Plus: Release 10.2.0.2.0 - Production on Sat Oct 9 18:34:17 2010Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - ProductionWith the Partitioning, Real Application Clusters, OLAP and Data Mining optionsSQL> archive log list;Database log mode              Archive ModeAutomatic archival             EnabledArchive destination            +FRA/demo/arch2Oldest online log sequence     2Next log sequence to archive   3Current log sequence           3SQL>