Oracle 更改归档文件到ASM磁盘
2019/03/19 20:39:56 来源:Linux社区 作者:kingle-study

01,配置磁盘路径

  📁 ,nide1节点

[oracle@node1 ~]$ su - grid
Password:
[grid@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 11 11:10:38 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
OCR_VOTE
ORADATA01
ORADATA02

SQL> alter diskgroup ORADATA01 add directory '+ORADATA01/arch1';

Diskgroup altered.

  📂,node2节点

[oracle@node2 ~]$ su - grid
Password:
[grid@node2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 11 11:10:38 2019

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select name from v$asm_diskgroup;

NAME
------------------------------
OCR_VOTE
ORADATA01
ORADATA02

SQL> alter diskgroup ORADATA01 add directory '+ORADATA01/arch2';

Diskgroup altered.

02,设置归档地址

  登入节点一:node1

[grid@node1 ~]$ su - oracle
Password:
[oracle@node1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 11 11:09:48 2019

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


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

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
oracle1

SQL> archive log list;
Database log mode          No Archive Mode
Automatic archival          Disabled
Archive destination          /oracle/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence    61
Current log sequence          62
SQL> alter system set log_archive_dest_1='LOCATION=+ORADATA01/arch1' scope=spfile sid='oracle1';

System altered.

SQL> alter system set log_archive_dest_1='LOCATION=+ORADATA01/arch2' scope=spfile sid='oracle2';
System altered.

03,重启node1,node2节点并更改为归档模式

  node1:

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size            2255832 bytes
Variable Size          738198568 bytes
Database Buffers    1761607680 bytes
Redo Buffers            3276800 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup  -- 启动
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size            2255832 bytes
Variable Size          738198568 bytes
Database Buffers    1761607680 bytes
Redo Buffers            3276800 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode          Archive Mode
Automatic archival          Enabled
Archive destination          +ORADATA01/arch1
Oldest online log sequence    61
Next log sequence to archive  62
Current log sequence          62
SQL> alter system switch logfile;  --- 刷写日志
 
System altered.

  node2:

SQL> archive log list;
Database log mode          No Archive Mode
Automatic archival          Disabled
Archive destination          /oracle/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence    5
Current log sequence          6
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size            2255832 bytes
Variable Size          738198568 bytes
Database Buffers    1761607680 bytes
Redo Buffers            3276800 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 2505338880 bytes
Fixed Size            2255832 bytes
Variable Size          738198568 bytes
Database Buffers    1761607680 bytes
Redo Buffers            3276800 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode          Archive Mode
Automatic archival          Enabled
Archive destination          +ORADATA01/arch2
Oldest online log sequence    6
Next log sequence to archive  7
Current log sequence          7
SQL> alter system switch logfile;

System altered.

04,验证归档

[oracle@node2 ~]$ su - grid
Password:
[grid@node2 ~]$ asmcmd
ASMCMD> ls
OCR_VOTE/
ORADATA01/
ORADATA02/
ASMCMD> cd ORADATA01
ASMCMD> ls
ORACLE/
arch1/
arch2/
ASMCMD> cd arch2
ASMCMD> ls
2_7_1002129034.dbf
ASMCMD> cd ../
ASMCMD> cd arch1
ASMCMD> ls
1_62_1002129034.dbf
2_6_1002129034.dbf
ASMCMD> exit

发现已经有文档了

更多Oracle相关信息见Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2019-03/157581.htm


7

本栏最新