Bo's Oracle Station

查看: 1863|回复: 0

课程第22/23/24次(2016-05-16/18/20星期一/星期三/星期五):052第5章ASM,ASM相关多个Hands-on, 开始上1Z0-053的

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-5-22 08:31:18 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2016-5-23 17:40 编辑

课程第22/23/24次(2016-05-16/18/20星期一/星期三/星期五):052第5章ASM,ASM相关多个Hands-on, 开始上1Z0-053的第10章
【上完1Z0-052的第5章】:ASM
【1Z0-051】:共10章(0 1 2 3 4 5 6 7 8 9)
【1Z0-052】:共10章(0 1 2 3 4 5 6 9 10 14)
【1Z0-053】:共2章(0 1)

创建盘组命令:
Screenshot.png


如果用裸设备,配置文件/etc/sysconfig/rawdevices:
/dev/raw/raw7  /dev/sda7
/dev/raw/raw8  /dev/sda8
/dev/raw/raw9  /dev/sda9
/dev/raw/raw10  /dev/sda10
/dev/raw/raw11  /dev/sda11
/dev/raw/raw12  /dev/sda12
/dev/raw/raw13  /dev/sda13
/dev/raw/raw14  /dev/sda14
/dev/raw/raw15  /dev/sda15

裸设备启动文件/etc/rc.d/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_0        ]quot;  Please correct your /etc/sysconfig/rawdevices:"
  26.            echo [        DISCUZ_CODE_0        ]quot;     rawdevices are now located in the directory /dev/raw/ "
  27.            echo [        DISCUZ_CODE_0        ]quot;  If the command 'raw' still refers to /dev/raw as a file."
  28.            echo [        DISCUZ_CODE_0        ]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_0        ]quot;  Please correct your /etc/sysconfig/rawdevices:"
  33.            echo [        DISCUZ_CODE_0        ]quot;     rawdevices are now located in the directory /dev/raw/ "
  34.            echo [        DISCUZ_CODE_0        ]quot;  If the command 'raw' still refers to /dev/raw as a file."
  35.            echo [        DISCUZ_CODE_0        ]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_0        ]quot;Assigning devices: "
  48.         assign_raw
  49.         sleep 3
  50.         chown -R oracle:oinstall /dev/raw/
  51.         echo [        DISCUZ_CODE_0        ]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_0        ]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_0        ]quot;Usage: $0 {start|stop|status|restart}"
  69.         exit 1
  70. esac

  71. exit 0
复制代码








从ASM中迁移数据库到文件系统的RMAN脚本:
  1. run {
  2. allocate channel c1 device type disk format '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
  3. backup as copy datafile 2 ;
  4. allocate channel c2 device type disk format '/u01/app/oracle/oradata/orcl/undotbs1.dbf';
  5. backup as copy datafile 3;
  6. allocate channel c3 device type disk format '/u01/app/oracle/oradata/orcl/users01.dbf';
  7. backup as copy datafile 4 ;
  8. allocate channel c4 device type disk format '/u01/app/oracle/oradata/orcl/example01.dbf';
  9. backup as copy datafile 5;
  10. allocate channel c5 device type disk format '/u01/app/oracle/oradata/orcl/tbshigh01.dbf';
  11. backup as copy datafile 6 ;
  12. allocate channel c6 device type disk format '/u01/app/oracle/oradata/orcl/tbshigh201.dbf';
  13. backup as copy datafile 7;
  14. allocate channel c7 device type disk format '/u01/app/oracle/oradata/orcl/tbshigh301.dbf';
  15. backup as copy datafile 8 ;
  16. allocate channel c9 device type disk format '/u01/app/oracle/oradata/orcl/tbshigh401.dbf';
  17. backup as copy datafile 9;
  18. }
复制代码



