eygle.com   eygle.com
eygle.com  
 

« September 12, 2004 | Blog首页 | September 16, 2004 »



September 14, 2004

在RAC环境中如何管理日志(redolog file)组

作者:eygle

出处:http://blog.eygle.com

本文简单介绍在RAC裸设备环境下如何管理日志文件(redolog file)

本文环境:Oracle9i Rac + VCS4.0 + VxVM4.0 + Solaris9.0 + SunFire210

1.首先可以查看当前裸设备情况


# vxprint
Disk group: oradg

TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0
dg oradg        oradg        -        -        -        -        -       -

dm oradg01      c2t0d2s2     -        244143872 -       -        -       -

v  ctlfile1     gen          ENABLED  204800   -        ACTIVE   -       -
pl ctlfile1-01  ctlfile1     ENABLED  204800   -        ACTIVE   -       -
sd oradg01-13   ctlfile1-01  ENABLED  204800   0        -        -       -

v  ctlfile2     gen          ENABLED  204800   -        ACTIVE   -       -
pl ctlfile2-01  ctlfile2     ENABLED  204800   -        ACTIVE   -       -
sd oradg01-14   ctlfile2-01  ENABLED  204800   0        -        -       -

v  redo101      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo101-01   redo101      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-04   redo101-01   ENABLED  204800   0        -        -       -

v  redo102      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo102-01   redo102      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-05   redo102-01   ENABLED  204800   0        -        -       -

v  redo103      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo103-01   redo103      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-06   redo103-01   ENABLED  204800   0        -        -       -

v  redo201      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo201-01   redo201      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-07   redo201-01   ENABLED  204800   0        -        -       -

v  redo202      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo202-01   redo202      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-08   redo202-01   ENABLED  204800   0        -        -       -

v  redo203      gen          ENABLED  204800   -        ACTIVE   -       -
pl redo203-01   redo203      ENABLED  204800   -        ACTIVE   -       -
sd oradg01-09   redo203-01   ENABLED  204800   0        -        -       -

v  spfile       gen          ENABLED  204800   -        ACTIVE   -       -
pl spfile-01    spfile       ENABLED  204800   -        ACTIVE   -       -
sd oradg01-12   spfile-01    ENABLED  204800   0        -        -       -

v  srvcfg       gen          ENABLED  1024000  -        ACTIVE   -       -
pl srvcfg-01    srvcfg       ENABLED  1024000  -        ACTIVE   -       -
sd oradg01-15   srvcfg-01    ENABLED  1024000  0        -        -       -

v  system       gen          ENABLED  1638400  -        ACTIVE   -       -
pl system-01    system       ENABLED  1638400  -        ACTIVE   -       -
sd oradg01-01   system-01    ENABLED  1638400  0        -        -       -

v  temp         gen          ENABLED  2048000  -        ACTIVE   -       -
pl temp-01      temp         ENABLED  2048000  -        ACTIVE   -       -
sd oradg01-02   temp-01      ENABLED  2048000  0        -        -       -

v  undo11       gen          ENABLED  16777216 -        ACTIVE   -       -
pl undo11-01    undo11       ENABLED  16777216 -        ACTIVE   -       -
sd oradg01-10   undo11-01    ENABLED  2048000  0        -        -       -
sd oradg01-17   undo11-01    ENABLED  14729216 2048000  -        -       -

v  undo21       gen          ENABLED  2048000  -        ACTIVE   -       -
pl undo21-01    undo21       ENABLED  2048000  -        ACTIVE   -       -
sd oradg01-11   undo21-01    ENABLED  2048000  0        -        -       -

v  users        gen          ENABLED  16777216 -        ACTIVE   -       -
pl users-01     users        ENABLED  16777216 -        ACTIVE   -       -
sd oradg01-03   users-01     ENABLED  2048000  0        -        -       -
sd oradg01-16   users-01     ENABLED  14729216 2048000  -        -       -

                      

2.分配新的裸设备并设置相应的权限

