Oracle 11G RAC开启和关闭归档日志

一、RAC开启归档日志

1.创建归档日志存放目录
[grid@coredb1 ~]$ asmcmd
ASMCMD> cd /
ASMCMD> ls
DATA/
FLASH/
ASMCMD> cd FLASH
ASMCMD> mkdir coredb
ASMCMD> cd coredb
ASMCMD> mkdir arch
ASMCMD> cd arch
ASMCMD> pwd
+FLASH/coredb/arch

2.检测各节点是否开启归档,并设置归档路径
[oracle@coredb1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 29 13:05:24 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence     23
Current log sequence           24

SQL> alter system set log_archive_dest_1='location=+FLASH/coredb/arch' scope=spfile sid='*';  

System altered.

3.关闭集群数据库
[grid@coredb1 ~]$ srvctl stop database -d coredb
[grid@coredb1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    coredb1     
ora.FLASH.dg   ora....up.type ONLINE    ONLINE    coredb1     
ora....ER.lsnr ora....er.type ONLINE    ONLINE    coredb1     
ora....N1.lsnr ora....er.type ONLINE    ONLINE    coredb1     
ora.asm        ora.asm.type   ONLINE    ONLINE    coredb1     
ora.coredb.db  ora....se.type OFFLINE   OFFLINE               
ora....SM1.asm application    ONLINE    ONLINE    coredb1     
ora....B1.lsnr application    ONLINE    ONLINE    coredb1     
ora....db1.gsd application    OFFLINE   OFFLINE               
ora....db1.ons application    ONLINE    ONLINE    coredb1     
ora....db1.vip ora....t1.type ONLINE    ONLINE    coredb1     
ora....SM2.asm application    ONLINE    ONLINE    coredb2     
ora....B2.lsnr application    ONLINE    ONLINE    coredb2     
ora....db2.gsd application    OFFLINE   OFFLINE               
ora....db2.ons application    ONLINE    ONLINE    coredb2     
ora....db2.vip ora....t1.type ONLINE    ONLINE    coredb2     
ora.eons       ora.eons.type  ONLINE    ONLINE    coredb1     
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    coredb1     
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE               
ora.ons        ora.ons.type   ONLINE    ONLINE    coredb1     
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    coredb1 

4.开启归档日志(只需在一个节点进行以下操作)
将一个节点启动到mount状态,在该节点进行以下操作
[grid@coredb1 ~]$ srvctl start instance -d coredb -i coredb1 -o mount
[root@coredb1 ~]# su - oracle
[oracle@coredb1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 29 14:19:58 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list; 
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +FLASH/coredb/arch
Oldest online log sequence     23
Next log sequence to archive   24
Current log sequence           24

5.启动其他节点数据库(目前只有节点2)
[grid@coredb1 ~]$ srvctl start instance -d coredb -i coredb2

二、关闭归档日志

1.关闭数据库集群
[grid@coredb1 ~]$ srvctl stop database -d coredb

2.将一个节点启动到mount状态,在该节点进行以下操作
[grid@coredb1 ~]$ srvctl start instance -d coredb -i coredb1 -o mount
[root@coredb1 ~]# su - oracle
[oracle@coredb1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 29 14:35:41 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>  alter database noarchivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL>  archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            +FLASH/coredb/arch
Oldest online log sequence     26
Current log sequence           27

3.启动其他节点数据库( 目前只有 节点2)
[grid@coredb1 ~]$ srvctl start instance -d coredb -i coredb2

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值