虚拟机的一部分命令历史:
  1. crs_stat -t
  2. asm.sh
  3. exit
  4. crs_stat -t
  5. crs_stat -t
  6. crs_stat -t
  7. crs_stat -t
  8. crs_stat -t
  9. crs_stat -t
  10. crs_stat -t
  11. crs_stat -t
  12. asm.sh
  13. emca.sh
  14. crs_stat -t
  15. system-config-display
  16. su -
  17. su -
  18. . oraenv
  19. sqlplus /nolog
  20. crs_stat -t
  21. crsctl start res ora.DATA.dg
  22. crsctl start res ora.FRA.dg
  23. crs_stat -t
  24. su -
  25. su -
  26. crsctl start res ora.orcl.db
  27. cd Desktop/
  28. ln -s /u01/app/oracle/product/11.2.0/dbhome_1/sqldeveloper/sqldeveloper/bin/sqldeveloper   ./
  29. su -
  30. sqlplus /nolog
  31. . oraenv
  32. sqlplus /nolog
  33. crs_stat -t
  34. crsctl start res ora.DATA.dg
  35. crs_stat -t
  36. su -  
  37. su -
  38. . oraenv
  39. sqlplus /nolog
  40. sqlplus /nolog
  41. ps aux | grep arb
  42. ps aux | grep asm_arb
  43. ps aux | grep asm_
  44. emctl start dbconsole
  45. . oraenv
  46. emctl start dbconsole
  47. cd /u01/app/oracle/product/
  48. ls
  49. cd 11.2.0/
  50. ls
  51. cd dbhome_1/
  52. ls
  53. cd station23.example.com_orcl
  54. ls
  55. cd sysman/
  56. du -sh
  57. cd
  58. emctl status dbconsole
  59. emca
  60. emca -deconfig dbcontrol db  -repos drop
  61. . oraenv
  62. emca -deconfig dbcontrol db  -repos drop
  63. crs_stat -t
  64. crsctl start res ora.orcl.db
  65. emctl start dbconsole
  66. emca -deconfig dbcontrol db  -repos drop
  67. emca
  68. emca -config dbcontrol db -repos create
  69. emca -config dbcontrol db -repos create
  70. emca -deconfig dbcontrol db  -repos drop
  71. . oraenv
  72. sqlplus /nolog
  73. emca -deconfig dbcontrol db  -repos drop
  74. . oraenv
  75. sqlplus /nolog
  76. su -
  77. ls
  78. mkdir test
  79. cd test
  80. ls
  81. dd if=/dev/zero of=a bs=1M count=10
  82. du -sh
  83. ls
  84. ln a b
  85. ls
  86. du -sh
  87. du -sh *
  88. ls
  89. du -sh b
  90. du -sh a
  91. rm -rf b
  92. ls
  93. sqlplus /nolog
  94. exit
  95. emca
  96. emca -deconfig dbcontrol db -repos drop
  97. emca
  98. emca -config dbcontrol db -repos create
  99. su -
  100. su -
  101. sqlplus /nolog
  102. sqlplus /nolog
  103. . oraenv
  104. sqlplus /nolog
  105. exit
  106. sqlplus /nolog
  107. exit
  108. su -
  109. su
  110. su -
  111. crs
  112. crs_stat -t
  113. crsctl start res ora.NEWDATA.dg
  114. crs_stat -t
  115. crsctl start res ora.orcl.db
  116. crs_stat -t
  117. . oraenv
  118. emctl status dbconsole
  119. cd /u01/app/oracle/
  120. ls
  121. cd product/
  122. ls
  123. cd 11.2.0/
  124. ls
  125. cd dbhome_1/
  126. ls
  127. rm -rf station23.example.com_orcl
  128. cd
  129. emca
  130. emca -deconfig dbcontrol db -repos drop
  131. vim /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2016_05_19_03_30_59.log
  132. su -
  133. . oraenv
  134. sqlplus /nolog
  135. . oraenv
  136. . oraenv
  137. sqlplus /nolog
  138. crs_stat -t
  139. crs_stat -t
  140. crsctl start res ora.NEWDATA.dg
  141. crsctl start res ora.orcl.db
  142. crs_stat -t
  143. crs_unregister ora.orcl.db
  144. srvctl add database -d orcl  -o /u01/app/oracle/product/11.2.0/dbhome_1  
  145. crs_stat -t
  146. crsctl start res ora.orcl.db
  147. crs_stat -t
  148. emctl start dbconsole
  149. firefox
  150. emctl status dbconsole
  151. . oraenv
  152. sqlplus /nolog
  153. sqlplus /nolog
  154. ls
  155. sqlplus /nolog
  156. sqlplus /nolog
  157. sqlplus /nolog
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 02:46 , Processed in 0.045838 second(s), 27 queries .

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