11g静默安装 centos系统

前端之家收集整理的这篇文章主要介绍了11g静默安装 centos系统前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1安装前环境:

操作系统:CetnOS6.6x64最小化安装,已配置好网络IP:10.10.10.12,物理内存32GB,硬盘300GB。

已下载:linux.x64_11gR2_database_1of2.zip

linux.x64_11gR2_database_2of2.zip

位于目录:/sharedisk/11G/

binutilscompat-libcap1compat-libstdc++-33gccgcc-c++glibcglibc-devellibgcclibstdc++libstdc++-devellibaiolibaio-develmakesysstatunixODBCunixODBC-develelfutils-libelf-develpdksh

2准备工作

root用户登录

#yuminstallunzip//下载unzip,用来解压上述两个压缩文件

#cd/opt/hadoop///切换当前目录到oracle压缩文件所在目录

#unziplinux.x64_11gR2_database_1of2.zip//解压

#unziplinux.x64_11gR2_database_2of2.zip

解压后新增一个/opt/hadoop/database目录,里面是解压后的所有oracle安装文件

在/etc/hosts文件增加主机名(通过hostname获得)到回环IP的映射如下:

#vi/etc/hosts

127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4

::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6

10.10.10.12ora11g

#vi/etc/selinux/confg设置SELINUX=disabled

#setenforce0//关闭selinux

#serviceiptablesstop//临时关闭防火墙

3安装必须的包

#yuminstallnfs-utils//可以挂载nfsserver

#yuminstallgccmakebinutilsgcc-c++compat-libstdc++-33elfutils-libelf-develelfutils-libelf-devel-statickshlibaiolibaio-develnumactl-develsysstatunixODBCunixODBC-develpcre-devel

检查那些包没有安装成功

rpm-q--queryformat%-{name}-%{version}-%{release}-%{arch}"\n"\compat-dbcompat-gcc-34compat-gcc-34-c++compat-libstdc++-33glibc-*glibc-*.i686libXpm-*.i686libXp.so.6libXt.so.6libXtst.so.6libgcc_s.so.1kshlibXplibaio-develnumactlnumactl-develunixODBCunixODBC-devel

4准备安装用户用户

#groupaddoinstall

#groupadddba

#useradd-goinstall-Gdbaoracle

#passwdoracle//设置oracle密码

5修改内核参数配置文件

#vi/etc/sysctl.conf在文件最后增加(根据文档要求kernel.shmmax设成物理内存的一半最合理)

fs.aio-max-nr=1048576

fs.file-max=6553600

kernel.shmall=2097152

kernel.shmmax=8588934592

kernel.shmmni=4096

kernel.sem=25032000100128

net.ipv4.ip_local_port_range=102465000

net.core.rmem_default=262144

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

保存文件

#/sbin/sysctl-p//让参数生效

6修改用户的限制文件

#vi/etc/security/limits.conf在文件增加

oraclesoftnproc2047

oraclehardnproc16384

oraclesoftnofile1024

oraclehardnofile65536

oraclesoftstack10240

保存文件

修改/etc/pam.d/login文件增加如下:

sessionrequired/lib64/security/pam_limits.so//64位系统时,千万别写成错/lib/security/pam_limits.so//否则导致无法登录

sessionrequiredpam_limits.so

修改/etc/profile,增加---不加也可以

if[$USER="oracle"];then

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

ulimit-p16384

ulimit-n65536

else

ulimit-u16384-n65536

fi

fi

7创建安装目录和设置文件权限

#mkdir-p/u01/app/oracle/product/11.2.0//数据库系统安装目录

#mkdir/u01/app/oracle/oradata//数据库数据安装目录

#mkdir/u01/app/oracle/inventory //此目录最好单独放一个目录下,不要放在oracle安装目录下

#mkdir/u01/app/oracle/fast_recovery_area //此目录最好单独放一个目录下,不要放在oracle安装目录下

#chown-Roracle:oinstall/u01/app/oracle

