龙空技术网

Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考

波波说运维 506

前言:

现在大家对“oracle生成zip”大体比较关心,各位老铁们都需要知道一些“oracle生成zip”的相关资讯。那么小编在网摘上汇集了一些有关“oracle生成zip””的相关内容,希望兄弟们能喜欢,兄弟们快快来了解一下吧!

概述

写一下oracle11g单实例+ASM存储的过程,主要是后面备忘,适合有一定基础的朋友学习,可以做后面安装部署的时候快速参考。

1. 主机准备

IP地址:XX.XX.XX.XX

主机名:bo-DB

目录:/u01

磁盘:从主机本地磁盘资源划分50G硬盘1个,从磁阵资源划分10G硬盘3个

1.1 检查主机名和IP地址的映射:hostname -i

hostname

vi /etc/sysconfig/network

vi /etc/hosts

1.2 分配/u01目录为oracle软件安装目录,lv_asm1,lv_asm2,lv_asm3为ASM磁盘

/dev/xvdb 50G 格式化后挂载到/u01目录

/dev/xvdc /dev/xvde /dev/xvdf 各10G,不用格式化,给ASM使用

pvcreate /dev/xvdc /dev/xvde /dev/xvdfvgcreate ora_vg /dev/xvdc /dev/xvde /dev/xvdflvcreate -L 10g -n lv_asm1 ora_vglvcreate -L 10g -n lv_asm2 ora_vgvgdisplay ora_vglvcreate -l 2557 -n lv_asm3 ora_vg

在后面创建grid用户后,创建ASM前,需要更改lv的磁盘权限

chown grid:asmadmin /dev/mapper/ora*

1.3 配置YUM,安装依赖包

yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh ksh compat-libcap1

若之前安装系统没有安装图形,需要安装图形界面和xterm

yum groupinstall "X Window System"

yum install xterm

1.4 关闭系统防火墙开机启动

service iptables stop

chkconfig iptables off

2. 创建ORACLE 用户和组成员

groupadd oinstallgroupadd dbagroupadd opergroupadd asmadmingroupadd asmdbagroupadd asmoperuseradd -g oinstall -G dba,asmdba,oper oracleuseradd -g oinstall -G dba,asmadmin,asmdba,asmoper grid

分别指定oracle、grid用户的密码

passwd oraclepasswd grid
3. 创建以下目录并赋予对应权限
mkdir -p /u01/app/11.2.0/gridmkdir -p /u01/app/gridmkdir -p /u01/app/oracle/product/11.2.0/db_1chown -R oracle:oinstall /u01/appchmod -R 775 /u01/app
4. 设置oracle、grid用户的环境变量

4.1 oracle用户登陆: vi ~/.bash_profile

export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:.export NLS_LANG=american_america.ZHS16GBKexport ORACLE_SID=nwppexport PATH=$PATH:$ORACLE_HOME/bin:.

4.2 grid用户登录:vi ~/.bash_profile

export ORACLE_BASE=/u01/app/gridexport ORACLE_HOME=/u01/app/11.2.0/gridexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:.export NLS_LANG=American_america.ZHS16GBKexport PATH=$PATH:$ORACLE_HOME/bin:.export ORACLE_SID=+ASM
5. root用户更改系统参数

5.1 vi /etc/sysctl.conf

fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 4398046511104 //一般设置为系统内存75%单位是字节kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586使设置立即生效: /sbin/sysctl -p 

5.2 vi /etc/security/limits.conf

oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240grid soft nproc 2047grid hard nproc 16384grid soft nofile 1024grid hard nofile 65536grid soft stack 1024

5.3 vi /etc/pam.d/login

#oracle

session required /lib64/security/pam_limits.so

session required pam_limits.so

6. 上传Oracle安装介质到/u01/tmp目录下

mkdir -p /u01/tmpp13390677_112040_Linux-x86-64_1of7.zipp13390677_112040_Linux-x86-64_2of7.zipp13390677_112040_Linux-x86-64_3of7.zip
7. 安装grid组件
#cd /u01/tmp/#unzip p10404530_112030_Linux-x86-64_3of7.zip#chown -R grid:oinstall gridXmanager软件用grid用户登录$cd /u01/tmp/grid$./runInstaller图形界面安装,最后root用户执行两个脚本,执行脚本的屏幕输出如下:# /u01/app/oraInventory/orainstRoot.shChanging 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.# /u01/app/11.2.0/grid/root.shPerforming root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/11.2.0/gridEnter 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 byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.plTo configure Grid Infrastructure for a Cluster execute the following command:/u01/app/11.2.0/grid/crs/config/config.shThis command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.
8. 根据上步执行的脚本输出提示,确定单节点需要root用户执行下面的命令
/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
9. 使用asmca创建ASM 磁盘组

Xmanager软件用grid用户登录

$asmca

10. 安装oralce软件

#cd /u01/tmp/#unzip p13390677_112040_Linux-x86-64_1of7.zip;unzip p13390677_112040_Linux-x86-64_2of7.zip#chown -R oracle:oinstall databaseXmanager软件用oracle用户登录$cd /u01/tmp/database/$./runInstaller

