Thứ Năm, 30 tháng 8, 2018

Cài đặt Oracle Grid Infrastructure (Clusterware, ASM) 11g trên VMWare Workstation


1. Tạo Groups và Users
-- User oracle cài grid chung với Oracle DB
# groupadd -g 1000 oinstall
# groupadd -g 1031 dba
# useradd -u 1101 -g oinstall -G dba oracle
# mkdir -p  /u01/app/11.2.0/grid
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01
# chmod -R 775 /u01/
-- Tạo user grid riêng biệt để cài Grid Infrastructure
/usr/sbin/useradd -u 1100 -g oinstall -G dba grid
# mkdir -p  /u01/app/11.2.0/grid
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/oracle
# chown grid:oinstall /u01/app/11.2.0/grid
# chown grid:oinstall /u01/app/grid
# chown oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/
# chown -R grid:oinstall /u01
From <https://docs.oracle.com/cd/E11882_01/install.112/e47805/presolar.htm#CWSOL176>

2. Tạo LUN trên VMWare
# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <VMware,-VMware Virtual -1.0  cyl 11223 alt 2 hd 255 sec 63>
          /pci@0,0/pci15ad,1976@10/sd@0,0
       1. c1t1d0 <VMware,-VMware Virtual -1.0  cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@1,0
       2. c1t2d0 <VMware,-VMware Virtual -1.0  cyl 1021 alt 2 hd 64 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@2,0
       3. c1t3d0 <VMware,-VMware Virtual -1.0  cyl 3069 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@3,0
       4. c1t4d0 <VMware,-VMware Virtual -1.0  cyl 3069 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@4,0
       5. c1t5d0 <VMware,-VMware Virtual -1.0  cyl 3069 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@5,0
       6. c1t6d0 <VMware,-VMware Virtual -1.0  cyl 3069 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@6,0
Specify disk (enter its number): 1
selecting c1t1d0
[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> current
Current Disk = c1t1d0
<VMware,-VMware Virtual -1.0  cyl 1021 alt 2 hd 64 sec 32>
/pci@0,0/pci15ad,1976@10/sd@1,0

format> partition
WARNING - This disk may be in use by an application that has
          modified the fdisk table. Ensure that this disk is
          not currently in use before proceeding to use fdisk.
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> partition


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> print
Current partition table (original):
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               0         (0/0/0)          0
  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> 6
Part      Tag    Flag     Cylinders        Size            Blocks
  6 unassigned    wm       0               0         (0/0/0)          0

Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[1]:
Enter partition size[0b, 0c, 1e, 0.00mb, 0.00gb]: 1019c
partition> label
Ready to label disk, continue? y

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               0         (0/0/0)          0
  5 unassigned    wm       0               0         (0/0/0)          0
  6        usr    wm       1 - 1019     1019.00MB    (1019/0/0) 2086912
  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> quit
  • Chown, chmod:
ls -lL /dev/rdsk/c1t*d*s6
chown grid:asmadmin /dev/rdsk/c1t1d0s6; --> DATA
chown grid:asmadmin /dev/rdsk/c1t2d0s6; --> DATA
chown grid:asmadmin /dev/rdsk/c1t3d0s6; --> DATA
chown grid:asmadmin /dev/rdsk/c1t4d0s6; --> CRS
chown grid:asmadmin /dev/rdsk/c1t5d0s6; --> CRS
chown grid:asmadmin /dev/rdsk/c1t6d0s6; --> CRS

chmod 660 /dev/rdsk/c1t1d0s6;
chmod 660 /dev/rdsk/c1t2d0s6;
chmod 660 /dev/rdsk/c1t3d0s6;
chmod 660 /dev/rdsk/c1t4d0s6;
chmod 660 /dev/rdsk/c1t5d0s6;
chmod 660 /dev/rdsk/c1t6d0s6;

3. Cài đặt

  • Tào file /u01/app/grid/.profile

bash-3.2$ more .profile
#GRID_HOME=/u01/app/11.2.0/grid
ORACLE_SID=+ASM
GRID_HOME=/u01/app/grid
ORACLE_HOME=/u01/app/grid
ORACLE_BASE=/u01/app/oracle
PATH=$PATH:/usr/X11/bin:/usr/openwin/bin:$GRID_HOME/bin
export GRID_HOME ORACLE_BASE ORACLE_HOME PATH ORACLE_SID

  • Truy cập VNC:

# cd /u01/setup/grid
# ./runInstaller
  • Thông tin:
ASM Account: Asm$1234 or Oracle$123
user_dump_dest       string      /u01/app/oracle/diag/asm/+asm/                                                +ASM/trace


ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master