您当前所在位置:首页安装教程Linux系统下oracle数据库静默安装

Linux系统下oracle数据库静默安装

更新:2023-08-09 06:43:35编辑:tooool归类:安装教程人气:78

Linux系统下oracle数据库静默安装

Linux系统下oracle数据库静默安装

介质准备

链接:https://pan.baidu.com/s/10sfp_4fw5m-lIJdEGTRWmw

提取码:grr6

安装前参数配置

1.配置主机IP和主机名,修改vim /etc/hosts文件

2.修改用户的shell的限制,修改vim /etc/security/limits.conf文件

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

3.修改vim /etc/pam.d/login文件

session required /lib64/security/pam_limits.so

session required pam_limits.so

4.修改Linux内核,修改vim /etc/sysctl.conf文件

net.ipv4.ip_local_port_range= 9000 65500

表示允许系统打开的端口范围

fs.file-max = 6815744

该参数决定了系统中所允许的文件句柄最大数目,文件句柄设置代表linux系统中可以打开的文件的数量。

kernel.shmall = 2097152

这里配置物理内存的四分之一,单位是k。比如物理内存是16G,这个值就是4G*1024*1024=4194304

kernel.shmmax = 2147483648

这里配置物理内存的一半,单位是字节。比如物理内存是16G,这个值就是8Gx1024x1024x1024=1073741824

kernel.shmmni = 6144

共享内存段的最大数量

kernel.sem = 250 32000 100 128

第一列,表示每个信号集中的最大信号量数目(250);第二列,表示系统范围内的最大信号量总数目(32000);第三列,表示每个信号发生时的最大系统操作数(100);第四列,表示系统范围内的最大信号集总数目(128)。

net.core.rmem_default=4194304

接收套接字缓冲区大小的默认值(以字节为单位)

net.core.wmem_default=262144

接收套接字缓冲区大小的最大值(以字节为单位)。

net.core.rmem_max=4194304

发送套接字缓冲区大小的默认值(以字节为单位)。

net.core.wmem_max=1048576

发送套接字缓冲区大小的最大值(以字节为单位)。

fs.aio-max-nr = 1048576

此参数限制并发未完成的异步请求数目,应该设置避免I/O子系统故障。

要使修改的配置文件立即生效,执行sysctl -p

5.修改vim /etc/profile文件

