[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 ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [ 20%]
2:numactl-devel ########################################### [ 40%]
3:libaio-devel ########################################### [60%]
4:unixODBC ########################################### [ 80%]
5:unixODBC-devel ########################################### [100%]
[root@asmone opt]#
[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]#
[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 release 2
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
alias ls="ls -FA"
# ORACLE_SID
# Specifies the Oracle system identifier(SID)
# 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 CLASSPATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
[root@asmone opt]# su - oracle
[oracle@asmone ~]$ vi .bash_profile
[oracle@asmone ~]$ source .bash_profile
asmone<*asmonedb*/home/oracle>$
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 CLASSPATH
set -u
PS1=`hostname`'<*$ORACLE_SID*$PWD>$';exportPS1
EDITOR=/bin/vi; export EDITOR
alias ll='ls -l';
alias ls='ls --color';
alias his='history';
umask 022
[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
[root@asmone opt]# vi /etc/sysctl.conf
[root@asmone opt]# sysctl �Cp
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
[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
[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]#
[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]#
[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 <ENTER> 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 ~]#
[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 ~]#
[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 altered!
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 ~]#
[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]$
[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]#
[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: Release 11.2.0.1.0 Production onThu Oct 3 12:52:49 2013
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>
[grid@asmone grid]$ asmca
此时在查看相关进程以及磁盘组:
[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: Release 11.2.0.1.0 Production onThu Oct 3 13:08:42 2013
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>
解压oracle软件
[root@asmone opt]# chown -R oracle:oinstalldatabase/
[root@asmone opt]#
asmone<*asmonedb*/opt/database>$pwd
/opt/database
asmone<*asmonedb*/opt/database>$./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<*asmonedb*/opt/database>$
[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]#
asmone<*asmonedb*/opt/database>$dbca
解决方法:
官方说明:
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 <Oracle Database Administrator's Guide 11g Release 2 (11.2) ->Configuring Oracle Restart -> Adding Components to the Oracle RestartConfiguration>, GridInfrastructure owner must be part of OSDBA group if the database need to bemanaged by srvctl.
To find out OSDBA group for RDBMS home,execute: $RDBMS_HOME/bin/osdbagrp
To find out whether grid user is alreadypart of OSDBA group, execute: groups <grid>
Location for groups command is/usr/bin/groups on Linux, and /bin/groups on AIX, Solaris and hp-ux
2. If Grid Infrastructure owner isalready part of OSDBA group and the issue still exist, add group writepermission to $RDBMS_HOME/dbs directory; for example
cd $RDBMS_HOME
chmod g+w dbs
ls -ld dbs
操作:
[root@asmone opt]#/u01/product/oracle/11.2.0/db_1/bin/osdbagrp
dba
[root@asmone opt]# groups grid
grid : oinstall asmadmin asmdba asmoper
[root@asmone opt]#
[root@asmone opt]# usermod -a -G dba grid
[root@asmone opt]# groups grid
grid : oinstall asmadmin asmdba asmoper dba
[root@asmone opt]#
重新安装:
创建完成!!!!
asmone<*asmonedb*/opt/database>$sqlplus/nolog
SQL*Plus: Release 11.2.0.1.0 Production onThu Oct 3 15:08:35 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba;
Connected.
SQL> col file_name for a50
SQL> set line 150
SQL> select file_name ,tablespace_namefrom dba_data_files;
FILE_NAME TABLESPACE_NAME
--------------------------------------------------------------------------------
+DATA/asmonedb/datafile/users.269.827851565 USERS
+DATA/asmonedb/datafile/undotbs1.268.827851565 UNDOTBS1
+DATA/asmonedb/datafile/sysaux.267.827851565 SYSAUX
+DATA/asmonedb/datafile/system.266.827851565 SYSTEM
SQL> show parameter recovery
NAME TYPE VALUE
----------------------------------------------- ------------------------------
db_recovery_file_dest string +FRA
db_recovery_file_dest_size big integer 3852M
recovery_parallelism integer 0
SQL>
[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....nedb.db ora....se.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]$ asmcmd
ASMCMD> ls
DATA/
FRA/
ASMCMD> cd DATA
ASMCMD> ls
ASM/
ASMONEDB/
ASMCMD> cd ASMONEDB
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileasmonedb.ora
ASMCMD> cd DATAFILE
ASMCMD> ls
SYSAUX.257.827848801
SYSAUX.267.827851565
SYSTEM.256.827848801
SYSTEM.266.827851565
UNDOTBS1.258.827848801
UNDOTBS1.268.827851565
USERS.259.827848801
USERS.269.827851565
ASMCMD>
ASMCMD> lsdsk
Path
ORCL:DISK0
ORCL:DISK1
ORCL:DISK2
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 16378 13403 0 13403 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 8189 7792 0 7792 0 N FRA/
ASMCMD>
到此告一段落!!!!