Monday, April 9, 2012

Add ASM disk to Solaris

-- DISCOVER DISKS IN SOLARIS
# devfsadm
#
-- FORMAT DISK PARTITION TABLE
# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0d1 <DEFAULT cyl 3913 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
       1. c1t0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@0,0
       2. c1t1d0 <DEFAULT cyl 2556 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@1,0
       3. c1t2d0 <DEFAULT cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number): 3
selecting c1t2d0
[disk formatted]


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit

format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
y
format>
format> part



PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> 4
Part      Tag    Flag     Cylinders        Size            Blocks
  4 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 900m
partition> print
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1019     1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       0 -  899      900.00MB    (900/0/0)  1843200
  5 unassigned    wm       0               0         (0/0/0)          0
  6 unassigned    wm       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 unassigned    wm       0               0         (0/0/0)          0

partition> help
Expecting one of the following: (abbreviations ok):
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit

partition> modify
Select partitioning base:
        0. Current partition table (unnamed)
        1. All Free Hog
Choose base (enter number) [0]? 1

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0               0         (0/0/0)          0
  1       swap    wu       0               0         (0/0/0)          0
  2     backup    wu       0 - 1019     1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       0               0         (0/0/0)          0
  5 unassigned    wm       0               0         (0/0/0)          0
  6        usr    wm       0               0         (0/0/0)          0
  7 unassigned    wm       0               0         (0/0/0)          0
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 alternates    wm       0               0         (0/0/0)          0

Do you wish to continue creating a new partition
table based on above table[yes]?
Free Hog partition[6]? 7
Enter size of partition '0' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]: 900m
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm       0               0         (0/0/0)          0
  1       swap    wu       0               0         (0/0/0)          0
  2     backup    wu       0 - 1019     1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       1 -  900      900.00MB    (900/0/0)  1843200
  5 unassigned    wm       0               0         (0/0/0)          0
  6        usr    wm       0               0         (0/0/0)          0
  7 unassigned    wm     901 - 1019      119.00MB    (119/0/0)   243712
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 alternates    wm       0               0         (0/0/0)          0

Okay to make this the current partition table[yes]?
Enter table name (remember quotes): asm3

Ready to label disk, continue? yes

partition> print
Current partition table (asm3):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1019     1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       1 -  900      900.00MB    (900/0/0)  1843200
  5 unassigned    wm       0               0         (0/0/0)          0
  6 unassigned    wm       0               0         (0/0/0)          0
  7 unassigned    wm     901 - 1019      119.00MB    (119/0/0)   243712
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 unassigned    wm       0               0         (0/0/0)          0

partition>
partition> q


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> verify

Primary label contents:

Volume name = <        >
ascii name  = <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
pcyl        = 1022
ncyl        = 1020
acyl        =    2
bcyl        =    0
nhead       =   64
nsect       =   32
Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)          0
  1 unassigned    wm       0               0         (0/0/0)          0
  2     backup    wu       0 - 1019     1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm       0               0         (0/0/0)          0
  4 unassigned    wm       1 -  900      900.00MB    (900/0/0)  1843200
  5 unassigned    wm       0               0         (0/0/0)          0
  6 unassigned    wm       0               0         (0/0/0)          0
  7 unassigned    wm     901 - 1019      119.00MB    (119/0/0)   243712
  8       boot    wu       0 -    0        1.00MB    (1/0/0)       2048
  9 unassigned    wm       0               0         (0/0/0)          0

format> q

-- CREATE DEVICE FOR  ASM PARTITION
# cd asmdisk
# ls
disk1  disk2  disk3
# ls -l
total 0
crw-r--r--   1 oracle   oinstall  30, 68 Apr  9 11:33 disk1
crw-r--r--   1 oracle   oinstall  30, 132 Apr  9 11:33 disk2
#
# mknod disk3 c 30 196
# ls -l
total 0
crw-r--r--   1 oracle   oinstall  30, 68 Apr  9 11:34 disk1
crw-r--r--   1 oracle   oinstall  30, 132 Apr  9 11:34 disk2
crw-r--r--   1 root     root      30, 196 Apr  9 11:34 disk3
#
# chown oracle:oinstall disk3
# ls
disk1  disk2  disk3
#
# ls -l
total 0
crw-r--r--   1 oracle   oinstall  30, 68 Apr  9 11:34 disk1
crw-r--r--   1 oracle   oinstall  30, 132 Apr  9 11:34 disk2
crw-r--r--   1 oracle   oinstall  30, 196 Apr  9 11:34 disk3

# su - oracle

-bash-3.2$ . oraenv
ORACLE_SID = [+ASM] ?
The Oracle base remains unchanged with value /u01/app/oracle
-bash-3.2$
-bash-3.2$ sqlplus /nolog

SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 9 11:48:55 2012

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

SQL> conn / as sysasm
Connected.
SQL>

SQL> select path, group_number group_#, disk_number disk_#, mount_status,
header_status, state, total_mb, free_mb
from v$asm_disk
order by group_number;

/asmdisk/disk3
         0          0 CLOSED  CANDIDATE    NORMAL            0          0

/asmdisk/disk1
         1          0 CACHED  MEMBER       NORMAL         9216       6879

/asmdisk/disk2
         2          0 CACHED  MEMBER       NORMAL         5018       3480


SQL> show parameter asm_diskstring;

asm_diskstring                       string      /asmdisk/disk*

-- ASM DISKGROUP ATTRIBUTES

SQL> select GROUP_NUMBER,NAME,VALUE from v$asm_attribute
  2  where name not like 'template%';

           1
disk_repair_time
3.6h

           1
au_size
1048576

           1
sector_size
512

           1

compatible.asm
11.2.0.0.0

           1
compatible.rdbms
10.1.0.0.0

           1