chown-Roracle:oinstall/opt/hadoop/database/

#chmod-R775/u01/app/oracle

设置环境变量:修改/home/oracle/.bash_profile文件增加如下

#su-oracle

exportORACLE_BASE=/opt/hadoop/u01/app/oracle

exportORACLE_HOME=$ORACLE_BASE/product/11.2.0

exportORACLE_SID=ora11

exportPATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/bin

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib

8编辑静默安装响应文件

$cp-R/sharedisk/11G/database/response/home/oracle//复制一份模板

$cd/home/oracle/response

$vidb_install.rsp//开始修改这个安装响应文件文件只是安装数据库软件

需要设置的选项如下:

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0//系统生成的,不要修改

oracle.install.option=INSTALL_DB_SWONLY//只安装软件,不安装启动数据库

ORACLE_HOSTNAME=ora11g//通过hostname命令获得

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oracle/inventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/u01/app/oracle/product/11.2.0

ORACLE_BASE=/u01/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=dba

DECLINE_SECURITY_UPDATES=true//一定要设置为true

9根据响应文件安装oracle

$cd/sharedisk/11G/database

$./runInstaller-silent-responseFile/home/oracle/response/db_install.rsp-ignorePrereq

StartingOracleUniversalInstaller...

CheckingTempspace:mustbegreaterthan120MB.Actual1240MBPassed

Checkingswapspace:0MBavailable,150MBrequired.Failed<<<<

Checkingmonitor:mustbeconfiguredtodisplayatleast256colors

>>>Couldnotexecuteautocheckfordisplaycolorsusingcommand/usr/bin/xdpyinfo.CheckiftheDISPLAYvariableisset.Failed<<<<

SomerequirementchecksFailed.Youmustfulfilltheserequirementsbefore

continuingwiththeinstallation,

Continue?(y/n)[n]y

安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。打开另一个终端,执行

#tail-100f/u01/app/oracle/inventory/logs/installActions......log

可以实时跟踪查看安装日志,了解安装的进度。

当出现如下提示,既安装成功:

beexecutedasthe"root"user.

#!/bin/sh

#Rootscriptstorun

/u01/app/oracle/inventory/orainstRoot.sh

/u01/app/oracle/product/11.2.0/root.sh

Toexecutetheconfigurationscripts:

1.Openaterminalwindow

2.Loginas"root"

3.Runthescripts

4.Returntothiswindowandhit"Enter"keytocontinue

SuccessfullySetupSoftware.

表示安装成功了。按照其提示操作。

$exit//退回到root

#sh/u01/app/oracle/inventory/orainstRoot.sh

#sh/u01/app/oracle/product/11.2.0/root.sh

10静默配置监听

$netca/silent/responsefile/home/oracle/response/netca.rsp

Parsingcommandlinearguments:

Parameter"silent"=true

Parameter"responsefile"=/home/oracle/response/netca.rsp

Doneparsingcommandlinearguments.

OracleNetServicesConfiguration:

Profileconfigurationcomplete.

OracleNetListenerStartup:

RunningListenerControl:

/u01/app/oracle/product/11.2.0/bin/lsnrctlstartLISTENER

ListenerControlcomplete.

Listenerstartedsuccessfully.

Listenerconfigurationcomplete.

OracleNetServicesconfigurationsuccessful.Theexitcodeis0

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

通过netstat–tlnp命令,看到

tcp00:::1521:::*LISTEN10760/tnslsnr

说明监听器已经在1521端口上开始工作了。

11静默建立新库(同时也建立一个对应的实例)

修改/home/oracle/response/dbca.rsp,设置如下:

[GENERAL]

RESPONSEFILE_VERSION="11.2.0"//不能更改

OPERATION_TYPE="createDatabase"

[CREATEDATABASE]

GDBNAME="ora11"//数据库的名字

SID="ora11"//对应的实例名字

TEMPLATENAME="General_Purpose.dbc"//建库用的模板文件

