设为首页 收藏本站
查看: 1090|回复: 0

[经验分享] Oracle11g R2单实例+asm

[复制链接]
发表于 2018-9-14 08:07:54 | 显示全部楼层 |阅读模式
1、安装操作OREL5系统
1.1、过程略
DSC0000.png

1.2、添加4块磁盘
DSC0001.png

2、检查rpm包
  [root@asmone opt]# rpm -q binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibcglibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel
  从安装介质查找、上传、安装缺少的包(其中oracleasmlib是asmlib需要的):
  [root@asmone opt]# rpm -ivh *.rpm

  warning: libaio-devel-0.3.106-5.i386.rpm:Header V3 DSA signature: NOKEY, key>  Preparing...        ########################################### [100%]
  1:oracleasmlib     ########################################### [ 20%]
  2:numactl-devel     ########################################### [ 40%]
  3:libaio-devel      ########################################### [60%]
  4:unixODBC       ########################################### [ 80%]
  5:unixODBC-devel    ########################################### [100%]
  [root@asmone opt]#
3、创建目录以及相应的用户
  [root@asmone opt]# groupadd asmadmin
  [root@asmone opt]# groupadd asmdba
  [root@asmone opt]# groupadd asmoper
  [root@asmone opt]# groupadd oinstall
  [root@asmone opt]# groupadd dba
  [root@asmone opt]# groupadd oper
  [root@asmone opt]# useradd -g oinstall -Gasmadmin,asmdba,asmoper grid
  [root@asmone opt]# useradd -g oinstall -Gdba,oper,asmdba oracle
  [root@asmone opt]# passwd oracle
  Changing password for user oracle.
  New UNIX password:
  BAD PASSWORD: it is based on a dictionaryword
  Retype new UNIX password:
  passwd: all authentication tokens updatedsuccessfully.
  [root@asmone opt]# passwd grid
  Changing password for user grid.
  New UNIX password:
  BAD PASSWORD: it is too short
  Retype new UNIX password:
  passwd: all authentication tokens updatedsuccessfully.
  [root@asmone opt]# mkdir -p /u01/gridbase
  [root@asmone opt]# mkdir -p /u01/gridhome
  [root@asmone opt]# chown -R grid:oinstall /u01/
  [root@asmone opt]# mkdir -p/u01/product/oracle
  [root@asmone opt]# mkdir -p/u01/product/oracle/11.2.0/db_1
  [root@asmone opt]# chown -R oracle:oinstall/u01/product/
  [root@asmone opt]# chmod 775 /u01/
  [root@asmone opt]#