这一步需要以root身份执行

 

# vxassist -g oradg -U gen make redo104 100m
# vxassist -g oradg -U gen make redo105 100m
# vxedit -g oradg set user=oracle mode=644 redo104
# vxedit -g oradg set user=oracle mode=644 redo105

 

3.重新规划redolog file组

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Sep 14 10:02:47 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Real Application Clusters option
JServer Release 9.2.0.4.0 - Production

SQL> set linesize 120
SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       6313   52428800          1 NO  ACTIVE                 3193855 14-SEP-04
         2          1       6312   52428800          1 NO  INACTIVE               3191691 14-SEP-04
         5          1       6314   52428800          1 NO  CURRENT                3196041 14-SEP-04
         3          2         17   10485760          1 NO  CURRENT                3016310 14-SEP-04
         4          2         16   10485760          1 NO  INACTIVE               1619198 13-SEP-04

SQL> alter database add logfile thread 1 group 6 ('/dev/vx/rdsk/oradg/redo104') size 90M;

Database altered.

SQL> alter database add logfile thread 1 group 7 ('/dev/vx/rdsk/oradg/redo105') size 90M;

Database altered.

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       6316   52428800          1 NO  INACTIVE               3200415 14-SEP-04
         2          1       6315   52428800          1 NO  INACTIVE               3198233 14-SEP-04
         5          1       6317   52428800          1 NO  ACTIVE                 3202621 14-SEP-04
         6          1       6318   94371840          1 NO  CURRENT                3204811 14-SEP-04
         7          1          0   94371840          1 YES UNUSED                       0
         3          2         17   10485760          1 NO  CURRENT                3016310 14-SEP-04
         4          2         16   10485760          1 NO  INACTIVE               1619198 13-SEP-04

7 rows selected.

SQL> alter database drop logfile group 5;

Database altered.

SQL> alter database add logfile thread 1 group 5 ('/dev/vx/rdsk/oradg/redo103') size 90M;

Database altered.

....

SQL> select *from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       6327   94371840          1 NO  INACTIVE               3238534 14-SEP-04
         2          1       6329   94371840          1 NO  CURRENT                3246417 14-SEP-04
         5          1          0   94371840          1 YES UNUSED                       0
         6          1       6328   94371840          1 NO  ACTIVE                 3242482 14-SEP-04
         7          1       6326   94371840          1 NO  INACTIVE               3234597 14-SEP-04
         3          2         17   10485760          1 NO  CURRENT                3016310 14-SEP-04
         4          2         16   10485760          1 NO  INACTIVE               1619198 13-SEP-04

7 rows selected.
      

 

Posted by eygle at 7:59 PM | Comments (1)


Veritas Volume Manager(VxVM)-vxassist命令手册

作者:eygle

出处:http://blog.eygle.com

vxassist是VxVM中非常重要的一个工具,使用非常频繁,我这里给出一个命令手册,并作了一些简单的翻译和注释,仅供参考.

10.Preparing a Volume for Online Backup
11.Displaying Volume Configuration Information

 

General
vxassist工具是VxVM中用于进行卷管理的工具,可以用于创建卷、增加镜像、扩展或者收缩存在的卷等,是非常重要的一个工具.
The vxassist utility in Veritas Volume Manager is used to create volumes, add mirrors and logs to existing volumes, extend and shrink existing volumes, provides for the migration of data from a specified set of disks, and provides facilities for the on-line backup of existing volumes.
vxassist在创建卷组时,如果不指定,缺省的会把卷分配给rootdg(note:在VxVM4.0中rootdg不再必须,但是你可以指定一个default dg具有类似的功能).
vxassist的缺省单位是blocks,但是你可以指定K 或 M 或 G 为单位,这都是合法的.
The default behavior of vxassist is to create volumes in the rootdg diskgroup if diskgroup is not specified . The default length is taken as number of blocks but this can be specified in Kilobytes or Megabytes or Gigabytes.
vxassist command syntax :

