Oracle 12C R2 单节点GRID+DATABASE安装,存储使用逻辑卷+asm

已经为数据库创建了专用的逻辑卷,参考博客:
具体安装过程如下
软件包检查
yum install -y binutils
yum install -y compat-libcap1
yum install -y compat-libstdc++-33
yum install -y compat-libstdc++-33.i686
yum install -y e2fsprogs
yum install -y e2fsprogs-libs
yum install -y glibc
yum install -y glibc.i686
yum install -y glibc-devel
yum install -y glibc-devel.i686
yum install -y ksh
yum install -y glibc-devel
yum install -y glibc-devel.i686
yum install -y libaio.i686
yum install -y libaio.i686
yum install -y libX11
yum install -y libX11.i686
yum install -y libXau
yum install -y libXau.i686
yum install -y libXi
yum install -y libXi.i686
yum install -y libXtst
yum install -y libXtst.i686
yum install -y libgcc
yum install -y libgcc.i686
yum install -y libstdc++
yum install -y libstdc++.i686
yum install -y libstdc++-devel
yum install -y libstdc++-devel.i686
yum install -y libxcb
yum install -y libxcb.i686
yum install -y make
yum install -y net-tools
yum install -y nfs-utils
yum install -y smartmontools
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC.i686

目录和用户创建:
mkdir -p /u01/app
[root@jing1 app]# chown -R oracle:oinstall /u01
[root@jing1 app]# chown -R grid:oinstall /u01/app/grid
[root@jing1 app]# chmod -R 775 /u01
[root@jing1 app]# chown -R grid:oinstall /u01/app/12.2.0/

[root@jing1 app]# groupadd -g 1000 oinstall
[root@jing1 app]# groupadd -g 1200 asmadmin
[root@jing1 app]# groupadd -g 1201 asmdba
[root@jing1 app]# groupadd -g 1202 asmoper
[root@jing1 app]# groupadd -g 1300 dba
[root@jing1 app]# groupadd -g 1301 oper
useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "grid Infrastructure Owner" grid

修改host文件
[root@jing1 ~]# more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.135.2.236 jing1

配置profile
[grid@jing1 ~]$ more .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

export PATH
export ORACLE_HOME=/u01/app/12.2.0/grid
umask 022

配置oraInventory
[root@jing1 app]# more /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

修改limit:
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo " oracle soft stack 10240" >>/etc/security/limits.conf
echo " oracle hard stack 32768" >>/etc/security/limits.conf
echo "grid soft nproc 2047" >>/etc/security/limits.conf
echo "grid hard nproc 16384" >>/etc/security/limits.conf
echo "grid soft nofile 1024" >>/etc/security/limits.conf
echo "grid hard nofile 65536" >>/etc/security/limits.conf
echo "grid soft stack 10240" >>/etc/security/limits.conf
echo "grid hard stack 32768" >>/etc/security/limits.conf

存储创建
此处要说明一下,本单节点服务器创建了一个卷组vg_jing1,为了使用asm创建了一个逻辑卷lv_asmdisk,如下:
[root@jing1 vg_jing1]# ll /dev/vg_jing1/
total 0
lrwxrwxrwx 1 root root 7 Nov 30 16:34 lv_asmdisk -> ../dm-3
lrwxrwxrwx 1 root root 7 Nov 30 16:22 lv_home -> ../dm-2
lrwxrwxrwx 1 root root 7 Nov 30 16:22 lv_root -> ../dm-0
lrwxrwxrwx 1 root root 7 Nov 30 16:22 lv_swap -> ../dm-1
为了是asm能识别到该盘
chown grid:asmadmin /dev/dm-3
但是。。。这个权限会自动变回去如下:
[root@jing1 dev]# ll /dev/dm*
brw-rw---- 1 root disk 253, 0 Nov 30 16:22 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Nov 30 16:22 /dev/dm-1
brw-rw---- 1 root disk 253, 2 Nov 30 16:22 /dev/dm-2
brw-rw---- 1 root disk 253, 3 Nov 30 16:42 /dev/dm-3
[root@jing1 dev]#