SYSPASSWORD="oracle"//SYS管理员密码

SYSTEMPASSWORD="oracle"//SYSTEM管理员密码

DATAFILEDESTINATION=/u01/app/oracle/oradata//数据文件存放目录

RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area//恢复数据存放目录

CHARACTERSET="ZHS16GBK"//字符集,重要!!!建库后一般不能更改,所以建库前要确定清楚。

TOTALMEMORY="3276"//oracle内存3276MB(allmem*80%)

静默建库命令如下

$dbca-silent-responseFile/home/oracle/response/dbca.rsp

Copyingdatabasefiles

1%complete

3%complete

11%complete

18%complete

26%complete

37%complete

CreatingandstartingOracleinstance

40%complete

45%complete

50%complete

55%complete

56%complete

60%complete

62%complete

CompletingDatabaseCreation

66%complete

70%complete

73%complete

85%complete

96%complete

100%complete

Lookatthelogfile"/u01/app/oracle/cfgtoollogs/dbca/ora11/ora11.log"forfurtherdetails.

查看日志文件

$cat/u01/app/oracle/cfgtoollogs/dbca/ora11/ora11.log

DBCA_PROGRESS:1%

DBCA_PROGRESS:3%

DBCA_PROGRESS:11%

DBCA_PROGRESS:18%

DBCA_PROGRESS:26%

DBCA_PROGRESS:37%

DBCA_PROGRESS:40%

DBCA_PROGRESS:45%

DBCA_PROGRESS:50%

DBCA_PROGRESS:55%

DBCA_PROGRESS:56%

DBCA_PROGRESS:60%

DBCA_PROGRESS:62%

DBCA_PROGRESS:66%

DBCA_PROGRESS:70%

DBCA_PROGRESS:73%

DBCA_PROGRESS:85%

DBCA_PROGRESS:96%

DBCA_PROGRESS:100%

Databasecreationcomplete.Fordetailscheckthelogfilesat:

/u01/app/oracle/cfgtoollogs/dbca/ora11.

DatabaseInformation:

GlobalDatabaseName:ora11

SystemIdentifier(SID):ora11

建库后实例检查:

$ps-ef|grepora_|grep-vgrep

oracle112791012:04?00:00:00ora_pmon_ora11

oracle112811112:04?00:00:02ora_vktm_ora11

oracle112851012:04?00:00:00ora_gen0_ora11

oracle112871012:04?00:00:00ora_diag_ora11

oracle112891012:04?00:00:00ora_dbrm_ora11

oracle112911012:04?00:00:00ora_psp0_ora11

oracle112931012:04?00:00:00ora_dia0_ora11

oracle112951012:04?00:00:00ora_mman_ora11

oracle112971012:04?00:00:00ora_dbw0_ora11

oracle112991012:04?00:00:00ora_lgwr_ora11

oracle113011012:04?00:00:01ora_ckpt_ora11

oracle113031012:04?00:00:00ora_smon_ora11

oracle113051012:04?00:00:00ora_reco_ora11

oracle113071112:04?00:00:02ora_mmon_ora11

oracle113091012:04?00:00:01ora_mmnl_ora11

oracle113111012:04?00:00:00ora_d000_ora11

oracle113131012:04?00:00:00ora_s000_ora11

oracle113231012:04?00:00:01ora_qmnc_ora11

oracle113401012:04?00:00:01ora_cjq0_ora11

oracle113421012:04?00:00:01ora_q000_ora11

oracle113441012:04?00:00:00ora_q001_ora11

查看监听状态

$lsnrctlstatus

LSNRCTLforLinux:Version11.2.0.1.0-Productionon26-AUG-201412:07:54

Copyright(c)1991,2009,Oracle.Allrightsreserved.

