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]$
[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
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$
[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]#
11、创建数据库
asmone$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