4、配置用户环境变量
  [root@asmone opt]# su - grid
  [grid@asmone ~]$ vi .bash_profile
  [grid@asmone ~]$ source .bash_profile
  [grid@asmone ~]$
  grid用户脚本如下:
  # .bash_profile
  # OS User:grid
  # Application:Oracle Grid Infrastructure

  # Version: Oracle 11g>  # Get the aliases and functions
  if [ -f ~/.bashrc ]; then
  . ~/.bashrc
  fi
  alias ls="ls -FA"
  # ORACLE_SID

  # Specifies the Oracle system>  # for the Automatic Storage Management(ASM)instance
  # running on this node.
  # Each RAC node must have a uniqueORACLE_SID.
  # (i.e. +ASM1, +ASM2,...)
  ORACLE_SID=+ASM; exportORACLE_SID
  #JAVA_HOME=/usr/local/java; exportJAVA_HOME
  ORACLE_BASE=/u01/gridbase ; export ORACLE_BASE
  ORACLE_HOME=/u01/gridhome ; export ORACLE_HOME
  ORACLE_TERM=vt100 ;  export ORACLE_TERM
  NLS_DATE_FORMAT="DD-MON-YYYYHH24:MI:SS"; export NLS_DATE_FORMAT
  ORA_NLS11=$ORACLE_HOME/nls/data; exportORA_NLS11
  PATH=${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
  PATH=${PATH}:/usr/bin:/bin:/sbin:/usr/bin/X11:/usr/local/bin
  PATH=${PATH}:/app/product/common/app/bin
  export PATH
  LD_LIBRARY_PATH=$ORACLE_HOME/lib
  LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
  LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
  export LD_LIBRARY_PATH
  CLASSPATH=$ORACLE_HOME/JRE
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

  export>  export TEMP=/tmp
  export TMPDIR=/tmp
  umask 022
  [root@asmone opt]# su - oracle
  [oracle@asmone ~]$ vi .bash_profile
  [oracle@asmone ~]$ source .bash_profile
  asmone$
  oracle用户脚本如下:
  # User specific environment and startupprograms
  BASH_ENV=$HOME/.BASHRC
  export BASH_ENV
  export TEMP=/tmp
  export TMPDIR=/tmp
  PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin
  PATH=${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
  PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
  PATH=${PATH}:/app/product/common/app/bin
  export PATH
  ORACLE_SID=asmonedb; export ORACLE_SID
  ORACLE_BASE=/u01/product/oracle;   export ORACLE_BASE
  ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1;  export ORACLE_HOME
  ORACLE_TERM=vt100;export ORACLE_TERM
  export PATH=$ORACLE_HOME/bin:$PATH
  LD_LIBRARY_PATH=$ORACLE_HOME/lib;exportLD_LIBRARY_PATH
  #JAVA_HOME=/usr/local/java;  export JAVA_HOME
  CLASSPATH=$ORACLE_HOME/JRE
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
  CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

  export>  set -u
  PS1=`hostname`'$';exportPS1
  EDITOR=/bin/vi; export EDITOR
  alias ll='ls -l';
  alias ls='ls --color';
  alias his='history';
  umask 022
5、配置操作系统参数
5.1、配置/etc/hosts
  [root@asmone opt]# cat /etc/hosts
  # Do not remove the following line, orvarious programs
  # that require network functionality willfail.
  127.0.0.1     localhost.localdomainlocalhost
  192.168.1.111 asmone
  [root@asmone opt]#
  注意:确保红字行没有对应主机名称,一般可以去掉ip6
5.2、配置内核参数
  [root@asmone opt]# vi /etc/sysctl.conf
  [root@asmone opt]# sysctl –p
  fs.aio-max-nr = 1048576
  fs.file-max = 6815744
  kernel.shmall = 2097152
  kernel.shmmax = 2147483648
  kernel.shmmni = 4096
  kernel.sem = 250 32000 100 128
  net.ipv4.ip_local_port_range = 9000 65500
  net.core.rmem_default = 262144
  net.core.rmem_max = 4194304
  net.core.wmem_default = 262144
  net.core.wmem_max = 1048576
5.3、配置用户shell limits权限
  [root@asmone opt]# vi/etc/security/limits.conf
  [root@asmone opt]#
  grid soft nproc 2047
  grid hard nproc 32768
  grid soft nofile 1024
  grid hard nofile 250000
  oracle soft nproc 2047
  oracle hard nproc 32768
  oracle soft nofile 1024
  oracle hard nofile 250000
  [root@asmone opt]# vi /etc/pam.d/login
  session  required  pam_limits.so
  [root@asmone opt]# vi /etc/profile
  [root@asmone opt]# source /etc/profile
  if [ \$USER = "oracle" ] || [\$USER = "grid" ]; then
  if [\$SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
  else
  ulimit -u 16384 -n 65536
  fi
  umask 022
  fi
5.4、禁掉SELinux
  [root@asmone opt]# cat /etc/selinux/config
  # This file controls the state of SELinuxon the system.
  # SELINUX= can take one of these threevalues:
  #    enforcing- SELinux security policy is enforced.
  #    permissive- SELinux prints warnings instead of enforcing.
  #    disabled- SELinux is fully disabled.
  SELINUX=disabled
  # SELINUXTYPE= type of policy in use.Possible values are:
  #    targeted- Only targeted network daemons are protected.
  #    strict- Full SELinux protection.
  SELINUXTYPE=targeted
  [root@asmone opt]#
6、配置asmlib并创建asm磁盘
6.1、检查是否已经安装相应的包
  [root@asmone opt]# rpm -qa --queryformat"%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"| grep oracleasm | sort
  oracleasm-2.6.18-238.el5-2.0.5-1.el5 (i686)
  oracleasmlib-2.0.4-1.el5 (i386)
  oracleasm-support-2.1.4-1.el5 (i386)
  [root@asmone opt]#
6.2、配置asmlib
  [root@asmone ~]# /usr/sbin/oracleasmconfigure -i
  Configuring the Oracle ASM library driver.
  This will configure the on-boot propertiesof the Oracle ASM library
  driver. The following questions will determine whether the driver is
  loaded on boot and what permissions it willhave. The current values
  will be shown in brackets ('[]'). Hitting  without typing an
  answer will keep that current value. Ctrl-C will abort.
  Default user to own the driver interface[]: grid
  Default group to own the driver interface[]: asmadmin
  Start Oracle ASM library driver on boot(y/n) [n]: y
  Scan for Oracle ASM disks on boot (y/n)[y]: y
  Writing Oracle ASM library driverconfiguration: done
  [root@asmone ~]#
6.3、加载oracleasm内核模块
  [root@asmone ~]# /usr/sbin/oracleasm init
  Creating /dev/oracleasm mount point:/dev/oracleasm
  Loading module "oracleasm":oracleasm
  Mounting ASMlib driver filesystem:/dev/oracleasm
  [root@asmone ~]#
6.4、创建asm磁盘
  [root@asmone ~]# fdisk /dev/sdb
  Device contains neither a valid DOSpartition table, nor Sun, SGI or OSF disklabel
  Building a new DOS disklabel. Changes willremain in memory only,
  until you decide to write them. After that,of course, the previous
  content won't be recoverable.
  The number of cylinders for this disk isset to 1044.
  There is nothing wrong with that, but thisis larger than 1024,
  and could in certain setups cause problemswith:
  1) software that runs at boot time (e.g.,old versions of LILO)
  2) booting and partitioning software fromother OSs
  (e.g., DOS FDISK, OS/2 FDISK)
  Warning: invalid flag 0x0000 of partitiontable 4 will be corrected by w(rite)
  Command (m for help): n
  Command action
  e  extended
  p  primary partition (1-4)
  p
  Partition number (1-4): 1
  First cylinder (1-1044, default 1):
  Using default value 1
  Last cylinder or +size or +sizeM or +sizeK(1-1044, default 1044):
  Using default value 1044
  Command (m for help): w

  The partition table has been>  Calling ioctl() to re-read partition table.
  Syncing disks.
  同上创建/dev/sdc1、/dev/sdd1、/dev/sde1即可。
  [root@asmone ~]# /usr/sbin/oracleasmcreatedisk DISK0 /dev/sdb1
  Writing disk header: done
  Instantiating disk: done
  [root@asmone ~]# /usr/sbin/oracleasmcreatedisk DISK1 /dev/sdc1
  Writing disk header: done
  Instantiating disk: done
  [root@asmone ~]# /usr/sbin/oracleasmcreatedisk DISK2 /dev/sdd1
  Writing disk header: done
  Instantiating disk: done
  [root@asmone ~]# /usr/sbin/oracleasmcreatedisk DISK3 /dev/sde1
  Writing disk header: done
  Instantiating disk: done
  [root@asmone ~]#
  [root@asmone ~]# /usr/sbin/oracleasmlistdisks
  DISK0
  DISK1
  DISK2
  DISK3
  [root@asmone ~]#
7、安装grid
  [grid@asmone grid]$ ./runInstaller
  Starting Oracle Universal Installer...
  Checking Temp space: must be greater than80 MB.  Actual 10798 MB  Passed
  Checking swap space: must be greater than150 MB.  Actual 1027 MB  Passed
  Checking monitor: must be configured todisplay at least 256 colors.  Actual16777216  Passed
  Preparing to launch Oracle UniversalInstaller from /tmp/OraInstall2013-10-03_11-31-01AM. Please wait...[grid@asmone grid]$
DSC0002.png

DSC0003.png

DSC0004.png

DSC0005.png

DSC0006.png

DSC0007.png

DSC0008.png

DSC0009.png

DSC00010.png

DSC00011.png

DSC00012.png

  [root@asmone opt]# /u01/oraInventory/orainstRoot.sh
  Changing permissions of /u01/oraInventory.
  Adding read,write permissions for group.
  Removing read,write,execute permissions forworld.
  Changing groupname of /u01/oraInventory tooinstall.
  The execution of the script is complete.
  [root@asmone opt]# /u01/gridhome/root.sh
  Running Oracle 11g root.sh script...
  The following environment variables are setas:
  ORACLE_OWNER= grid
  ORACLE_HOME= /u01/gridhome
  Enter the full pathname of the local bindirectory: [/usr/local/bin]:
  Copying dbhome to /usr/local/bin ...
  Copying oraenv to /usr/local/bin ...
  Copying coraenv to /usr/local/bin ...
  Creating /etc/oratab file...
  Entries will be added to the /etc/oratabfile as needed by
  Database Configuration Assistant when adatabase is created
  Finished running generic part of root.shscript.
  Now product-specific root actions will beperformed.
  2013-10-03 12:03:58: Checking for superuser privileges
  2013-10-03 12:03:58: User has super userprivileges
  2013-10-03 12:03:58: Parsing the host name
  Using configuration parameter file:/u01/gridhome/crs/install/crsconfig_params
  Creating trace directory
  LOCAL ADD MODE
  Creating OCR keys for user 'grid', privgrp'oinstall'..
  Operation successful.
  CRS-4664: Node asmone successfully pinned.
  Adding daemon to inittab
  CRS-4123: Oracle High Availability Serviceshas been started.
  ohasd is starting
  ADVM/ACFS is not supported onoraclelinux-release-5-6.0.1
  asmone  2013/10/03 12:04:23  /u01/gridhome/cdata/asmone/backup_20131003_120423.olr
  Successfully configured Oracle GridInfrastructure for a Standalone Server
  Updating inventory properties forclusterware
  Starting Oracle Universal Installer...
  Checking swap space: must be greater than500 MB.  Actual 1027 MB  Passed
  The inventory pointer is located at/etc/oraInst.loc
  The inventory is located at/u01/oraInventory
  'UpdateNodeList' was successful.
  [root@asmone opt]#
8、检查安装结果
  [grid@asmone grid]$ srvctl status asm
  ASM is running on asmone
  [grid@asmone grid]$ srvctl status listener
  Listener LISTENER is enabled
  Listener LISTENER is running on node(s):asmone
  [grid@asmone grid]$ ps -ef | grep asm
  avahi  3035   1 0 11:03 ?    00:00:00 avahi-daemon: running[asmone.local]
  grid   8393   1 0 12:08 ?    00:00:00 asm_pmon_+ASM
  grid   8397   1 012:08 ?    00:00:00 asm_vktm_+ASM
  grid   8403   1 0 12:08 ?    00:00:00 asm_gen0_+ASM
  grid   8407   1 0 12:08 ?    00:00:00 asm_diag_+ASM
  grid   8411   1 0 12:08 ?    00:00:00 asm_psp0_+ASM
  grid   8415   1 0 12:08 ?    00:00:00 asm_dia0_+ASM
  grid   8419   1 0 12:08 ?    00:00:00 asm_mman_+ASM
  grid   8423   1 0 12:08 ?    00:00:00 asm_dbw0_+ASM
  grid   8427   1 0 12:08 ?    00:00:00 asm_lgwr_+ASM
  grid   8431   1 0 12:08 ?    00:00:00 asm_ckpt_+ASM
  grid   8435   1 0 12:08 ?    00:00:00 asm_smon_+ASM
  grid   8439   1 0 12:08 ?    00:00:00 asm_rbal_+ASM
  grid   8443   1 0 12:08 ?    00:00:00 asm_gmon_+ASM
  grid   8447   1 0 12:08 ?    00:00:00 asm_mmon_+ASM
  grid   8451   1 0 12:08 ?    00:00:00 asm_mmnl_+ASM
  grid   8759 3985 0 12:42 pts/1  00:00:00 grep asm
  [grid@asmone grid]$ crs_stat -t
  Name      Type      Target  State  Host
  ------------------------------------------------------------
  ora.DATA.dg  ora....up.type ONLINE  ONLINE  asmone
  ora....ER.lsnr ora....er.type ONLINE  ONLINE  asmone
  ora.asm    ora.asm.type  ONLINE  ONLINE  asmone
  ora.cssd    ora.cssd.type ONLINE  ONLINE  asmone
  ora.diskmon  ora....on.type ONLINE  ONLINE  asmone
  [grid@asmone grid]$
  [grid@asmone grid]$ sqlplus /nolog

  SQL*Plus:>  Copyright (c) 1982, 2009, Oracle. All rights reserved.
  SQL> conn / as sysasm;
  Connected.
  SQL> col disk format a15
  SQL> col disk_group format a15
  SQL> select a.name disk, b.namedisk_group from v$asm_disk a, v$asm_diskgroup b where a.group_number =b.group_number;
  DISK     DISK_GROUP
  --------------- ---------------
  DISK0         DATA
  DISK1         DATA
  SQL>
9、使用asmca创建闪回区
  [grid@asmone grid]$ asmca
DSC00013.png

DSC00014.png

DSC00015.png

DSC00016.png

  此时在查看相关进程以及磁盘组:
  [grid@asmone grid]$ crs_stat -t
  Name      Type      Target  State  Host
  ------------------------------------------------------------
  ora.DATA.dg  ora....up.type ONLINE  ONLINE  asmone
  ora.FRA.dg  ora....up.type ONLINE  ONLINE  asmone
  ora....ER.lsnr ora....er.type ONLINE  ONLINE  asmone
  ora.asm    ora.asm.type  ONLINE  ONLINE  asmone
  ora.cssd    ora.cssd.type ONLINE  ONLINE  asmone
  ora.diskmon  ora....on.type ONLINE  ONLINE  asmone
  [grid@asmone grid]$ sqlplus /nolog

  SQL*Plus:>  Copyright (c) 1982, 2009, Oracle. All rights reserved.
  SQL> conn / as sysasm;
  Connected.
  SQL> col disk format a15
  SQL> col disk_group format a15
  SQL> select a.name disk, b.namedisk_group from v$asm_disk a, v$asm_diskgroup b where a.group_number =b.group_number;
  DISK     DISK_GROUP
  --------------- ---------------
  DISK0         DATA
  DISK1         DATA
  DISK2        FRA
  SQL>
10、安装oracle软件
  解压oracle软件
  [root@asmone opt]# chown -R oracle:oinstalldatabase/
  [root@asmone opt]#
  asmone$pwd
  /opt/database
  asmone$./runInstaller
  Starting Oracle Universal Installer...
  Checking Temp space: must be greater than80 MB.  Actual 8804 MB  Passed
  Checking swap space: must be greater than150 MB.  Actual 886 MB  Passed
  Checking monitor: must be configured todisplay at least 256 colors.  Actual16777216  Passed
  Preparing to launch Oracle UniversalInstaller from /tmp/OraInstall2013-10-03_01-22-04PM. Please wait...asmone$
DSC00017.png

DSC00018.png

DSC00019.png

DSC00020.png

DSC00021.png

DSC00022.png

DSC00023.png

DSC00024.png

DSC00025.png

DSC00026.png

  [root@asmone opt]#/u01/product/oracle/11.2.0/db_1/root.sh
  Running Oracle 11g root.sh script...
  The following environment variables are setas:
  ORACLE_OWNER= oracle
  ORACLE_HOME= /u01/product/oracle/11.2.0/db_1
  Enter the full pathname of the local bindirectory: [/usr/local/bin]:
  The file "dbhome" already existsin /usr/local/bin. Overwrite it? (y/n)
  [n]: y
  Copyingdbhome to /usr/local/bin ...
  The file "oraenv" already existsin /usr/local/bin. Overwrite it? (y/n)
  [n]: y
  Copying oraenv to /usr/local/bin ...
  The file "coraenv" already existsin /usr/local/bin. Overwrite it? (y/n)
  [n]: y
  Copying coraenv to /usr/local/bin ...
  Entries will be added to the /etc/oratabfile as needed by
  Database Configuration Assistant when adatabase is created
  Finished running generic part of root.shscript.
  Now product-specific root actions will beperformed.
  Finished product-specific root actions.
  [root@asmone opt]#
DSC00027.png

11、创建数据库
  asmone$dbca
DSC00028.png

DSC00029.png

DSC00030.png

DSC00031.png

DSC00032.png

DSC00033.png

DSC00034.png

DSC00035.png

DSC00036.png

DSC00037.png

DSC00038.png

DSC00039.png

DSC00040.png

DSC00041.png

  解决方法:
  官方说明:
  CAUSE
  Possible causes:
  1. Grid Infrastructure owner is not partof OSDBA group for the database thats being start up.
  2. Grid Infrastructure owner doesn't have write permission to database dbs ($ORACLE_HOME/dbs) directory.
  SOLUTION
  1. As per documentation

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-581579-1-1.html 上篇帖子: 深入Oracle Log Buffer 发展史 下篇帖子: oracle oraInventory 说明
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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