oracle 11G 静默安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 11G 静默安装相关的知识,希望对你有一定的参考价值。

首先上传:

技术分享

上传两个database软件包到/dir 目录下

Unzip p13390677_112040_Linux-x86-64_1of7.zip

Unzip p13390677_112040_Linux-x86-64_2of7.zip

请记住这两个软件包一个一个解压。

[[email protected] dir]#groupadd oinstall   创建安装组

[[email protected] dir]#useradd -g oinstall -d /home/oracle oracle 创建安装用户oracle

[[email protected] dir]#echo oracle |passwd  --stdin oracle  赋予oracle用户密码为:oracle

编辑oracle 参数文件

[[email protected] ~]$more .bash_profile

# .bash_profile

 

# Get the aliasesand functions

if [ -f ~/.bashrc]; then

        . ~/.bashrc

fi

 

# User specificenvironment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

 

exportORACLE_BASE=/u01/app/oracle

exportORACLE_HOME=/u01/app/oracle/product/11.2.4/db_home1

exportORACLE_SID=db2

 

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

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

 

if [$USER = "oracle" ]; then

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

                ulimit -p 16384

                ulimit -p 65536

        else

                ulimit -u 16384 -n 65536

        fi

fi

 

umask 022

标红的部分在oracle11GR2以前版本是必须的、到了oracle11GR2以后版本可以不写。

Vim  /etc/sysctl.conf    加入如下:

fs.aio-max-nr =1048576

fs.file-max =6815744

kernel.shmall =2097152

kernel.shmmax =4294967295

kernel.shmmni =4096

kernel.sem = 25032000 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 =1048576

 

编辑下面文件

[[email protected] ~]#more/etc/security/limits.conf

#for oracle

oracle              soft    nproc  2047

oracle              hard    nproc  16384

oracle              soft    nofile 1024

oracle              hard    nofile 65536

oracle              soft    stack  10240

#for grid

grid              soft    nproc  2047

grid              hard    nproc  16384

grid              soft    nofile 1024

grid              hard    nofile 65536

grid              soft    stack  10240

我这里没有装GI,所以可以不用写。

安装RPM 在这里我就不多说了。

 

 

 

 [[email protected] ~]$ mkdir -pv /u01/app/oracle/product/11.2.4/db_home1

mkdir: created directory `/u01/app‘

mkdir: created directory `/u01/app/oracle‘

mkdir: created directory`/u01/app/oracle/product‘

mkdir: created directory`/u01/app/oracle/product/11.2.4‘