if [ $USER = "oracle" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

fi

6.oracle依赖包yum安装

yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 kshlibgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp

新建用户和用户组

groupadd oinstall 新建用户组

groupadd dba 新建用户组

useradd -g oinstall -G dba oracle 创建用户并将用户组首先设置成oinstal,其次dba

passwd oracle 设置密码

id oracle 查看用户组

新建目录,授权给用户、用户组

新建目录:

mkdir -p /home/app/oracle/product/11.2.0/dbhome_1

mkdir -p /home/oracle/backup

mkdir -p /home/oracle/oraInventory

目录授权:

chown -R oracle:oinstall /home/app

chown -R oracle:oinstall /home/oracle/backup

chown -R oracle:oinstall /home/oracle/oraInventory

chmod -R 775 /home/app

Oracle用户环境变量配置

切换到oracle,对vim .bash_profile配置进行如下参数配置

export ORACLE_BASE=/home/app

export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1

export ORACLE_SID=orcl

export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

source .bash_profile 重新加载配置文件

数据库安装

1.将oracle数据库安装包上传到/home/app/oracle/目录下,进行解压

unzip linux.x64_11gR2_database_1of2.zip

unzip linux.x64_11gR2_database_1of2.zip

解压后得到database目录,其中response目录里面有三个rsp文件,对三个配置文件进行配置(/home/app/oracle/database/response),将配置文件目录response拷贝到/home/oracle目录下备份。

scp -r /home/app/oracle/database/response /home/oracle

dbca.rsp //安装应答

db_install.rsp //创建数据库应答

netca.rsp //建立监听,本地服务名等网络设置

2.修改db_install.rsp配置文件

查看db_install.rsp配置文件参数(cat db_install.rsp | grep -v ^ | grep -v ^$),对红色部门参数进行修改

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=linux2

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/home/oracle/oraInventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/home/app/oracle/product/11.2.0/dbhome_1

ORACLE_BASE=/home/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.isCustomInstall=false

oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=oinstall

oracle.install.db.CLUSTER_NODES=

oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

oracle.install.db.config.starterdb.globalDBName=orcl

oracle.install.db.config.starterdb.SID=orcl

oracle.install.db.config.starterdb.characterSet=AL32UTF8

oracle.install.db.config.starterdb.memoryOption=true

oracle.install.db.config.starterdb.memoryLimit=1024

oracle.install.db.config.starterdb.installExampleSchemas=false

oracle.install.db.config.starterdb.enableSecuritySettings=true

oracle.install.db.config.starterdb.password.ALL=oracle

oracle.install.db.config.starterdb.password.SYS=

oracle.install.db.config.starterdb.password.SYSTEM=

oracle.install.db.config.starterdb.password.SYSMAN=

oracle.install.db.config.starterdb.password.DBSNMP=

oracle.install.db.config.starterdb.control=DB_CONTROL

oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=

oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false

oracle.install.db.config.starterdb.dbcontrol.emailAddress=

oracle.install.db.config.starterdb.dbcontrol.SMTPServer=

oracle.install.db.config.starterdb.automatedBackup.enable=false

oracle.install.db.config.starterdb.automatedBackup.osuid=

oracle.install.db.config.starterdb.automatedBackup.ospwd=

oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE

oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

oracle.install.db.config.asm.diskGroup=

oracle.install.db.config.asm.ASMSNMPPassword=

MYORACLESUPPORT_USERNAME=

MYORACLESUPPORT_PASSWORD=

SECURITY_UPDATES_VIA_MYORACLESUPPORT=

DECLINE_SECURITY_UPDATES=true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

3.执行安装

进入到 /home/app/oracle/database目录下,执行如下安装命令:

./runInstaller -silent -responseFile /home/app/oracle/database/response/db_install.rsp

出现如下界面,在root用户执行sh/home/oracle/oraInventory/orainstRoot.shsh/home/app/oracle/product/11.2.0/dbhome_1/root.sh权限脚本

4.配置Oracle监听

进入到/home/app/oracle/database/response目录下,执行如下命令

netca /silent /responsefile /home/app/oracle/database/response/netca.rsp

运行成功之后,在/home/app/oracle/product/11.2.0/dbhome_1/network/admin目录下会生成sqlnet.ora和listener.ora两个文件

执行netstat -tlnp | grep 1521命令,查看监听器是否已经在1521端口上开始工作了

5.配置Oracle数据库

进入到/home/app/oracle/database/response目录下,对dbca.rsp配置文件如下参数修改:

GDBNAME = "orcl.us.oracle.com" //78 行 全局数据库的名字=SID+主机域名

SID="orcl" //149行 SID

SYSPASSWORD = "oracle" //190行

SYSTEMPASSWORD = "oracle" //200行

CHARACTERSET="AL32UTF8" //415行 编码

NATIONALCHARACTERSET="UTF8" //425行 编码

6.创建数据库

$ORACLE_HOME/bin/dbca -silent -responseFile /home/app/oracle/database/response/dbca.rsp

7.启动数据

sqlplus /nolog

conn /as sysdba

startup

已启动,会提示如下错误,表示数据库安装成功

未启动,报如下错误

处理方法

在执行startup命令,启动实例成功

开放端口及测试

开放端口号:

firewall-cmd --zone=public --add-port=1521/tcp --permanent

firewall-cmd --reload 重新加载规则

使用Navicat工具测试是否可以连接成功,如下图所示

数据库表空间、用户授权

1.创建表空间

create tablespace oracle

logging

datafile\oracle.dbf

size 1G

autoextend on

next 64m

extent management local;

2.创建用户并将表空间授权给用户

create user oracle

identified by oracle

default tablespace oracle

temporary tablespace TEMP

profile default

account unlock;

3.授权用户角色、最大表空间

--授权用户角色

grant connect,resource,create view to oracle;

--授予用户无限制使用最大表空间

grant unlimited tablespace to oracle;

数据库的备份、恢复

备份

exp oracle/oracle@orcl file=/home/oracle/oracle.dmp full=y;

恢复

imp oracle/oracle@orcl file=/home/oracle/oracle.dmp ignore=y full=y;

自启脚本

1.查找启动和关闭数据库脚本所在目录位置

启动(dbstart):

find -name dbstart (oracle用户下搜索dbstart文件所在位置)

关闭(dbshut):

find -name dbshut (oracle用户下搜索dbshut文件所在位置)

2.修改数据库启动和关闭文件

启动(dbstart):

vim /home/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

文件中的ORACLE_HOME_LISTNER=$1修改为:

"ORACLE_HOME_LISTNER=$ORACLE_HOME"

关闭(dbshut):

vim /home/app/oracle/product/11.2.0/dbhome_1/bin/dbshut

文件中的ORACLE_HOME_LISTNER=$1修改为:

"ORACLE_HOME_LISTNER=$ORACLE_HOME"

3.新建oracle启动脚本

vim/etc/init.d/oracle

!/bin/sh

chkconfig: 345 61 61

description: Oracle 11g R2 AutoRun Servimces

/etc/init.d/oracle

Run-level Startup script for the Oracle Instance, Listener, and

Web Interface

export ORACLE_BASE=/home/app

export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1

export ORACLE_SID=orcl

export ORACLE_UNQNAME=$ORACLE_SID

export PATH=$ORACLE_HOME/bin:/user/sbin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

ORA_OWNR="oracle"

if the executables do not exist -- display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]

then

echo "Oracle startup: cannot start"

exit 1

fi

depending on parameter -- startup, shutdown, restart

of the instance and listener or usage display

case "$1" in

start)

Oracle listener and instance startup

su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart

echo "Oracle Start Succesful!OK."

;;

stop)

Oracle listener and instance shutdown

su $ORA_OWNR -lc $ORACLE_HOME/bin/dbshut

echo "Oracle Stop Succesful!OK."

;;

reload|restart)

$0 stop

$0 start

;;

*)

echo $"Usage: `basename $0` {start|stop|reload|reload}"

exit 1

esac

exit 0

4.修改文件执行权限

chmod 750 /etc/rc.d/init.d/oracle

5.查看脚本是否可以执行

cd /etc/rc.d/init.d

./oracle start 或 sh oracle start 启动数据库

./oracle stop 或 sh oracle stop 关闭数据库

6.修改oratab文件

vim /etc/oratab

将orcl:/home/app/oracle/product/11.2.0/dbhome_1:N

改为orcl:/home/app/oracle/product/11.2.0/dbhome_1:Y

7.设置启动级别

ln -s /etc/rc.d/init.d/oracle /etc/rc2.d/S61oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc3.d/S61oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc4.d/S61oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc0.d/K61oracle

ln -s /etc/rc.d/init.d/oracle /etc/rc6.d/K61oracle

chkconfig --level 234 oracle on

chkconfig --add oracle

8.验证oracle是否开机自启

ps -ef |grep oracle

我告诉你msdn版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

oracle11g部署搭建 Win10任务栏通知消息图标、音量图标点击无反应如何解决

游客 回复需填写必要信息