vxassist <option> <Keyword> volume_name [attributes]

Commonly used options are given below (See man vxassist for complete list of supported options) -g for specifying diskgroups -b for background operation -d file containing defaults for vxassist if not specified /etc/default/vxassist is used Keywords used are make , mirror , move , growto ,growby ,shrintto ,shirnkby ,snapstart , snapshot ,snapwait Attributes specify volumes layout disks controllar to include exclude etc

Device Nodes :

Default rootdg disk group.
Block Device Node /dev/vx/dsk/volume_name
Raw Device Node /dev/vx/rdsk/volume_name
Other DiskGroups
Block Device Node /dev/vx/dsk/diskgroup_name/volume_name
Raw Device Node /dev/vx/rdsk/diskgroup_name/volume_name

_______________________________________

1. Creating a Volume :

1.1 Creating a Concatenated Volume

缺省的,vxassist把一个卷组里的所有磁盘统一看待,如果创建的volume大于单个磁盘,那么空间分配自动的跨越磁盘.
By default, vxassist creates a concatenated volume using the space available on a disk or on the number of disks in a diskgroup if the volume size specified is more then the one available on a single disk.

Disks can be specified from a diskgroup for a volume group but if not mentioned available disks are selected by the volume manager.

Command syntax :

· vxassist make volume_name volume_length

To create a new volume appvol of 100 MB in the default disk group rootdg with available disks:
· #vxassist make appvol 100m

To create the volume appvol of 100MB on disk03

· #vxassist make appvol 100m disk03

1.2 Creating a Striped Volume

A striped volume contains at least one plex that consists of two or more subdisks located on two or more physical disks.

Command Syntax :

· vxassist make volume_name length layout=stripe

To create a striped volume appvol2 with the default stripe unit size on the default number of disks

· #vxassist make appvol2 100m layout=stripe

To create a striped volume appvol2 100MB striped volume on three specific disks.

· #vxassist make appvol2 100m layout=stripe disk04 disk05 disk06

1.3 Creating a RAID-5 Volume

A RAID-5 volume contains a RAID-5 plex that consists of two or more subdisks located on two or more physical disks. Only one RAID-5 plex can exist per volume. A RAID-5 volume may also contain one or more RAID-5 log plexes, which are used to log information about data and parity being written to the volume.

Command Syntax :

· vxassist make volume_name length layout=raid5

To create the RAID-5 volume appvol4 with the default stripe unit size on the default number of disks with RAID-5 log,

· #vxassist make appvol4 100m layout=raid5.

2. Extending a Volume--扩展一个建好的Volume

Caution : If you plan to use volume size change (grow or shrink ) on a volume with data make sure you have the good backup of the volume available before carrying out such operation .

2.1 Extending a volume up to certain length

Command syntax

· vxassist growto volume_name length

To extend vol3 upto 8000 sectors, type:--例如,扩展vol3到8000个扇区

· #vxassist growto vol3 8000

Note:这里可以指定大小,例如:

vxassist growto redo101 100M

如果使用的是非缺省DG,还需要指定磁盘组:

vxassist -g oradg growto redo101 100M

2.2 Extending by a Given Length

Command Syntax

· vxassist growby volume_name length

To extend volapp by 1000 sectors, type:

· #vxassist growby volapp 1000

3. Shrinking a Volume

Caution - Do not shrink a volume below the size of the file system. If you have a VxFS file system, you can shrink the file system and then shrink the volume. If you do not shrink the file system first, you risk unrecoverable data loss.

Always make sure you have a good backup of the data volume to be shirnked.

3.1 Shrinking to a Given Length

Shrink a volume to a specific length as follows:

· vxassist shrinkto volume_name length

Make sure you do not shrink the volume below the current size of the file system or database using the volume. This command can be safely used on empty volumes.

To shrink volcat to 1300 sectors, type:

· #vxassist shrinkto volcat 1300

3.2 Shrinking by a Given Length

Shrink a volume by a specific length as follows:

· vxassist shrinkby volume_name length

To shrink volcat by 8000 sectors, type:

· #vxassist shrinkby volapp2 8000

4. Removing a Volume

Removing a volume requires removing all references to the volumes to be removed like unmounting the volume if mounted and removing its reference from /etc/vfstab .

如果你需要remove一个volume,那么首先你需要stop这个卷组,停止其上的所有活动事务.
An active volume has to be stopped first to stop all the activities to the volume only then it can be removed.

Stopping Volume :

Command Syntax

· vxvol stop volume_name

To stop appvol1

· #vxvol stop appvol1

Removing Volume

Command Syntax

· vxedit -rf rm volume_name

To remove the volume appvol1

· #vxedit -rf rm appvol11

5. Mirroring a Volume

Mirroring allow data to be written simultaneously to two disks so that in case of failure of one disk data is available from the other mirrored disk. Boot disks can be mirriored to provide alternate booting disk .

5.1 Creating & Mirroring a New Volume

Command Syntax :

· vxassist make volume_name length layout=mirror

To create the mirrored volume, appvol22 of 100mb

· #vxassist make appvol22 100m layout=mirror

To create a volume with Dirty Region Logging enabled

· #vxassist make volume_name length layout=mirror,log

5.2 Mirroring an Existing Volume

Command syntax

· vxassist mirror volume_name

Creating a mirror of volume vol44:

· #vxassist mirror vol44

5.3 Mirroring All Volumes

To mirror all existing volumes to available disk space

· /etc/vx/bin/vxmirror -a

6. Removing a Mirror

Removing a mirror involves first dissociating the plex from its volume and then removing the plex and any associated subdisks completely.The last valid mirror plex associated with a volume cannot be removed.

Dissociate and remove the plex from its volume as follows:

· vxplex -o rm dis plex_name

vxprint -h shows the volume and associated plexes :

Disk group: rootdg TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 v volm fsgen ENABLED 10240 - ACTIVE - - pl volm-01 volm ENABLED 10240 - ACTIVE - - sd disk01-02 volm-01 - 10240 0 - - - pl volm-02 volm ENABLED 10240 - ACTIVE - - sd disk02-03 volm-02 - 10240 0 - - -

To disassociate and remove volmir-02 from volmir, type:

· #vxplex -o rm dis volm-02

The output of vxprint -h for volm now shows volume volm with only one plex::

Disk group: rootdg TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 v volm fsgen ENABLED 10240 - ACTIVE - - pl volm-01 volmir ENABLED 10240 - ACTIVE - - sd disk01-02 volmir-01 - 10240 0 - - -

7. Adding a RAID-5 Log

A RAID-5 log maintains a copy of the data and parity being written to the volume at any given time. If a system failure occurs, VxVM can replay the RAID-5 log to resynchronize the volume. This copies the data and parity that was being written at the time of failure from the log to the appropriate areas of the RAID-5 volume.

RAID-5 log plexes are used to log information about data and parity being written to the raid volume. A log plex is created for the volume by default when a raid volume is created but additional ones can be added by following command .

· vxassist addlog name_of_raid5_vol

8. Adding a DRL Log

Dirty region logging (DRL) is used with mirrored volume layouts. DRL keeps track of the regions that have changed due to I/O writes to a mirrored volume. Prior to every write, a bitmap is written to a log to record the area of the disk that is being changed. In case of system failure, DRL uses this information to recover only the portions of the volume that need to be recovered.

To put Dirty Region Logging into effect for a volume, a log subdisk must be added to that volume and the volume must be mirrored. Only one log subdisk can exist per plex.

The following example creates a log for the mirrored volume vol03:

· #vxassist addlog vol03

When vxassist is used to add a log subdisk to a volume, a log plex is also created to contain the log subdisk, by default.

Once created, the plex containing a log subdisk can be treated as a regular plex. Data subdisks can be added to the log plex. The log plex and log subdisk can be removed using the same procedures used to remove ordinary plexes and subdisks.