没搞定,参考下面文档,找找灵感
参考:
具体方法如下:
使用udev修改dm文件权限:
vim /etc/udev/rules.d/12-dm-permissions.rules
[root@jing1 vg_jing1]# more /etc/udev/rules.d/12-dm-permissions.rules
ENV{DM_NAME}=="vg_jing1-lv_asmdisk", OWNER:="grid", GROUP:="asmadmin", MODE:="660", SYMLINK+="iscsi/oraasm-$env{DM_NAME}"
然后
/sbin/start_udev
后查看权限:
[root@jing1 vg_jing1]# ll /dev/dm*
brw-rw---- 1 root disk 253, 0 Nov 30 17:45 /dev/dm-0
brw-rw---- 1 root disk 253, 1 Nov 30 17:45 /dev/dm-1
brw-rw---- 1 root disk 253, 2 Nov 30 17:45 /dev/dm-2
brw-rw---- 1 grid asmadmin 253, 3 Nov 30 17:45 /dev/dm-3
成功修改

配置内核
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 3288424" >> /etc/sysctl.conf
echo "kernel.shmmax = 16836732928" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048576" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 16384 4194304 " >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 87380 4194304 " >> /etc/sysctl.conf
sysctl -p

关闭selinux
[root@rac01 ntp]# setenforce 0
[root@rac01 ntp]# vim /etc/selinux/config
SELINUX=disabled
关闭防火墙
[root@storage ~]# service iptables stop
[root@storage ~]# chkconfig iptables off

[grid@jing1 grid]$ ./gridSetup.sh










[root@jing1 grid]# ./root.sh
Performing root user operation.

The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/12.2.0/grid

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/12.2.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/jing1/crsconfig/roothas_2017-12-01_09-55-22AM.log
2017/12/01 09:55:24 CLSRSC-363: User ignored prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'grid', 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 jing1 successfully pinned.
2017/12/01 09:55:53 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.conf'
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'jing1'
CRS-2673: Attempting to stop 'ora.evmd' on 'jing1'
CRS-2677: Stop of 'ora.evmd' on 'jing1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'jing1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.

jing1 2017/12/01 09:57:13 /u01/app/12.2.0/grid/cdata/jing1/backup_20171201_095713.olr 0
2017/12/01 09:57:19 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

完成grid安装,界面显示如下:
[grid@jing1 grid]$ ./gridSetup.sh
Launching Oracle Grid Infrastructure Setup Wizard...

You can find the log of this install session at:
/u01/app/oraInventory/logs/GridSetupActions2017-12-01_09-32-38AM/gridSetupActions2017-12-01_09-32-38AM.log

在.bash_profile中添加如下环境变量,其中Oracle home在安装前已设置:
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12.2.0/grid
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
umask 022


安装Oracle数据库:
编辑oracle用户的profile,添加
export ORACLE_SID=YCR12C
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
umask 022

开始安装
[oracle@jing1 database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB. Actual 175184 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16127 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-12-01_10-12-43AM. Please wait ...[oracle@jing1 database]$








[root@jing1 db_1]# ./root.sh
Performing root user operation.

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/12.2.0/db_1

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.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /u01/app/oracle/product/12.2.0/db_1/install/root_jing1_2017-12-01_10-21-20-447877904.log
Finished installing Oracle Trace File Analyzer (TFA)

安装过程
[oracle@jing1 database]$ ./runInstaller
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB. Actual 175184 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16127 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-12-01_10-12-43AM. Please wait ...[oracle@jing1 database]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2017-12-01_10-12-43AM.log


创建数据库
使用oracle用户














处理方法:
根据文档
Database Creation in Oracle Restart Environment Fails With "ORA-01017: Invalid Username/password" (文档 ID 2108268.1)
[root@jing1 db_1]# id grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper)
[root@jing1 db_1]# usermod -a -G dba grid
[root@jing1 db_1]# id grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1200(asmadmin),1201(asmdba),1202(asmoper),1300(dba)
重新运行dbca,要删除之前创建的YCR12C数据库,在dbca中选择delete database即可
按照上面截图的不忠重新运行即可,选项不必盖面,本次成功

安装完成后查看监听正常:
[oracle@jing1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 01-DEC-2017 11:07:31

Copyright (c) 1991, 2016, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 01-DEC-2017 09:58:42
Uptime 0 days 1 hr. 8 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/jing1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=jing1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "5f3f946fc4442e02e053ec02870a3fb7" has 1 instance(s).
Instance "YCR12C", status READY, has 1 handler(s) for this service...
Service "YCR12C" has 1 instance(s).
Instance "YCR12C", status READY, has 1 handler(s) for this service...
Service "YCR12CXDB" has 1 instance(s).
Instance "YCR12C", status READY, has 1 handler(s) for this service...
Service "ycr12cpdb" has 1 instance(s).
Instance "YCR12C", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@jing1 admin]$

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29135257/viewspace-2148132/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29135257/viewspace-2148132/

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值