环境:
2个节点的RAC
数据库版本:12.1.0.2.0
目的:
启动归档日志,同时将归档日志存放到共享目录(我这里的是ASM磁盘组)
操作:
1、创建共享ASM磁盘组
C:\Users\Administrator>set ORACLE_HOME=E:\app\oraclehome\grid
C:\Users\Administrator>set ORACLE_SID=+ASM1
C:\Users\Administrator>asmcmd
ASMCMD> ls
DATA/
FRA/
OCR/
ASMCMD> cd fra
ASMCMD> pwd
+fra
ASMCMD> mkdir jiaxundb1
ASMCMD> mkdir jiaxundb2
ASMCMD> ls
jiaxundb1/
jiaxundb2/
2、查看目前数据库归档模式
C:\Users\Administrator>sqlplus / as sysdba
sql*Plus: Release 12.1.0.2.0 Production on 星期三 8月 17 15:15:45 2016
Copyright (c) 1982,2014,Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning,Real Application Clusters,Automatic Storage Management,OLAP,
Advanced Analytics and Real Application Testing options
sql> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 89
Current log sequence 90
sql>
3、设置归档格式以及归档目的地
sql> alter system set log_archive_format='%t_%s_%r.arch' scope=spfile sid='*';
System altered.
sql> alter system set log_archive_dest_1='location=+fra/arch/jiaxundb1' scope=spfile sid='jiaxundb1';
System altered.
sql> alter system set log_archive_dest_1='location=+fra/arch/jiaxundb2' scope=spfile sid='jiaxundb2';
System altered.
4、关闭所有实例
C:\Users\Administrator>srvctl stop database -d jiaxundb
5、将实例1启动到Mount阶段,并设置数据库为归档模式
C:\Users\Administrator>sqlplus / as sysdba
sql*Plus: Release 12.1.0.2.0 Production on 星期三 8月 17 15:27:20 2016
Copyright (c) 1982,Oracle. All rights reserved.
Connected to an idle instance.
sql> startup mount
ORACLE instance started.
Total System Global Area 1677721600 bytes
Fixed Size 3046368 bytes
Variable Size 1056965664 bytes
Database Buffers 603979776 bytes
Redo Buffers 13729792 bytes
Database mounted.
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 +FRA/arch/jiaxundb1
Oldest online log sequence 89
Next log sequence to archive 90
Current log sequence 90
sql>
6、启动实例2,查看数据库归档模式是否正确
C:\Users\Administrator>sqlplus / as sysdba
sql*Plus: Release 12.1.0.2.0 Production on 星期三 8月 17 15:35:30 2016
Copyright (c) 1982,
Advanced Analytics and Real Application Testing options
sql> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA/arch/jiaxundb2
Oldest online log sequence 76
Next log sequence to archive 77
Current log sequence 77
sql>
7、切换日志组,验证日志是否被成功归档
sql> alter system archive log current;
System altered.
ASMCMD> ls jiaxundb1
1_90_914678682.arch
1_91_914678682.arch
ASMCMD> ls jiaxundb2
2_77_914678682.arch
2_78_914678682.arch
OK,实例1和实例2已成功归档。
原文链接:https://www.f2er.com/oracle/213037.html