DBA強化實戰系列第二期:centos6.4安裝oracle12c 單例項asm

dawn009發表於2014-09-17
今年,oracle已經發布oracle12c,目前使用的人還比較少!其提供的比較新鮮的東西,還是很值得研究的,比如可插拔資料庫,多日誌寫等,本人已經安裝了測試環境,現將oracle12c的單例項使用asm的安裝過程與大家分享!

1、檢查系統環境
[root@lxora12c ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@lxora12c ~]# uname -a
Linux lxora12c 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@lxora12c ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          3833        640       3193          0         35        290
-/+ buffers/cache:        313       3519
Swap:         4095          0       4095
[root@lxora12c ~]# df -h
鏂囦歡緋葷粺          瀹歸噺  宸茬敤  鍙?敤 宸茬敤%% 鎸傝澆鐐?
/dev/sda2              36G  6.1G   28G  18% /
tmpfs                 1.9G   76K  1.9G   1% /dev/shm
/dev/sr0              4.1G  4.1G     0 100% /media/CentOS_6.4_Final
這是亂碼,在安裝的時候選擇的中文,改成英文的
[root@lxora12c ~]# vi /etc/sysconfig/i18n

#LANG="zh_CN.UTF-8"
LANG="en_US.UTF-8"
[root@lxora12c ~]# vi /etc/hosts
127.0.0.1   lxora12c localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.91.77   lxora12c
編輯hosts,這一步一定要做,否則在後面要報錯,重啟一下
[root@lxora12c ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              36G  6.1G   28G  18% /
tmpfs                 1.9G   72K  1.9G   1% /dev/shm

2、配置yum源,並且安裝必須的包
--我們就不折騰了,就用光碟做yum本地源
[root@lxora12c yum.repos.d]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              36G  6.1G   28G  18% /
tmpfs                 1.9G   76K  1.9G   1% /dev/shm
/dev/sr0              4.1G  4.1G     0 100% /media/CentOS_6.4_Final

[root@lxora12c yum.repos.d]# vim CentOS-Media.repo
主要是對[c6-media]下面一段進行修改。
以下是修改後的內容:
[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

[root@lxora12c yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: c6-media
Cleaning up Everything

[root@lxora12c yum.repos.d]# yum update
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
c6-media                                                 | 4.0 kB     00:00 ...
c6-media/primary_db                                      | 4.4 MB     00:00 ...
Setting up Update Process
No Packages marked for Update

--安裝包
以下包,需要安裝,否則在安裝檢查時會提示
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)

我的環境中需要補充安裝以下包:
[root@lxora12c yum.repos.d]# yum install -y ksh
[root@lxora12c yum.repos.d]# yum install -y libaio-devel

3、建使用者及安裝目錄,編使用者環境變數
[root@lxora12c yum.repos.d]# cd
[root@lxora12c ~]# groupadd oinstall
[root@lxora12c ~]# groupadd dba
[root@lxora12c ~]# useradd -g oinstall -G dba oracle
[root@lxora12c ~]# 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@lxora12c ~]# mkdir -p /u01/app/oracle/product/12.0.1/db1
[root@lxora12c ~]# mkdir -p /u01/app/grid/product/12.0.1/crs
[root@lxora12c ~]# chown -R oracle:oinstall /u01
[root@lxora12c ~]# mkdir /u02
[root@lxora12c ~]# chmod 777 /u02
[root@lxora12c ~]# su - oracle
[oracle@lxora12c ~]$ 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
TMPDIR=/tmp
export TMP TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.0.1/db1; export ORACLE_HOME
ORACLE_SID=ora12c; export ORACLE_SID
PATH=$PATH:.:$ORACLE_HOME/bin
export PATH

4、設定系統環境變數
[root@lxora12c ~]# vi /etc/sysctl.conf
#kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
#kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2415919104
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

[root@lxora12c ~]# sysctl -p
使引數生效

[root@lxora12c ~]# vim /etc/security/limits.conf
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle stack nproc 10240
oracle stack nproc 10240

5、他建裸盤,供asm使用
--對磁碟進行分割槽
[root@lxora12c ~]# 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 0x60a73878.
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-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@lxora12c ~]# 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 0x2a18b19c.
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-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@lxora12c ~]# 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 0x36db140a.
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-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@lxora12c ~]# 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 0xb4245531.
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-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

