130531修改RAC归档模式

修改rac归档模式,按照事先规划的excel表中所描述:

dbs的/etc/fstab:

/dev/sdc3 /wxxrdb2_arch ext3 default 1 2
/dev/sdd3 /wxxrdb1_arch ext3 default 1 2


dbp的/etc/fstab:

/dev/sdc2 /wxxrdb1_arch ext3 default 1 2
/dev/sdd2 /wxxrdb2_arch ext3 default 1 2


dbp上执行

[root@dbp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             7.7G  2.8G  4.6G  38% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda5             8.0G  3.8G  3.9G  50% /oracle
[root@dbp ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1033     8193150   83  Linux
/dev/sda3            1034        1555     4192965   82  Linux swap
/dev/sda4            1556        2610     8474287+   5  Extended
/dev/sda5            1556        2610     8474256   83  Linux

Disk /dev/sdb: 524 MB, 524288000 bytes
255 heads, 63 sectors/track, 63 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          19      152586   83  Linux
/dev/sdb2              20          38      152617+  83  Linux

Disk /dev/sdc: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        7296    58605088+  83  Linux
/dev/sdc2            7297        9729    19543072+  83  Linux
/dev/sdc3            9730       12162    19543072+  83  Linux

Disk /dev/sdd: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        7296    58605088+  83  Linux
/dev/sdd2            7297        9729    19543072+  83  Linux
/dev/sdd3            9730       12162    19543072+  83  Linux

修改/etc/fstab文件:


格式化磁盘,分区格式ext3,创建挂载点,并且进行挂载;
[root@dbp ~]# mkfs.ext3 -j /dev/sdc2
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2443200 inodes, 4885768 blocks
244288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
150 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@dbp ~]# mkfs.ext3 -j /dev/sdd2
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2443200 inodes, 4885768 blocks
244288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
150 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@dbp ~]# mkdir /wxxrdb1_arch
[root@dbp ~]# mkdir /wxxrdb2_arch
[root@dbp ~]# mount /wxxrdb1_arch/
[root@dbp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             7.7G  2.8G  4.6G  38% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda5             8.0G  3.8G  3.9G  50% /oracle
/dev/sdc2              19G   76M   18G   1% /wxxrdb1_arch
[root@dbp ~]# mount /wxxrdb2_arch/
[root@dbp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             7.7G  2.8G  4.6G  38% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda5             8.0G  3.8G  3.9G  50% /oracle
/dev/sdc2              19G   76M   18G   1% /wxxrdb1_arch
/dev/sdd2              19G   76M   18G   1% /wxxrdb2_arch
[root@dbp ~]# chown -R oracle.dba /wxxrdb*
[root@dbp ~]# ll /wxxrdb
ls: /wxxrdb: No such file or directory
[root@dbp ~]# ll /wxxrdb*
/wxxrdb1_arch:
total 16
drwx------  2 oracle dba 16384 Jun  1 13:12 lost+found

/wxxrdb2_arch:
total 16
drwx------  2 oracle dba 16384 Jun  1 13:12 lost+found

在DBS上修改/etc/fstab文件,格盘,创建挂载点,并且进行挂载;
[root@dbs ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             7.7G  2.8G  4.6G  38% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda5             8.0G  2.6G  5.0G  34% /oracle
[root@dbs ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1033     8193150   83  Linux
/dev/sda3            1034        1555     4192965   82  Linux swap
/dev/sda4            1556        2610     8474287+   5  Extended
/dev/sda5            1556        2610     8474256   83  Linux

Disk /dev/sdb: 524 MB, 524288000 bytes
255 heads, 63 sectors/track, 63 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          19      152586   83  Linux
/dev/sdb2              20          38      152617+  83  Linux

Disk /dev/sdc: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        7296    58605088+  83  Linux
/dev/sdc2            7297        9729    19543072+  83  Linux
/dev/sdc3            9730       12162    19543072+  83  Linux

Disk /dev/sdd: 104.8 GB, 104857600000 bytes
255 heads, 63 sectors/track, 12748 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        7296    58605088+  83  Linux
/dev/sdd2            7297        9729    19543072+  83  Linux
/dev/sdd3            9730       12162    19543072+  83  Linux

[root@dbs ~]# cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/oracle           /oracle                 ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=SWAP-sda3         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,exec,noauto,managed 0 0
/dev/sdc3               /wxxrdb2_arch           ext3    defaults        1 2
/dev/sdd3               /wxxrdb1_arch           ext3    defaults        1 2

[root@dbs ~]# mkfs.ext3 /dev/sdc3 -j
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2443200 inodes, 4885768 blocks
244288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
150 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@dbs ~]# mkfs.ext3 /dev/sdd3 -j
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2443200 inodes, 4885768 blocks
244288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
150 block groups
32768 blocks per group, 32768 fragments per group
16288 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@dbs ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             7.7G  2.8G  4.6G  38% /
/dev/sda1              99M  9.5M   85M  11% /boot
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sda5             8.0G  2.6G  5.0G  34% /oracle
/dev/sdd3              19G   76M   18G   1% /wxxrdb1_arch
/dev/sdc3              19G   76M   18G   1% /wxxrdb2_arch

[root@dbs ~]# chown -R oracle.dba /wxxrdb*
[root@dbs ~]# ll /wxxrdb*
/wxxrdb1_arch:
total 16
drwx------  2 oracle dba 16384 Jun  1 13:18 lost+found

/wxxrdb2_arch:
total 16
drwx------  2 oracle dba 16384 Jun  1 13:17 lost+found

配置每个数据库的归档位置,直接在DBP上执行即可:

[root@dbp ~]# su - oracle
[oracle@dbp ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jun 1 13:19:52 2013

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options


SQL> alter system set log_archive_dest_1='location=/wxxrdb2_arch' scope=spfile sid='wxxrdb2';

System altered.

SQL> alter system set log_archive_dest_2='service=wxxrdb1' scope=spfile sid='wxxrdb2';

System altered.

SQL> alter system set log_archive_dest_1='location=/wxxrdb1_arch' scope=spfile sid='wxxrdb1';

System altered.

SQL> alter system set log_archive_dest_2='service=wxxrdb2' scope=spfile sid='wxxrdb1';

System altered.


SQL> alter system set standby_archive_dest='/wxxrdb2_arch' scope=spfile sid='wxxrdb1';

System altered.

SQL> alter system set standby_archive_dest='/wxxrdb1_arch' scope=spfile sid='wxxrdb2';

System altered.

SQL> alter system set cluster_database=false scope=spfile sid='*';

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

在DBS上,只关闭数据库实例即可;


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

切换到DBP实例,启动到mount状态,修改数据库的归档模式,并且将cluster_database开启(需要重新启动数据库)

SQL> startup mount;
ORACLE instance started.

Total System Global Area  771751936 bytes
Fixed Size                  2023944 bytes
Variable Size             314576376 bytes
Database Buffers          452984832 bytes
Redo Buffers                2166784 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /wxxrdb1_arch
Oldest online log sequence     26
Next log sequence to archive   27
Current log sequence           27

切换到DBS上,启动到mount状态,修改数据库的归档模式,并且将cluster_database开启(需要重新启动数据库)
SQL> startup mount;
ORACLE instance started.

Total System Global Area  771751936 bytes
Fixed Size                  2023944 bytes
Variable Size             268439032 bytes
Database Buffers          499122176 bytes
Redo Buffers                2166784 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode


SQL> shutdown immediate;
ORA-01507: database not mounted


遇到错误,因为DBP还在启动,并且没有开启cluster_database模式,所以DBP独占了数据文件,
将DBS数据库停掉后,将DBS启动到mount模式;

SQL> startup mount;
ORACLE instance started.

Total System Global Area  771751936 bytes
Fixed Size                  2023944 bytes
Variable Size             268439032 bytes
Database Buffers          499122176 bytes
Redo Buffers                2166784 bytes
Database mounted.
SQL> alter database archivelog ;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /wxxrdb2_arch
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL> alter system set cluster_database=true scope=spfile sid='*';

System altered.

关闭DBS,其次重启开启DBP和DBS数据库;
DBS:
SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
DBP:
SQL> startup;
ORACLE instance started.

Total System Global Area  771751936 bytes
Fixed Size                  2023944 bytes
Variable Size             314576376 bytes
Database Buffers          452984832 bytes
Redo Buffers                2166784 bytes
Database mounted.
Database opened.

DBS:
SQL> startup;
ORACLE instance started.

Total System Global Area  771751936 bytes
Fixed Size                  2023944 bytes
Variable Size             268439032 bytes
Database Buffers          499122176 bytes
Redo Buffers                2166784 bytes
Database mounted.
Database opened.

成功,最后重新检查参数:
DBP:

SQL> show parameter log_archive_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest                     string
log_archive_dest_1                   string      location=/wxxrdb1_arch
log_archive_dest_10                  string
log_archive_dest_2                   string      service=wxxrdb2
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_1             string      enable
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
SQL> show parameter standby_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest                 string      /wxxrdb2_arch


在DBP上执行,switch logfile 看DBS能否收到
SQL> alter system switch logfile;

System altered.

/wxxrdb1_arch:
total 35676
-rw-r-----  1 oracle dba  2336768 Jun  1 13:41 1_27_812152577.dbf
-rw-r-----  1 oracle dba 34128896 Jun  1 13:38 2_2_812152577.dbf
drwx------  2 oracle dba    16384 Jun  1 13:12 lost+found

/wxxrdb2_arch:
total 92
-rw-r-----  1 oracle dba 71168 Jun  1 13:41 2_3_812152577.dbf
drwx------  2 oracle dba 16384 Jun  1 13:12 lost+found
[oracle@dbp wxxrdb1_arch]$

在DBS上检查:
[oracle@dbs ~]$ ll /wxxrdb*
/wxxrdb1_arch:
total 16
drwx------  2 oracle dba 16384 Jun  1 13:18 lost+found

/wxxrdb2_arch:
total 92
-rw-r-----  1 oracle dba 71168 Jun  1 13:41 2_3_812152577.dbf
drwx------  2 oracle dba 16384 Jun  1 13:17 lost+found

 

 


DBS:
SQL> show parameter log_archive_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest                     string
log_archive_dest_1                   string      location=/wxxrdb2_arch
log_archive_dest_10                  string
log_archive_dest_2                   string      service=wxxrdb1
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_1             string      enable
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
SQL> show parameter standby_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest                 string      /wxxrdb1_arch

在DBS上执行,switch logfile 看DBP能否收到

SQL> alter system switch logfile;

System altered.

DBS上:
[oracle@dbs ~]$ ll /wxxrdb*       
/wxxrdb1_arch:
total 236
-rw-r-----  1 oracle dba 218624 Jun  1 13:49 1_28_812152577.dbf
drwx------  2 oracle dba  16384 Jun  1 13:18 lost+found

/wxxrdb2_arch:
total 244
-rw-r-----  1 oracle dba 71168 Jun  1 13:41 2_3_812152577.dbf
-rw-r-----  1 oracle dba 65024 Jun  1 13:44 2_4_812152577.dbf
-rw-r-----  1 oracle dba 81408 Jun  1 13:49 2_5_812152577.dbf
drwx------  2 oracle dba 16384 Jun  1 13:17 lost+found


DBP上:
-rw-r-----  1 oracle dba  2336768 Jun  1 13:41 1_27_812152577.dbf
-rw-r-----  1 oracle dba   218624 Jun  1 13:49 1_28_812152577.dbf
-rw-r-----  1 oracle dba 34128896 Jun  1 13:38 2_2_812152577.dbf
drwx------  2 oracle dba    16384 Jun  1 13:12 lost+found

/wxxrdb2_arch:
total 244
-rw-r-----  1 oracle dba 71168 Jun  1 13:41 2_3_812152577.dbf
-rw-r-----  1 oracle dba 65024 Jun  1 13:44 2_4_812152577.dbf
-rw-r-----  1 oracle dba 81408 Jun  1 13:49 2_5_812152577.dbf
drwx------  2 oracle dba 16384 Jun  1 13:12 lost+found

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值