Oracle RAC 11g 修改归档模式

[root@racnode1 ~]# su - oracle
[oracle@racnode1 ~]$ srvctl stop database -d RACDB    -----可以在open状态直接去修改参数文件,不必关库
[oracle@racnode1 ~]$ cd $ORACLE_BASE
[oracle@racnode1 oracle]$ pwd
/u01/app/oracle
[oracle@racnode1 oracle]$ mkdir archivelog            -----归档日志存放在本地

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/archivelog' scope=spfile sid='RACDB_1';  

SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/oracle/archivelog' scope=spfile sid='RACDB_2';

SQL> shutdown immediate

SQL> startup mount

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            /u01/app/oracle/archivelog
Oldest online log sequence     147
Next log sequence to archive   148
Current log sequence           148
SQL> alter system switch logfile;

System altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/oracle/archivelog
Oldest online log sequence     148
Next log sequence to archive   149
Current log sequence           149

[oracle@racnode1 ~]$ cd /u01/app/oracle/archivelog/
[oracle@racnode1 archivelog]$ ll
total 4044
-rw-r----- 1 oracle asmadmin 2260480 Aug 23 15:21 1_148_885898750.dbf

 
 
 
 
------------------------------------将归档日志存放在ASM共享存储中
 
 
[root@racnode1 ~]# 
[root@racnode1 ~]# su - grid
[grid@racnode1 ~]$ sqlplus / as sysasm

SQL> select NAME,TOTAL_MB,FREE_MB from v$asm_diskgroup;

NAME                             TOTAL_MB    FREE_MB
------------------------------ ---------- ----------
DATADG                              20480      10536
GRIDDG                               6144       5218


[grid@racnode1 ~]$ asmcmd
ASMCMD> ls
DATADG/
GRIDDG/
ASMCMD> ls -l
State    Type    Rebal  Name
MOUNTED  NORMAL  N      DATADG/
MOUNTED  NORMAL  N      GRIDDG/
ASMCMD> cd DATADG
ASMCMD> ls -l
Type  Redund  Striped  Time             Sys  Name
                                        Y    RACDB/
ASMCMD> cd RACDB
ASMCMD> ls -l                                                          ---------控制文件和日志文件,存放的不是真正的文件,而是软链接
Type           Redund  Striped  Time             Sys  Name
                                                 Y    CONTROLFILE/
                                                 Y    DATAFILE/
                                                 Y    ONLINELOG/
                                                 Y    PARAMETERFILE/
                                                 Y    TEMPFILE/
                                                 N    control01.ctl => +DATADG/RACDB/CONTROLFILE/Current.256.885898755
                                                 N    control02.ctl => +DATADG/RACDB/CONTROLFILE/Current.257.885898757
                                                 N    redo01.log => +DATADG/RACDB/ONLINELOG/group_1.258.885898757
                                                 N    redo02.log => +DATADG/RACDB/ONLINELOG/group_2.259.885898763
                                                 N    redo03.log => +DATADG/RACDB/ONLINELOG/group_3.266.885902827
                                                 N    redo04.log => +DATADG/RACDB/ONLINELOG/group_4.267.885902829
                                                 N    spfileRACDB.ora => +DATADG/RACDB/PARAMETERFILE/spfile.268.885902833

ASMCMD> cd ..
ASMCMD> ls
RACDB/
ASMCMD> pwd
+DATADG
ASMCMD> exit
[grid@racnode1 ~]$ sqlplus / as sysasm

SQL> alter diskgroup DATADG add directory '+DATADG/ARCH';            -----ASM中创建文件夹。一个节点上创建,另外节点也可以看到并访问。不演示
Diskgroup altered.

SQL> exit

[grid@racnode1 ~]$ asmcmd
ASMCMD> ls
DATADG/
GRIDDG/
ASMCMD> cd DATADG 
ASMCMD> ls
ARCH/
RACDB/
ASMCMD> exit
[grid@racnode1 ~]$ su - oracle
Password: 
[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+DATADG/ARCH' scope=both;      ------不加sid选项,代表sid=*。不同节点的归档放在同一个目录。也可以放在不                                                                                        同的目录,只需要再ASM中创建不同的目录,然后运行两次此命令,将不同                                                                                         节点的归档路径指向不同位置即可。</span>

System altered.

SQL> show parameter LOG_ARCHIVE_DEST_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string      LOCATION=+DATADG/ARCH
log_archive_dest_10                  string
log_archive_dest_11                  string
................................
SQL> archive log list;                                                              ------在另外节点查询,设置也已经生效。
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            +DATADG/arch
Oldest online log sequence     152
Next log sequence to archive   153
Current log sequence           153
SQL> alter system switch logfile;

System altered.

SQL> exit

[oracle@racnode1 ~]$ exit
logout
[grid@racnode1 ~]$ asmcmd
ASMCMD> ls
DATADG/
GRIDDG/
ASMCMD> cd DATADG/
ASMCMD> ls
ARCH/
RACDB/
ASMCMD> cd ARCH
ASMCMD> ls
1_153_885898750.dbf
ASMCMD> ls                                                                                ------在另外节点切换日志
1_153_885898750.dbf
2_53_885898750.dbf
ASMCMD> exit


你可能感兴趣的:(Oracle RAC 11g 修改归档模式)