图形界面安装,最后root用户执行一个脚本

#/u01/app/oracle/product/11.2.0/db_1/root.sh
11. 创建数据库

Xmanager软件用oracle用户登录

$dbca

图形界面建库,Storage Type选择ASM,+DATA1磁盘组,数据库字符集根据实际情况选择。

12. 使用grid用户创建监听

Xmanager软件用grid用户登录

$netca

13. 客户端测试数据库连接

ping IP地址

tnsping IP地址

sqlplus system/oracle@IP地址/nwpp

14. 由于lv的权限在重启后会变回root用户,需要添加开机启动脚本

vi /etc/rc.d/rc.local

chown grid:asmadmin /dev/mapper/ora*

创建rc.local的链接文件

ln -sf /etc/rc.d/rc.local /etc/rc.d/rc1.d/S999rc.local &&ln -sf /etc/rc.d/rc.local /etc/rc.d/rc2.d/S999rc.local &&ln -sf /etc/rc.d/rc.local /etc/rc.d/rc3.d/S999rc.local &&ln -sf /etc/rc.d/rc.local /etc/rc.d/rc4.d/S999rc.local &&ln -sf /etc/rc.d/rc.local /etc/rc.d/rc5.d/S999rc.local &&ln -sf /etc/rc.d/rc.local /etc/rc.d/rc6.d/S999rc.local
15. 重启测试

15.1 关闭数据库

# su - oracle$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 12 14:14:38 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing optionsSQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL>

15.2 关闭has

$ su - gridPassword:$ crsctl stop hasCRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'bo-db'CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'bo-db'CRS-2673: Attempting to stop 'ora.DATA1.dg' on 'bo-db'CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'bo-db' succeededCRS-2677: Stop of 'ora.DATA1.dg' on 'bo-db' succeededCRS-2679: Attempting to clean 'ora.DATA1.dg' on 'bo-db'CRS-2681: Clean of 'ora.DATA1.dg' on 'bo-db' succeededCRS-2673: Attempting to stop 'ora.asm' on 'bo-db'CRS-2677: Stop of 'ora.asm' on 'bo-db' succeededCRS-2673: Attempting to stop 'ora.cssd' on 'bo-db'CRS-2677: Stop of 'ora.cssd' on 'bo-db' succeededCRS-2673: Attempting to stop 'ora.evmd' on 'bo-db'CRS-2677: Stop of 'ora.evmd' on 'bo-db' succeededCRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'bo-db' has completedCRS-4133: Oracle High Availability Services has been stopped.

15.3 重启主机

# sync# sync# sync# shutdown -Fr nowBroadcast message from root@bo-DB (/dev/pts/0) at 14:20 ...The system is going down for reboot NOW!

15.4主机启动后,查看crs状态

# /u01/app/11.2.0/grid/bin/crsctl stat res -t--------------------------------------------------------------------------------NAME TARGET STATE SERVER STATE_DETAILS --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.DATA1.dg ONLINE ONLINE bo-db ora.LISTENER.lsnr ONLINE ONLINE bo-db ora.asm ONLINE ONLINE bo-db Started ora.ons OFFLINE OFFLINE bo-db --------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.cssd 1 ONLINE ONLINE bo-db ora.diskmon 1 OFFLINE OFFLINE ora.evmd 1 ONLINE ONLINE bo-db ora.nwpp.db 1 OFFLINE OFFLINE Instance Shutdown 

15.5 启动数据库

# /u01/app/11.2.0/grid/bin/srvctl start database -d nwpp# /u01/app/11.2.0/grid/bin/crsctl stat res -t--------------------------------------------------------------------------------NAME TARGET STATE SERVER STATE_DETAILS --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.DATA1.dg ONLINE ONLINE bo-db ora.LISTENER.lsnr ONLINE ONLINE bo-db ora.asm ONLINE ONLINE bo-db Started ora.ons OFFLINE OFFLINE bo-db --------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.cssd 1 ONLINE ONLINE bo-db ora.diskmon 1 OFFLINE OFFLINE ora.evmd 1 ONLINE ONLINE bo-db ora.nwpp.db 1 ONLINE ONLINE bo-db Open 

15.6 客户端测试

C:\Users\Alfred>sqlplus system/oracle@IP地址/nwppSQL*Plus: Release 11.2.0.1.0 Production on 星期四 3月 12 14:27:12 2018Copyright (c) 1982, 2010, Oracle. All rights reserved.连接到:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Automatic Storage Management, OLAP, Data Miningand Real Application Testing optionsSQL>

至此,Linux平台oracle 11g单实例 + ASM存储 安装部署全部完成。

篇幅有限,有些部署文档太长,只能简单写一下分享给大家,大家有空的话可以尝试下,用自己虚拟机模拟磁盘划分,然后按这过程做下来问题不大,有问题的话可以在下方留言,我看到会回复的。

后面会分享更多关于DBA内容,感兴趣的话可以关注下我哦!

标签: #oracle生成zip