DBA強化實戰系列第一期:centos6.4安裝oracle11.2.0.4單例項asm
DBA強化實戰系列第一期:centos6.4安裝oracle11.2.0.4單例項asm
最近有不少朋友說在linux6.4上安裝oracle11.2.0.4失敗,所以特別測試一下,網路首發,轉載請註明出處
後面有更多精彩日記更新,敬請關注或http://blog.itpub.net/29371470/或
1、確定作業系統
[root@mytest yum.repos.d]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@mytest yum.repos.d]# uname -a
Linux mytest 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@mytest yum.repos.d]# free -m
total used free shared buffers cached
Mem: 48269 1192 47077 0 43 328
-/+ buffers/cache: 819 47450
Swap: 40959 0 40959
[root@mytest yum.repos.d]# vi /etc/hosts
127.0.0.1 mytest mytest mytest.localdomain mytest4 mytest4.localdomain4
::1 mytest mytest.localdomain mytest6 mytest6.localdomain6
192.168.92.161 mytest
注意,這裡要編輯,否則在配置監聽的時候會報錯,vip服務無法註冊
2、建使用者授權
[root@mytest yum.repos.d]# groupadd oinstall
[root@mytest yum.repos.d]# groupadd dba
[root@mytest yum.repos.d]# useradd -g oinstall -G dba oracle
[root@mytest yum.repos.d]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is based on your username
Retype new password:
passwd: all authentication tokens updated successfully.
[root@mytest yum.repos.d]# mkdir /u01
[root@mytest yum.repos.d]# mkdir /u02
[root@mytest yum.repos.d]# mkdir -p /u01/app/oracle/product/11.2.0/db1
[root@mytest yum.repos.d]# mkdir -p /u01/app/grid/product/11.2.0/crs
[root@mytest yum.repos.d]# chown -R oracle:oinstall /u01
[root@mytest yum.repos.d]# cd /u01
[root@mytest u01]# chmod 777 /u02
3、編輯使用者環境變數
[root@mytest u01]# su - oracle
[oracle@mytest ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db1; export ORACLE_HOME
ORACLE_SID=oradb; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
export PATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
".bash_profile" 32L, 968C written
4、設定系統環境變數
[root@mytest u01]# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608 --注意,我這裡的記憶體比較大,所以要大一點,否則會報錯
kernel.shmmax = 30064771072
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 = 1048586
vm.min_free_kbytes = 51200
[root@mytest u01]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle hard stack 10240
[root@mytest u01]# vi /etc/selinux/config
SELINUX=disabled
[root@mytest u01]# vi /etc/pam.d/login
session required pam_limits.so
系統環境已經配置結束!
5、打補丁包
配置yum源
[root@mytest ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
[root@mytest ~]# vim /etc/yum.repos.d/CentOS-Media.repo
修改的結果如下:
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS_6.4_Final
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
--清除原有的yum資訊
[root@mytest ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
--檢查DVD軟體列表
[root@mytest yum.repos.d]# yum list
Loaded plugins: fastestmirror
Determining fastest mirrors
c6-media | 3.7 kB 00:00 ...
c6-media/primary_db | 3.3 MB 00:00 ...
--檢查一下系統中的包是否最新
[root@mytest yum.repos.d]# yum update
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Update Process
No Packages marked for Update
注意:以下包是必須安裝上去的
compat-libstdc++-33-3.2.3-69.el6.i686.rpm
compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
gcc-4.4.4-13.el6
gcc-4.4.7-3.el6.x86_64.rpm
gcc-c++-4.4.7-3.el6.x86_64.rpm
glibc-2.12-1.107.el6.i686.rpm
glibc-devel-2.12-1.107.el6.x86_64.rpm
glibc-devel-2.12-1.107.el6.i686.rpm
ksh-20100621-19.el6.x86_64.rpm
libgcc-4.4.7-3.el6.i686.rpm
libgcc-4.4.7-3.el6.x86_64.rpm
libstdc++-docs-4.4.7-3.el6.x86_64.rpm
libstdc++-devel-4.4.7-3.el6.x86_64.rpm
libstdc++-4.4.7-3.el6.x86_64.rpm
libstdc++-devel-4.4.7-3.el6.i686.rpm
libaio-0.3.107-10.el6.i686.rpm
libaio-0.3.107-10.el6.x86_64.rpm
libaio-devel-0.3.107-10.el6.i686.rpm
libaio-devel-0.3.107-10.el6.x86_64.rpm
elfutils-libelf-0.152-1.el6.i686.rpm
如果以上包不存在,就必須安裝。
在我的環境中,只有以下包沒有,所以進行安裝
[root@mytest ~]# yum install -y libstdc++-docs
[root@mytest ~]# yum install -y ksh
[root@mytest ~]# yum install -y elfutils-libelf-devel
[root@mytest ~]# yum install -y libaio-devel
注意,如果安裝了ksh包,那麼將與pdksh-5.2.14-30.x86_64.rpm衝突,不安裝pdksh不會影響安裝的使用的
5、對硬碟進行分割槽
總共掛了5塊盤,sda/sdb/sdc/sdd/sde
其中,sda做為系統盤,對其餘四個盤進行分割槽。
[root@mytest ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x646bfece.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1017, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017):
Using default value 1017
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mytest ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x87ca0cb5.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1017, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017):
Using default value 1017
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mytest ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x55c77081.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-40960, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-40960, default 40960):
Using default value 40960
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@mytest ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x0109de8c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-40960, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-40960, default 40960):
Using default value 40960
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
--配置udev,使用這種方式來繫結asm裸裝置
我們計劃用第一盤和第二個裸裝置來做crs盤,建crsdg.
[root@mytest rules.d]# cd /etc/udev/rules.d
[root@mytest rules.d]# vi 60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N"
KERNEL=="raw[1-4]", OWNER="oracle", GROUP="dba", MODE="660"
[root@mytest rules.d]# start_udev
Starting udev: [ OK ]
[root@mytest rules.d]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4: bound to major 8, minor 65
在這裡,可以看到,我們繫結已經成功了!
請注意,在有些場景中,這樣的繫結方法會有侷限性。linux在掃描磁碟時出現磁碟亂序,要使用繫結uuid的方法,請參閱<<linux系統 重啟磁碟機代號錯亂問題>>
6、安裝grid軟體
注意,11.2以後的版本,asm已經發生了很大的變化,包括對asm的管理也發生了很大的變化,即使安裝單例項的asm,也必須安裝crs軟體
將:
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
grid是第三個包,unzip解壓即可
上傳,並解壓
先安裝grid,然後
執行:runInstaller
根據圖形介面來做,過程很簡單。
--1,skip software update
--2,configure oracle grid infrastructer for a standalone server 第二個選項
--3,以後的就直接下一步
--4,選兩個盤建crsdg,本例中選擇raw1及raw2,建crsdg,normal模式
--5,後面的基本是一步,就行了,注意asm密碼的設定,不要忘記了!
--6,路徑選擇。由於我們的grid都使用的是oracle使用者,所以這裡的路徑要手動輸一下
--7,在檢測的時候提示kdpsh包,選擇ignore all就行了,不影響,這個與圖形介面有關
--8,安裝最後提示用執行orainstRoot.sh及root.sh,這個比較簡單,使用root使用者執行
[root@mytest u02]# sh /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@mytest u02]# sh /u01/app/grid/product/11.2.0/crs/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/grid/product/11.2.0/crs
Enter the full pathname of the local bin directory: [/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/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/grid/product/11.2.0/crs/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node mytest successfully pinned.
Adding Clusterware entries to upstart
mytest 2013/12/09 16:58:55 /u01/app/grid/product/11.2.0/crs/cdata/mytest/backup_20131209_165855.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
這時候,系統開始配置相關的東西,並啟動crs軟體,asm也將會啟動起來,
至此,grid安裝結束
[oracle@mytest grid]$ ps -ef | grep pmon
oracle 8885 1 0 17:01 ? 00:00:00 asm_pmon_+ASM
oracle 9213 2741 0 17:01 pts/0 00:00:00 grep pmon
[oracle@mytest grid]$ ps -ef | grep -i +asm
oracle 8885 1 0 17:01 ? 00:00:00 asm_pmon_+ASM
oracle 8887 1 0 17:01 ? 00:00:00 asm_psp0_+ASM
oracle 8889 1 1 17:01 ? 00:00:01 asm_vktm_+ASM
oracle 8893 1 0 17:01 ? 00:00:00 asm_gen0_+ASM
oracle 8895 1 0 17:01 ? 00:00:00 asm_diag_+ASM
oracle 8897 1 0 17:01 ? 00:00:00 asm_dia0_+ASM
oracle 8899 1 0 17:01 ? 00:00:00 asm_mman_+ASM
oracle 8901 1 0 17:01 ? 00:00:00 asm_dbw0_+ASM
oracle 8903 1 0 17:01 ? 00:00:00 asm_lgwr_+ASM
oracle 8905 1 0 17:01 ? 00:00:00 asm_ckpt_+ASM
oracle 8907 1 0 17:01 ? 00:00:00 asm_smon_+ASM
oracle 8909 1 0 17:01 ? 00:00:00 asm_rbal_+ASM
oracle 8911 1 0 17:01 ? 00:00:00 asm_gmon_+ASM
oracle 8913 1 0 17:01 ? 00:00:00 asm_mmon_+ASM
oracle 8915 1 0 17:01 ? 00:00:00 asm_mmnl_+ASM
oracle 8927 1 0 17:01 ? 00:00:00 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 9204 1 0 17:01 ? 00:00:00 asm_fd00_+ASM
[root@mytest bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.CRSDG.dg ora....up.type ONLINE ONLINE mytest
ora....ER.lsnr ora....er.type ONLINE ONLINE mytest
ora.asm ora.asm.type ONLINE ONLINE mytest
ora.cssd ora.cssd.type ONLINE ONLINE mytest
ora.diskmon ora....on.type OFFLINE OFFLINE
ora.evmd ora.evm.type ONLINE ONLINE mytest
ora.ons ora.ons.type OFFLINE OFFLINE
7、安裝oracle軟體
第一個包、第二個包是rdbms的軟體,直接解壓安裝!
記住,要先解壓1,再解壓2
[oracle@mytest database]$ ./runInstaller
--1,選擇skip software update
--2,選擇install database software only
--3,選擇single instance database installation
--4,以下動作基本是下一步就行了
--5,軟體檢測時,同樣是忽略kdpsh這個包,緊接著,下一步
--6,到最後,要安裝root.sh
[root@mytest bin]# sh /u01/app/oracle/product/11.2.0/db1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/db1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
至此,資料庫軟體安裝完全結束,這時候,我們可以建資料庫了!
8、建立dg,準備建資料庫
[oracle@mytest database]$ export ORACLE_SID=+ASM
[oracle@mytest database]$ export ORACLE_HOME=/u01/app/grid/product/11.2.0/crs
[oracle@mytest database]$ cd $ORACLE_HOME
[oracle@mytest crs]$ cd bin
[oracle@mytest bin]$ ./sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 9 17:26:38 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option
SQL> create diskgroup datadg1 external redundancy disk '/dev/raw/raw3' attribute 'au_size' = '2M';
Diskgroup created.
SQL> alter diskgroup datadg1 add disk '/dev/raw/raw4';
Diskgroup altered.
9、建立資料庫
[oracle@mytest ~]# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db1
[oracle@mytest ~]# dbca
--1,選擇create database
--2,選擇general purpose or transaction processing
--3,在storage type時,選擇automatic storage mamagement(asm)
--4,use oracle-managed files 中,點選瀏覽,並選擇剛才建的datadg1
--5,配置sga及pga,據自己實體記憶體及業務設定
--6,字符集,choose from the list of character sets 中選擇zhs16gbk
--7,以後的安裝基本是下一步
至此,所有安裝都結束了!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-1062927/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DBA強化實戰系列第二期:centos6.4安裝oracle12c 單例項asmCentOSOracle單例ASM
- DBA強化實戰系列第三期:oracle11.2.0.4搭建adg全過程Oracle
- 單機環境安裝配置ASM例項ASM
- DBA強化實戰系列第四期:在企業私有云vmware上部署oracle11.2.0.4 racOracle
- Window下安裝Oracle ASM單例項資料庫OracleASM單例資料庫
- 【Oracle】ASM例項安裝入門OracleASM
- 單例項刪除ASM例項單例ASM
- 清除安裝失敗的asm例項ASM
- 5.6單例項安裝單例
- Redis單例項安裝Redis單例
- ASM單例項安裝後,需要手動設定ASM的引數檔案ASM單例
- mysql 5.7單例項安裝MySql單例
- 11.2.0.4單例項ASM安裝報錯ohasd failed to ... line 73.單例ASMAI
- oracle單例項12.2.0.1安裝Oracle單例
- 安裝Mongodb3.0.6單例項MongoDB單例
- RAC+DG(asm單例項)ASM單例
- 單例項的duplicate(non ASM)單例ASM
- oracle 11g 單例項安裝Oracle單例
- 單機環境配置ASM例項ASM
- 單節點執行ASM例項ASM
- RAC asm恢復到單例項ASM單例
- centos6.4安裝TokudbCentOS
- CentOS6.4安裝PHPCentOSPHP
- 安裝__DB、ASM注意事項ASM
- Oracle單例項+ASM新增控制檔案Oracle單例ASM
- rac asm 恢復到 單例項 1ASM單例
- rac asm 恢復到 單例項 2ASM單例
- ASM之建立ASM例項ASM
- ORACLE11.2.0.4 RAC+ ASM安裝方法 (作業系統CENTOS7.6)OracleASM作業系統CentOS
- ORACLE11GR2 RAC解除安裝ASM例項步驟OracleASM
- 管理 ASM 例項ASM
- 停止ASM例項ASM
- 19C 單例項資料庫安裝單例資料庫
- mysql-5.6.31安裝(單例項 Linux)MySql單例Linux
- ORACLE 單例項完全解除安裝資料庫Oracle單例資料庫
- oracle11g asm單例項重建hasOracleASM單例
- ASM單例項(Oracle 11.2.0.4)環境(一)ASM單例Oracle
- ASM單例項(Oracle 11.2.0.4)環境(二)ASM單例Oracle