Connectingto(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUSoftheLISTENER

------------------------

AliasLISTENER

VersionTNSLSNRforLinux:Version11.2.0.1.0-Production

StartDate26-AUG-201411:11:10

Uptime0days0hr.56min.44sec

TraceLeveloff

SecurityON:LocalOSAuthentication

SNMPOFF

ListenerParameterFile/u01/app/oracle/product/11.2.0/network/admin/listener.ora

ListenerLogFile/u01/app/oracle/diag/tnslsnr/ora11g/listener/alert/log.xml

ListeningEndpointsSummary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora11g)(PORT=1521)))

ServicesSummary...

Service"ora11"has1instance(s).

Instance"ora11",statusREADY,has1handler(s)forthisservice...

Service"ora11XDB"has1instance(s).

Thecommandcompletedsuccessfully

12修改数据库为归档模式(归档模式才能热备份,增量备份)

$sqlplus/assysdba

sql*Plus:Release11.2.0.1.0ProductiononTueAug2613:37:342014

Copyright(c)1982,255)">Connectedto:

OracleDatabase11gEnterpriseEditionRelease11.2.0.1.0-64bitProduction

WiththePartitioning,OLAP,DataMiningandRealApplicationTestingoptions

sql>shutdownimmediate;

Databaseclosed.

Databasedismounted.

ORACLEinstanceshutdown.

sql>startupmount

ORACLEinstancestarted.

TotalSystemGlobalArea1603411968bytes

FixedSize2213776bytes

VariableSize402655344bytes

DatabaseBuffers1191182336bytes

RedoBuffers7360512bytes

Databasemounted.

sql>alterdatabasearchivelog;

Databasealtered.

sql>alterdatabaseflashbackon;

sql>alterdatabaSEOpen;

sql>executeutl_recomp.recomp_serial();

PL/sqlproceduresuccessfullycompleted.

sql>altersystemarchivelogcurrent;

Systemaltered.

sql>exit

13修改oracle启动配置文件

$vi/etc/oratab

ora11:/u01/app/oracle/product/11.2.0:Y

这样就可以通过dbstart启动此实例,也可以通过dbshut关闭此实例了。

$dbshut/u01/app/oracle/product/11.2.0

ProcessingDatabaseinstance"ora11":logfile/u01/app/oracle/product/11.2.0/shutdown.log

此时所有oracle的进程关闭,监听器也停止。

$dbstart/u01/app/oracle/product/11.2.0

ProcessingDatabaseinstance"ora11":logfile/u01/app/oracle/product/11.2.0/startup.log

此时监听器工作,hello实例运行,再次查看监听器状态。

开机启动方法

方法1:

要想让oracle服务随着系统启动而自动启动,需要在/etc/rc.local文件增加如下:

su-oracle-c"/u01/app/oracle/product/11.2.0/bin/dbstart/u01/app/oracle/product/11.2.0"

方法2:建立启动脚本

#vi/etc/rc.d/init.d/oracle

#!/bin/bash

#oracle:Start/StopOracleDatabase11gR2

#

#chkconfig:3459010

#description:TheOracleDatabaseisanObject-RelationalDatabaseManagementSystem.

#processname:oracle

./etc/rc.d/init.d/functions

LOCKFILE=/var/lock/subsys/oracle

ORACLE_HOME=/u01/app/oracle/product/11.2

ORACLE_USER=oracle

case"$1"in

'start')

if[-f$LOCKFILE];then

echo$0alreadyrunning.

exit1

echo-n$"StartingOracleDatabase:"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/lsnrctlstart"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/dbstart$ORACLE_HOME"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/emctlstartdbconsole"

touch$LOCKFILE

;;

'stop')

if[!-f$LOCKFILE];then

echo$0alreadystopping.

echo-n$"StoppingOracleDatabase:"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/lsnrctlstop"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/dbshut"

su-$ORACLE_USER-c"$ORACLE_HOME/bin/emctlstopdbconsole"

rm-f$LOCKFILE

'restart')

$0stop

$0start

'status')

echo$0started.

echo$0stopped.

*)

echo"Usage:$0[start|stop|status]"

esac

exit0

#serviceoracleon

猜你在找的CentOS相关文章