mkdir: created directory `/u01/app/oracle/product/11.2.4/db_home1‘

/u01/app/oracle/product/11.2.4/db_home1这是我的oracle_home目录

/u01/app/oracle 这是我的oracle_base目录

编辑静默安装的响应文件:

在你解压的database文件里面就有响应文件

你只需编辑它即可

[[email protected]]# pwd

/dir/database/response

[[email protected]]#

[[email protected]]# less db.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=qhdb2

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

SELECTED_LANGUAGES=en,zh_CN

ORACLE_HOME=/u01/app/oracle/product/11.2.4/db_home1

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.EEOptionsSelection=false

oracle.install.db.optionalComponents=

oracle.install.db.DBA_GROUP=oinstall

oracle.install.db.OPER_GROUP=oinstall

oracle.install.db.CLUSTER_NODES=

oracle.install.db.isRACOneInstall=false

oracle.install.db.racOneServiceName=

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

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

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

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

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

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

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

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

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

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.automatedBackup.enable=false

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

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

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

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=false

DECLINE_SECURITY_UPDATES=true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

PROXY_REALM=

COLLECTOR_SUPPORTHUB_URL=

oracle.installer.autoupdates.option=SKIP_UPDATES

oracle.installer.autoupdates.downloadUpdatesLoc=

AUTOUPDATES_MYORACLESUPPORT_USERNAME=

AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

[[email protected]]#

[[email protected]]$ ./runInstaller   -silent-responseFile /dir/database/response/db.rsp

Starting OracleUniversal Installer...

 

Checking Tempspace: must be greater than 120 MB.  Actual 15219 MB    Passed

Checking swapspace: must be greater than 150 MB.  Actual 8149 MB    Passed

Preparing to launchOracle Universal Installer from /tmp/OraInstall2016-12-09_09-59-49AM. Pleasewait ...[[email protected] database]$ [WARNING] [INS-13014] Target environment donot meet some optional requirements.

   CAUSE: Some of the optional prerequisitesare not met. See logs for details./u01/app/oraInventory/logs/installActions2016-12-09_09-59-49AM.log

   ACTION: Identify the list of failedprerequisite checks from the log:/u01/app/oraInventory/logs/installActions2016-12-09_09-59-49AM.log. Then eitherfrom the log file or from installation manual find the appropriateconfiguration to meet the prerequisites and fix it manually.

You can find thelog of this install session at:

 /u01/app/oraInventory/logs/installActions2016-12-09_09-59-49AM.log

The installation ofOracle Database 11g was successful.

Please check‘/u01/app/oraInventory/logs/silentInstall2016-12-09_09-59-49AM.log‘ for moredetails.

 

As a rootuser, execute the following script(s):

        1./u01/app/oracle/product/11.2.4/db_home1/root.sh

 

 

Successfully SetupSoftware.

OK安装完成、在这里它提示您要以root身份执行

/u01/app/oracle/product/11.2.4/db_home1/root.sh

这个脚本。

[[email protected] ~]#/u01/app/oracle/product/11.2.4/db_home1/root.sh

[[email protected] ~]#/u01/app/oracle/product/11.2.4/db_home1/root.sh

Check/u01/app/oracle/product/11.2.4/db_home1/install/root_qhdb2_2016-12-09_10-03-22.logfor the output of root script

[[email protected] ~]#more /u01/app/oracle/product/11.2.4/db_home1/install/root_qhdb2_2016-12-09_10-03-22.log

Performing rootuser operation for Oracle 11g

 

The followingenvironment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/11.2.4/db_home1

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

Entries will beadded to the /etc/oratab file as needed by

DatabaseConfiguration Assistant when a database is created

Finished runninggeneric part of root script.

Nowproduct-specific root actions will be performed.

Finishedproduct-specific root actions.

Finishedproduct-specific root actions.

[[email protected] ~]#

OK执行完毕、你可以查看日志。YES

配置监听,我觉得我们使用默认的监听即可。不需要做任何修改

[[email protected]]# less netca.rsp  | grep -v"#" |grep -v "^$"

[GENERAL]

RESPONSEFILE_VERSION="11.2"

CREATE_TYPE="CUSTOM"

[oracle.net.ca]

INSTALLED_COMPONENTS={"server","net8","javavm"}

INSTALL_TYPE=""typical""

LISTENER_NUMBER=1

LISTENER_NAMES={"LISTENER"}

LISTENER_PROTOCOLS={"TCP;1521"}

LISTENER_START=""LISTENER""

NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}

NSN_NUMBER=1

NSN_NAMES={"EXTPROC_CONNECTION_DATA"}

NSN_SERVICE={"PLSExtProc"}

NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

[[email protected]]#

创建监听

[[email protected]]$ $ORACLE_HOME/bin/netca -silent -responseFile/dir/database/response/netca.rsp

 

Parsing commandline arguments:

    Parameter "silent" = true

    Parameter "responsefile" =/dir/database/response/netca.rsp

Done parsingcommand line arguments.

Oracle Net ServicesConfiguration:

Profileconfiguration complete.

Oracle Net ListenerStartup:

    Running Listener Control:

     /u01/app/oracle/product/11.2.4/db_home1/bin/lsnrctl start LISTENER

    Listener Control complete.

    Listener started successfully.

Listenerconfiguration complete.

Oracle Net Servicesconfiguration successful. The exit code is 0

OK 监听已经完成。

[[email protected]]$ lsnrctl status

 

LSNRCTL for Linux:Version 11.2.0.4.0 - Production on 09-DEC-2016 10:29:07

 

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

 

Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1522)))

STATUS of theLISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version11.2.0.4.0 - Production

Start Date                09-DEC-2016 10:28:20

Uptime                    0 days 0 hr. 0 min. 47 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener ParameterFile   /u01/app/oracle/product/11.2.4/db_home1/network/admin/listener.ora

Listener LogFile        /u01/app/oracle/diag/tnslsnr/qhdb2/listener/alert/log.xml

Listening EndpointsSummary...

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

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=qhdb2)(PORT=1522)))

The listenersupports no services

The commandcompleted successfully

启动监听OK

 

 

 

接下来我们就是静默安装建库 DBCA

[[email protected]]# less dbca.rsp   | grep -v"#" |grep -v "^$"

[GENERAL]

RESPONSEFILE_VERSION= "11.2.0"

OPERATION_TYPE ="createDatabase"

[CREATEDATABASE]

GDBNAME ="orcl11g.us.oracle.com"  实例名+主机名

SID ="orcl11g"

TEMPLATENAME ="General_Purpose.dbc"

[createTemplateFromDB]

SOURCEDB ="myhost:1521:orcl"

SYSDBAUSERNAME ="system"

TEMPLATENAME ="My Copy TEMPLATE"

[createCloneTemplate]

SOURCEDB ="orcl"

TEMPLATENAME ="My Clone TEMPLATE"

[DELETEDATABASE]

SOURCEDB ="orcl"

[generateScripts]

TEMPLATENAME ="New Database"

GDBNAME ="orcl11.us.oracle.com"

[CONFIGUREDATABASE]

[ADDINSTANCE]

DB_UNIQUE_NAME = "orcl11g.us.oracle.com"

NODELIST=

SYSDBAUSERNAME ="sys"

[DELETEINSTANCE]

DB_UNIQUE_NAME ="orcl11g.us.oracle.com"

INSTANCENAME ="orcl11g"

SYSDBAUSERNAME ="sys"

这是dbca.rsp响应文件在这里、我们可以修改。

以下是我的dbca.rsp相应文件  大家可以参考借鉴

[GENERAL]

RESPONSEFILE_VERSION= "11.2.0"

OPERATION_TYPE ="createDatabase"

[CREATEDATABASE]

GDBNAME ="db2.qhdb2"

SID ="db2"

TEMPLATENAME ="General_Purpose.dbc"

[createTemplateFromDB]

SOURCEDB ="myhost:1521:db2"

SYSDBAUSERNAME ="system"

TEMPLATENAME ="My Copy TEMPLATE"

[createCloneTemplate]

SOURCEDB ="db2"

TEMPLATENAME ="My Clone TEMPLATE"

CHARACTERSET="ZHS16GBK"     这是我加上去的

[DELETEDATABASE]

SOURCEDB ="db2"

[generateScripts]

TEMPLATENAME ="New Database"

GDBNAME ="db2.qhdb2"

[CONFIGUREDATABASE]

[ADDINSTANCE]

DB_UNIQUE_NAME = "db2.qhdb2"

NODELIST=

SYSDBAUSERNAME ="sys"

[DELETEINSTANCE]

DB_UNIQUE_NAME ="db2.qhdb2"

INSTANCENAME ="db2"

SYSDBAUSERNAME ="sys"

 开始执行建库

[[email protected]]$ $ORACLE_HOME/bin/dbca -silent -responseFile  /dir/database/response/dbca.rsp

Enter SYS userpassword:

 

Enter SYSTEM userpassword:

 

[[email protected]]$ $ORACLE_HOME/bin/dbca -silent -responseFile  /dir/database/response/dbca.rsp

Enter SYS userpassword:

 

Enter SYSTEM userpassword:

 

Copying databasefiles

1% complete

3% complete

11% complete

18% complete

 

OK

[[email protected]]$ $ORACLE_HOME/bin/dbca -silent -responseFile  /dir/database/response/dbca.rsp

Enter SYS userpassword:

 

Enter SYSTEM userpassword:

 

Copying databasefiles

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating andstarting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

60% complete

62% complete

Completing DatabaseCreation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the logfile "/u01/app/oracle/cfgtoollogs/dbca/db2/db2.log" for furtherdetails.  这是日志信息:

注意要查看日志信息哦!

安珅曾经就不喜欢查看日志、一些简单的报信息不留心 在工作中就遇到过不开心的事情哦!

 

[[email protected]]$

[oracl[email protected] ~]$ps -fle | grep pmon

0 S oracle   40531    1  0  80   0- 470537 poll_s 10:46 ?       00:00:00ora_pmon_db2

0 S oracle   40601 30887 0  80   0 - 25811 pipe_w 10:47 pts/1    00:00:00 grep pmon

OK  instance name  已经OK

我们登录数据库进行查看。

并修改一些参数信息。一定哦。因为这些我们虽然已经建库OK 了,但是在成产环境中 我们还是需要一些参数的修改。

注意:修改前一定要备份好 参数文件哦

[[email protected] ~]$cp /u01/app/oracle/product/11.2.4/db_home1/dbs/spfiledb2.ora /u01/app/oracle/product/11.2.4/db_home1/dbs/spfiledb2.ora.bak

这也是安珅的一个个人习惯、做什么事情之前都需要备份。

 

[[email protected] ~]$export ORACLE_SID=db2

[[email protected] ~]$sqlplus / as sysdba

 

SQL*Plus: Release11.2.0.4.0 Production on Fri Dec 9 10:50:03 2016

 

Copyright (c) 1982,2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11gEnterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning,OLAP, Data Mining and Real Application Testing options

 

SQL>

SQL> show user

USER is"SYS"

SQL> selectstatus from v$instance;

 

STATUS

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

OPEN

 

SQL>

SQL> show  parameter processses;

SQL> alter  system set processes=300 scope=spfile;

 

System altered.  设置最大连接数

SQL> altersystem set recyclebin=off scope=spfile;

 

System altered.    关闭回收站

SQL> altersystem set audit_trail=none scope=spfile;

 

System altered.  关闭审计功能。

开启归档

设置SGA

等等、太多了下次再说吧。

多说一句哦  审计也是oracle的一种安全策略、审计的路径一定是在文件系统上。

在一些大公司、银行、证券金融一般都会开审计、除非不想开、

Oracle建议:DBA和系统工程师分开。

 

 

 

 

 

 

 

 

 

 


本文出自 “redhat-anshen” 博客,请务必保留此出处http://8954925.blog.51cto.com/8944925/1881117

以上是关于oracle 11G 静默安装的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7静默(无图形化界面)安装Oracle 11g

CentOS7.2静默安装Oracle11G

Linux下Oracle11g静默安装

Oracle 11g静默安装

Oracle 11g静默安装

oracle拨云见日第5篇之静默安装11g