--繫結裸裝置,開啟udev
注意,如果在這一步使用磁碟機代號繫結時,出現重啟出現磁碟順序發生變化時,請使用uuid繫結,繫結方法請參閱《linux系統 重啟磁碟機代號錯亂問題
[root@lxora12c ~]# cd /etc/udev/rules.d/
[root@lxora12c 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"

"60-raw.rules" 12L, 632C written
[root@lxora12c rules.d]# start_udev
Starting udev: [  OK  ]
[root@lxora12c 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

6、安裝grid軟體
按順序解壓包,開啟xmanager,然後進行安裝,
[oracle@lxora12c u02]$ export DISPLAY=172.17.4.26:0.0
[oracle@lxora12c u02]$ ls -a
.  ..  grid  linuxamd64_12c_grid_1of2.zip  linuxamd64_12c_grid_2of2.zip
[oracle@lxora12c u02]$ cd grid
[oracle@lxora12c grid]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 24057 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4095 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-12-11_05-23-03PM. Please wait ...[oracle@lxora12c grid]$

--1,skip software updates
--2,彈出來的框,選擇yes
--3,選擇install and configure oracle grid infrastrure for a standalone server
--4,下面的進行下一步就行了
--5,到建dg的時候,要更改路徑,因為我們是繫結的裸盤,路徑為:/dev/raw/*,根據需要建dg,我選的是external,用作測試
--6,在這裡輸入asm的密碼
--7,以後的選擇都比較簡單,就不必多說明了
--8,在安裝grid時,base home的輸入分別為:/u01/app/grid 以及/u01/app/grid/product/12.0.1/crs
--9,以後的選擇就直接下一步就行了,安裝會順利進行的!
--10,在最後的介面中,要求執行兩個sh
[root@lxora12c ~]# 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@lxora12c ~]# sh /u01/app/grid/product/12.0.1/crs/root.sh
Performing root user operation for Oracle 12c

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/grid/product/12.0.1/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/12.0.1/crs/crs/install/crsconfig_params
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 lxora12c successfully pinned.
2013/12/11 17:36:42 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.conf'


lxora12c     2013/12/11 17:37:00     /u01/app/grid/product/12.0.1/crs/cdata/lxora12c/backup_20131211_173700.olr
2013/12/11 17:37:01 CLSRSC-327: Successfully configured Oracle Grid Infrastructure for a Standalone Server

最後點選ok就可以了!

--檢查安裝結果
[root@lxora12c ~]# ps -ef | grep -i asm
oracle   32207     1  0 17:38 ?        00:00:00 asm_pmon_+ASM
oracle   32209     1  0 17:38 ?        00:00:00 asm_psp0_+ASM
oracle   32211     1  1 17:38 ?        00:00:00 asm_vktm_+ASM
oracle   32215     1  0 17:38 ?        00:00:00 asm_gen0_+ASM
oracle   32217     1  0 17:38 ?        00:00:00 asm_mman_+ASM
oracle   32221     1  0 17:38 ?        00:00:00 asm_diag_+ASM
oracle   32223     1  0 17:38 ?        00:00:00 asm_dia0_+ASM
oracle   32225     1  0 17:38 ?        00:00:00 asm_dbw0_+ASM
oracle   32227     1  0 17:38 ?        00:00:00 asm_lgwr_+ASM
oracle   32229     1  0 17:38 ?        00:00:00 asm_ckpt_+ASM
oracle   32231     1  0 17:38 ?        00:00:00 asm_smon_+ASM
oracle   32233     1  0 17:38 ?        00:00:00 asm_lreg_+ASM
oracle   32235     1  0 17:38 ?        00:00:00 asm_rbal_+ASM
oracle   32237     1  0 17:38 ?        00:00:00 asm_gmon_+ASM
oracle   32239     1  0 17:38 ?        00:00:00 asm_mmon_+ASM
oracle   32241     1  0 17:38 ?        00:00:00 asm_mmnl_+ASM
oracle   32243     1  0 17:38 ?        00:00:00 oracle+ASM (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

可以看到asm盤及相關服務已經啟動了,證明安裝成功了!

7、安裝rdbms軟體,這裡只安裝軟體,不建庫

rdbms軟體,有兩個包,分別解壓,然後進入database目錄進行安裝
[oracle@lxora12c database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.   Actual 13369 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 4051 MB    Passed
Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-12-11_06-02-21PM. Please wait ...

--1,不用填郵箱什麼,點選下一步,在彈出窗選擇yes
--2,skip software updates,點選下一步,彈出窗選擇yes
--3,install database software only
--4,single instance database installation
--5,以下均是下一步
--6,最後,install
--7,最後需要執行roo.sh
[root@lxora12c ~]# sh /u01/app/oracle/product/12.0.1/db1/root.sh
Performing root user operation for Oracle 12c

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/12.0.1/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.

到此,順利完成rdbms的安裝

8、建立資料庫
[oracle@lxora12c database]$ dbca

--1,基本選擇下一步就行了
--2,到storage type那裡選擇asm即可
--3,選擇create as container database。選擇該選項後,就可以使用12c的新特性,可插拔資料庫

12c建庫比較簡單,在一個介面就可以完成一個default選項的資料庫建立,如果想自己定義,就需要選擇advanced那個選項


 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29119536/viewspace-1271836/,如需轉載,請註明出處,否則將追究法律責任。

相關文章