Bo's Oracle Station

查看: 1684|回复: 0

课程第18/19次(2018-03-19星期一, 2018-03-21星期三)

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2018-3-19 21:01:18 | 显示全部楼层 |阅读模式
最简单能用的init.ora:
  1. *.control_files='+DATA/orcl/controlfile/current.260.816169631','+FRA/orcl/controlfile/current.256.816169633'
  2. *.db_block_size=8192
  3. *.db_name='orcl'
  4. *.db_recovery_file_dest='+FRA'
  5. *.db_recovery_file_dest_size=4070572032
  6. *.memory_target=6681526272
  7. *.processes=300
  8. *.undo_tablespace='UNDOTBS1'
复制代码
实验环境:
  1. [root@station8 ~]# fdisk -l

  2. WARNING: GPT (GUID Partition Table) detected on '/dev/loop0'! The util fdisk doesn't support GPT. Use GNU Parted.


  3. Disk /dev/loop0: 3887 MB, 3887071232 bytes
  4. 255 heads, 63 sectors/track, 472 cylinders
  5. Units = cylinders of 16065 * 512 = 8225280 bytes
  6. Sector size (logical/physical): 512 bytes / 512 bytes
  7. I/O size (minimum/optimal): 512 bytes / 512 bytes
  8. Disk identifier: 0x375a1b73

  9.       Device Boot      Start         End      Blocks   Id  System
  10. /dev/loop0p1   *           1         473     3795968    0  Empty
  11. Partition 1 has different physical/logical endings:
  12.      phys=(1023, 63, 32) logical=(472, 146, 58)
  13. Partition 1 does not end on cylinder boundary.
  14. /dev/loop0p2               1           1         376   ef  EFI (FAT-12/16/32)
  15. Partition 2 has different physical/logical beginnings (non-Linux?):
  16.      phys=(1023, 254, 63) logical=(0, 54, 39)
  17. Partition 2 has different physical/logical endings:
  18.      phys=(1023, 254, 63) logical=(0, 66, 34)

  19. Disk /dev/sda: 240.1 GB, 240057409536 bytes
  20. 255 heads, 63 sectors/track, 29185 cylinders
  21. Units = cylinders of 16065 * 512 = 8225280 bytes
  22. Sector size (logical/physical): 512 bytes / 512 bytes
  23. I/O size (minimum/optimal): 512 bytes / 512 bytes
  24. Disk identifier: 0xc73ac73a

  25.    Device Boot      Start         End      Blocks   Id  System
  26. /dev/sda1   *           1          39      307200   83  Linux
  27. Partition 1 does not end on cylinder boundary.
  28. /dev/sda2              39        5878    46899200   8e  Linux LVM
  29. /dev/sda3            5878        7152    10240000   8e  Linux LVM
  30. /dev/sda4            7152       29186   176983040    5  Extended
  31. /dev/sda5            7153        8045     7168000   8e  Linux LVM
  32. /dev/sda6            8045        8938     7168000   8e  Linux LVM
  33. /dev/sda7            8938        9830     7168000   8e  Linux LVM
  34. /dev/sda8            9830       10723     7168000   8e  Linux LVM
  35. /dev/sda9           10723       11245     4194304   82  Linux swap / Solaris
  36. /dev/sda10           7152        7152         984+  83  Linux
  37. /dev/sda11          11245       15161    31460829   8e  Linux LVM

  38. Partition table entries are not in disk order

  39. Disk /dev/mapper/vg_station8-LogVol00: 80.2 GB, 80232841216 bytes
  40. 255 heads, 63 sectors/track, 9754 cylinders
  41. Units = cylinders of 16065 * 512 = 8225280 bytes
  42. Sector size (logical/physical): 512 bytes / 512 bytes
  43. I/O size (minimum/optimal): 512 bytes / 512 bytes
  44. Disk identifier: 0x00000000

  45. [root@station8 ~]# df -h
  46. Filesystem            Size  Used Avail Use% Mounted on
  47. /dev/mapper/vg_station8-LogVol00
  48.                        74G   36G   35G  51% /
  49. tmpfs                 2.0G  155M  1.8G   8% /dev/shm
  50. /dev/sda1             283M   42M  226M  16% /boot
  51. /data/rhel-server-6.9-x86_64-dvd.iso
  52.                       3.7G  3.7G     0 100% /mount_iso
  53. [root@station8 ~]# pwd
  54. /root
  55. [root@station8 ~]# oracleasm-discover
  56. Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
  57. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  58. Discovered disk: ORCL:ASMDISK01 [14336000 blocks (7340032000 bytes), maxio 512]
  59. Discovered disk: ORCL:ASMDISK02 [14336000 blocks (7340032000 bytes), maxio 512]
  60. Discovered disk: ORCL:ASMDISK03 [14336000 blocks (7340032000 bytes), maxio 512]
  61. Discovered disk: ORCL:ASMDISK04 [14336000 blocks (7340032000 bytes), maxio 512]
  62. Discovered disk: ORCL:ASMDISK05 [20480000 blocks (10485760000 bytes), maxio 512]
  63. [root@station8 ~]# dd if=/dev/zero of=ASMDISK06.img bs=1K  count=7168000
  64. 记录了7168000+0 的读入
  65. 记录了7168000+0 的写出
  66. 7340032000字节(7.3 GB)已复制,42.0847 秒,174 MB/秒
  67. [root@station8 ~]# losetup /dev/loop6  ASMDISK06.img
  68. [root@station8 ~]# losetup /dev/loop6
  69. /dev/loop6: [fd00]:1845418 (/root/ASMDISK06.img)
  70. [root@station8 ~]# oracleasm-discover
  71. Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
  72. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  73. Discovered disk: ORCL:ASMDISK01 [14336000 blocks (7340032000 bytes), maxio 512]
  74. Discovered disk: ORCL:ASMDISK02 [14336000 blocks (7340032000 bytes), maxio 512]
  75. Discovered disk: ORCL:ASMDISK03 [14336000 blocks (7340032000 bytes), maxio 512]
  76. Discovered disk: ORCL:ASMDISK04 [14336000 blocks (7340032000 bytes), maxio 512]
  77. Discovered disk: ORCL:ASMDISK05 [20480000 blocks (10485760000 bytes), maxio 512]
  78. [root@station8 ~]# oracleasm createdisk ASMDISK06 /dev/loop6
  79. Writing disk header: done
  80. Instantiating disk: done
  81. [root@station8 ~]# oracleasm-discover
  82. Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
  83. [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  84. Discovered disk: ORCL:ASMDISK01 [14336000 blocks (7340032000 bytes), maxio 512]
  85. Discovered disk: ORCL:ASMDISK02 [14336000 blocks (7340032000 bytes), maxio 512]
  86. Discovered disk: ORCL:ASMDISK03 [14336000 blocks (7340032000 bytes), maxio 512]
  87. Discovered disk: ORCL:ASMDISK04 [14336000 blocks (7340032000 bytes), maxio 512]
  88. Discovered disk: ORCL:ASMDISK05 [20480000 blocks (10485760000 bytes), maxio 512]
  89. Discovered disk: ORCL:ASMDISK06 [14336000 blocks (7340032000 bytes), maxio 128]
  90. [root@station8 ~]#
复制代码

rawdevices的/etc/init.d/rawdevices脚本内容(要加可执行位):

  1. #!/bin/bash
  2. #
  3. # rawdevices       This shell script assignes rawdevices to block devices
  4. #
  5. # chkconfig: 345 56 44
  6. # description: This scripts assignes raw devices to block devices \
  7. #              (such as hard drive partitions). This is for the use \
  8. #               of applications such as Oracle. You can set up the \
  9. #               raw device to block device mapping by editing \
  10. #               the file /etc/sysconfig/rawdevices.
  11. #
  12. # config: /etc/sysconfig/rawdevices

  13. [ -f /bin/raw ] || exit 0
  14. [ -f /etc/sysconfig/rawdevices ] || exit 0
  15. # Exit if the file just has the default comments.
  16. LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2>/dev/null || exit 0

  17. . /etc/init.d/functions

  18. function assign_raw()
  19. {
  20.    LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
  21.    while read RAW BLOCK; do
  22.      if [ -n "$RAW" -a -n "$BLOCK" ]; then
  23.          rawdirname=${RAW%/*}
  24.          if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
  25.            echo [        DISCUZ_CODE_2        ]quot;  Please correct your /etc/sysconfig/rawdevices:"
  26.            echo [        DISCUZ_CODE_2        ]quot;     rawdevices are now located in the directory /dev/raw/ "
  27.            echo [        DISCUZ_CODE_2        ]quot;  If the command 'raw' still refers to /dev/raw as a file."
  28.            echo [        DISCUZ_CODE_2        ]quot;   you'll have to upgrade your util-linux package"
  29.            exit 0
  30.          fi
  31.          if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
  32.            echo [        DISCUZ_CODE_2        ]quot;  Please correct your /etc/sysconfig/rawdevices:"
  33.            echo [        DISCUZ_CODE_2        ]quot;     rawdevices are now located in the directory /dev/raw/ "
  34.            echo [        DISCUZ_CODE_2        ]quot;  If the command 'raw' still refers to /dev/raw as a file."
  35.            echo [        DISCUZ_CODE_2        ]quot;   you'll have to upgrade your util-linux package"
  36.            exit 0
  37.          fi

  38.        echo "           $RAW  -->   $BLOCK";
  39.        raw $RAW $BLOCK
  40.      fi
  41.    done
  42. }

  43. # See how we were called.
  44. case "$1" in
  45.   start)
  46.         # Assign devices
  47.         echo [        DISCUZ_CODE_2        ]quot;Assigning devices: "
  48.         assign_raw
  49.         sleep 3
  50.         chown -R oracle:asmadmin /dev/raw/
  51.         echo [        DISCUZ_CODE_2        ]quot;done"
  52.         ;;
  53.   stop)
  54.         # No action to be taken here
  55.         ;;

  56.   status)
  57.         ID=`id -u`
  58.         if [ $ID -eq 0 ]; then
  59.           raw -qa
  60.         else
  61.           echo [        DISCUZ_CODE_2        ]quot;You need to be root to use this command ! "
  62.         fi
  63.         ;;

  64.   restart|reload)
  65.         $0 start
  66.         ;;

  67.   *)
  68.         echo [        DISCUZ_CODE_2        ]quot;Usage: $0 {start|stop|status|restart}"
  69.         exit 1
  70. esac

  71. exit 0
复制代码

rawdevices的配置文件:/etc/sysconfig/rawdevices:

  1. /dev/raw/raw1  /dev/loop3
  2. /dev/raw/raw2  /dev/loop4
  3. /dev/raw/raw3  /dev/loop5
复制代码

使其生效:

[root@station8 init.d]# chkconfig rawdevices on
[root@station8 init.d]# service rawdevices start

创建磁盘组的命令:

  1.   create diskgroup highdata high redundancy        failgroup f1
  2.   2        disk '/dev/raw/raw1' name d1, '/dev/raw/raw2' name d2
  3.   3                                                failgroup f2
  4.   4        disk '/dev/raw/raw3'  name d3, '/dev/raw/raw4' name d4
  5.   5                                                failgroup f3
  6.   6*        disk '/dev/raw/raw5' name d5 , '/dev/raw/raw6' name d6
  7. SQL> /
复制代码

ASM的参数,负责找磁盘的路径:
  1. SQL> alter system set asm_diskstring='/dev/oracleasm/disks/*','/dev/raw/raw*' ;
复制代码
https://station90.example.com:5500/em/console/database/osm/osmSitemap?fromAsm=true&type=osm_instance&target=%2BASM_station90.example.com&event=doLoad

快速镜像重同步:

  1. [oracle@station90 ~]$ sqlplus /nolog

  2. SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 25 11:57:50 2018

  3. Copyright (c) 1982, 2009, Oracle.  All rights reserved.

  4. SQL> conn / as sysasm
  5. Connected.
  6. SQL> alter diskgroup data offline disk DATA_0000  drop after 5h;
  7. alter diskgroup data offline disk DATA_0000  drop after 5h
  8. *
  9. ERROR at line 1:
  10. ORA-15032: not all alterations performed
  11. ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher


  12. SQL> alter diskgroup data set attribute 'compatible.rdbms'='11.2';

  13. Diskgroup altered.

  14. SQL> alter diskgroup data offline disk DATA_0000  drop after 5h;

  15. Diskgroup altered.

  16. SQL>
复制代码




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-4-19 10:34 , Processed in 0.036658 second(s), 24 queries .

快速回复 返回顶部 返回列表