cell.smart_scan_capable
FALSE

           1
access_control.enabled

FALSE

           1
access_control.umask
066

           2
disk_repair_time
3.6h

           2
au_size
1048576


           2
sector_size
512

           2
compatible.asm
11.2.0.0.0

           2
compatible.rdbms
10.1.0.0.0


           2
cell.smart_scan_capable
FALSE

           2
access_control.enabled
FALSE

           2
access_control.umask
066


16 rows selected.

-- ADD DISK

SQL> alter diskgroup data add disk '/asmdisk/disk3';

Diskgroup altered.

SQL> select * from v$asm_operation;

           1 REBAL RUN           1          1        149        209        550
          0

SQL> SELECT
NVL(a.name, '[CANDIDATE]')      disk_group_name
, b.path                          disk_file_path
, b.name                          disk_file_name
, b.failgroup                     disk_file_fail_group
FROM
v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
ORDER BY
a.name; 

DISK_GROUP_NAME
------------------------------
DISK_FILE_PATH
--------------------------------------------------------------------------------
DISK_FILE_NAME                 DISK_FILE_FAIL_GROUP
------------------------------ ------------------------------
DATA
/asmdisk/disk1
DATA_0000                      DATA_0000

DATA
/asmdisk/disk3
DATA_0001                      DATA_0001

DISK_GROUP_NAME
------------------------------
DISK_FILE_PATH
--------------------------------------------------------------------------------
DISK_FILE_NAME                 DISK_FILE_FAIL_GROUP
------------------------------ ------------------------------

FRA
/asmdisk/disk2
FRA_0000                       FRA_0000

-- ADD DISK USING NAME


SQL> alter diskgroup data drop disk DATA_0001;

Diskgroup altered.

SQL> alter diskgroup data add disk '/asmdisk/disk3' NAME disk3;

Diskgroup altered.

SQL> select name from v$asm_disk;

NAME
------------------------------
DATA_0000
FRA_0000
DISK3



-- DROP DISKS

SQL> alter diskgroup data drop  disk DATA_0001;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
           1 REBAL RUN           1          1        166        209        869
          0


SQL> /

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
           1 REBAL WAIT          1



SQL> /

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
           1 REBAL WAIT          1



SQL> /

no rows selected


SQL> select name, header_status, path from v$asm_disk;

NAME                           HEADER_STATU
------------------------------ ------------
PATH
--------------------------------------------------------------------------------
                               FORMER
/asmdisk/disk3

DATA_0000                      MEMBER
/asmdisk/disk1

FRA_0000                       MEMBER
/asmdisk/disk2

-- USING UNDROP DISKS

select NAME, HEADER_STATUS, MOUNT_STATUS, MODE_STATUS, STATE, REPAIR_TIMER/60 from V$ASM_DISK WHERE GROUP_NUMBER=1;

NAME                           HEADER_STATU MOUNT_S MODE_ST STATE
------------------------------ ------------ ------- ------- --------
REPAIR_TIMER/60
---------------
DATA_0000                      MEMBER       CACHED  ONLINE  NORMAL
              0

DATA_0001                      MEMBER       CACHED  ONLINE  NORMAL
              0


SQL> alter diskgroup data drop disk DATA_0001;

Diskgroup altered.

SQL> alter diskgroup data undrop disks;

Diskgroup altered.

SQL> select NAME, HEADER_STATUS, MOUNT_STATUS, MODE_STATUS, STATE, REPAIR_TIMER/60 from V$ASM_DISK WHERE GROUP_NUMBER=1;

NAME                           HEADER_STATU MOUNT_S MODE_ST STATE
------------------------------ ------------ ------- ------- --------
REPAIR_TIMER/60
---------------
DATA_0000                      MEMBER       CACHED  ONLINE  NORMAL
              0

DATA_0001                      MEMBER       CACHED  ONLINE  NORMAL
              0

-- DISKGROUP REBALANCE


SQL> alter diskgroup data rebalance;

Diskgroup altered.

select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
           1 REBAL RUN           1          1          0          2          0
          0


-- ASM TEMPLATES


SQL> select * from v$asm_template
  2   where group_number=2;

GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2           60 UNPROT COARSE Y PARAMETERFILE                  COLD
COLD

           2           61 UNPROT COARSE Y ASMPARAMETERFILE               COLD
COLD

           2           63 UNPROT COARSE Y DUMPSET                        COLD
COLD


GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2           64 UNPROT FINE   Y CONTROLFILE                    COLD
COLD

           2           65 UNPROT COARSE Y FLASHFILE                      COLD
COLD

           2           66 UNPROT COARSE Y ARCHIVELOG                     COLD
COLD


GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2           67 UNPROT COARSE Y ONLINELOG                      COLD
COLD

           2           68 UNPROT COARSE Y DATAFILE                       COLD
COLD

           2           69 UNPROT COARSE Y TEMPFILE                       COLD
COLD


GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2          170 UNPROT COARSE Y BACKUPSET                      COLD
COLD

           2          171 UNPROT COARSE Y AUTOBACKUP                     COLD
COLD

           2          172 UNPROT COARSE Y XTRANSPORT                     COLD
COLD


GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2          173 UNPROT COARSE Y CHANGETRACKING                 COLD
COLD

           2          174 UNPROT COARSE Y FLASHBACK                      COLD
COLD

           2          175 UNPROT COARSE Y DATAGUARDCONFIG                COLD
COLD


GROUP_NUMBER ENTRY_NUMBER REDUND STRIPE S NAME                           PRIM
------------ ------------ ------ ------ - ------------------------------ ----
MIRR
----
           2          176 UNPROT COARSE Y OCRFILE                        COLD
COLD


16 rows selected.

No comments:

Post a Comment