9. Removing a RAID-5 Log

Removing a RAID-5 log involves first dissociating the log from its volume and then removing the log and any associated subdisks completely.

Dissociate the log from its volume as follows:

· #vxplex -o rm dis plex_name

To identify the log plex, use the command:

· vxprint -ht raid5_volume_name

To disassociate the log plex volrd-02 from volrd, type:

· #vxplex -o rm dis volrd-02

The output of vxprint -h for volrd now shows:

Disk group: rootdg TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0 v volrd raid5 ENABLED 32 - ACTIVE - - pl volrd-01 volrd ENABLED 32 - ACTIVE - - sd disk01-02 volrd-01 - 32 0 - - - sd disk02-03 volrd-01 - 32 0 - - -

10. Preparing a Volume for Online Backup

Volume manager provides an easy way to take backup of the online data by creating an offline snapshot mirror of the volume .

The vxassist snapstart operation creates a write-only backup mirror, which is attached to and synchronized with the volume to be backed up and later detached and made offline by vxassist snapshot command . The snapshot volume can be used by backup utilities while the original volume continues to be available for applications and users.

The volume backup method described here does not apply to RAID-5 volumes.

Backing up a volume with vxassist involves the following procedure

Create a snapshot mirror

snapstart starts creating a online snapshot mirror of the volume using the available disk space . The snapshot is completed with vxassist snapshot command when offline snapshot volume is created with a userdefined name .

Command Syntax:

  • vxassist snapstart volume_name

To create a snapshot mirror of a volume called vol8, type

  • #vxassist snapstart vol8

Create a snapshot volume

Command Syntax

vxassist snapshot volume_name new_volume_name

To create a snapshot volume of vol8, type:

#vxassist snapshot vol8 snapvol8

You can now back up the snapshot volume by whatever means you prefer. To avoid wasting space, you can then remove the snapshot volume, which occupies as much space as the original volume

11 Displaying Volume Configuration Information

The vxprint command can be used to display information about how a volume is configured.

Display the volume, mirror, and subdisk record information for all volumes as follows:

#vxprint -ht


  Disk group: rootdg  
  
  DG  NAME        NCONFIG    NLOG      MINORS     GROUP-ID  
  DM  NAME        DEVICE     TYPE      PRIVLEN    PUBLEN     STATE  
  V   NAME        USETYPE    KSTATE    STATE      LENGTH     READPOL      PREFPLEX  
  PL  NAME        VOLUME     KSTATE    STATE      LENGTH     LAYOUT       NCOL/WID MODE  
  SD  NAME        PLEX       DISK      DISKOFFS LENGTH       [COL/]OFF    DEVICE     MODE  
  
  dg  rootdg      759096729.1025.tweety  
  
  dm  disk10      c1t0d0s2 sliced      559        1044400     -  
  dm  disk20      c2t0d0s2 sliced      559        1044400     -  
  
  v   pubs        fsgen      ENABLED ACTIVE       2288       SELECT       -  
  pl  pubs-01     pubs       ENABLED ACTIVE       2288       CONCAT       -          RW  
  sd  disk10-01 pubs-01      disk10    0          2288       0            c0t0d0     ENA  
  
  v   vol8      fsgen      ENABLED ACTIVE       20480      SELECT       -  
  pl  vol8-01   vol8       ENABLED ACTIVE       20480      CONCAT       -          RW  
  sd  disk10-02 vol8-0 disk10        2288       20480      0            c0t1d0     ENA  

where dg is a disk group, dm is a disk, v is a volume, pl is a plex, and sd is a subdisk. The top few lines indicate the headers that match each type of output line that follows. Each volume is listed along with its associated plex(es) and subdisk(s).

Display volume-related information for a specific volume as follows:

#vxprint -t volume_name

To display information about vol8, type:

#vxprint -t vol8

 

Posted by eygle at 10:52 AM | Comments (3)



CopyRight © 2004-2008 eygle.com, All rights reserved.