DBA强化实战系列第二期:centos6.4安装oracle12c 单实例asm

今年,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/29371470/viewspace-1063016/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29371470/viewspace-1063016/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值