Oracle静默安装(单机)

说明:1.操作系统版本为Redhat6.7IP192.168.56.20,主机名:slient

    2.数据库版本为11.2.0.4


一:检查

1.内存(至少1G)

grep MemTotal /proc/meminfo


2.SWAP分区

  内存在2G以下 ,SWAP分区就设置为内存的1.5

  内存在2G8G之间,SWAP就设置为内存大小

  内存在8G以上,SWAP就设置为内存大小的0.75倍。

  查看SWAP分区情况:

 

grep SwapTotal /proc/meminfo

 

3.TMP空间

  要求至少400M

  查看TMP空间

  df -k /tmp

 

4.查看系统补丁包

rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel pdksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat

 

binutils-2.20.51.0.2-5.43.el6.x86_64

package compat-libcap1 is not installed

package compat-libstdc++-33 is not installed

package gcc is not installed

package gcc-c++ is not installed

glibc-2.12-1.166.el6.x86_64

glibc-devel-2.12-1.166.el6.x86_64

package pdksh is not installed

libgcc-4.4.7-16.el6.x86_64

libstdc++-4.4.7-16.el6.x86_64

package libstdc++-devel is not installed

libaio-0.3.107-10.el6.x86_64

package libaio-devel is not installed

make-3.81-20.el6.x86_64

sysstat-9.0.4-27.el6.x86_64

注:pdksh没有安装,可以忽略。安装了ksh。

 

挂在光盘,安装未安装的包,如下:

[root@slient ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        35G  2.9G   31G   9% /

tmpfs           940M   76K  940M   1% /dev/shm

/dev/sda1       477M   41M  411M   9% /boot

/dev/sr0        3.6G  3.6G     0 100% /media/RHEL-6.7 Server.x86_64

[root@slient ~]#

[root@slient ~]# cd /mnt

[root@slient mnt]# mount /dev/sr0 /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only

 

--配置yum源:

vi yum.repo

[base]

name=base

baseurl=file:///mnt/Server  

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[HighAvailability]

name=HighAvailability

baseurl=file:///mnt/HighAvailability

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[ResilientStorage]

name=ResilientStorage

baseurl=file:///mnt/ResilientStorage

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[LoadBalancer]

name=LoadBalancer

baseurl=file:///mnt/LoadBalancer

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

—安装未安装的包:

yum install -y compat-libcap1*

yum install -y compat-libstdc++-33*

yum install -y gcc*

yum install -y libstdc++-devel*

yum install -y libaio-devel*

 

5.确认防火墙和selinux已关闭

-----查看selinux状态:sestatus

关闭SELinux的方法:

  修改/etc/selinux/config文件中的SELINUX="" disabled ,然后重启。

  如果不想重启系统,使用命令setenforce 0

 

------查看iptables状态:service iptables status

关闭防火墙

     1)重启后永久性生效:

  开启: chkconfig iptables on

  关闭: chkconfig iptables off

  2) 即时生效,重启后失效:

  开启: service iptables start

  关闭: service iptables stop

6.增加相关用户及组

 groupadd oinstall

 groupadd dba

 useradd -g oinstall -G dba oracle

 passwd oracle

 

7.修改配置文件 

/etc/security/limits.conf文件,添加如下:

Vi /etc/security/limits.conf

oracle               soft     nproc    2047

oracle               hard     nproc    16384

oracle               soft     nofile   1024

oracle               hard     nofile   65536

oracle               soft     stack    10240

 

/etc/sysctl.conf文件,添加如下:

vi /etc/sysctl.conf

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 432691

kernel.shmmax = 1772303155

kernel.shmmni = 4096

kernel.sem = 250 32000 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

 

/sbin/sysctl -p 命令使/etc/sysctl.conf文件修改参数生效;

 

说明:shmall 是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。这两个可以设置为内存的 90%。例如 16G 内存,shmmax的大小为16*1024*1024*1024*90% = 15461882265shmall 的大小为 15461882265/4k(getconf PAGESIZE可得到) = 3774873

 

8.修改用户验证选项(root用户下:修改/etc/pam.d/login文件加上如下参数)

vim /etc/pam.d/login 加入以下语句:

 

session  required  /lib/security/pam_limits.so    -----针对32位系统

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

cat >> /etc/pam.d/login <<eof</eof

# for oracle

session required /lib64/security/pam_limits.so     -----针对64位系统

EOF

 

9.修改用户配置文件(root用户下:修改/etc/profile文件加入如下参数)

vi /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

 

10.建立目录权限和oracle用户的环境变量文件

ORACLE_BASE目录和授权:

mkdir -p /u01/app/oracle

chown -R oracle:oinstall /u01

chmod -R 775 /u01/app/oracle

 

编辑oracle用户环境变量:

vi .bash_profile 添加如下:

export ORACLE_SID=test

export ORACLE_BASE=/u01/app/oracle

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

export NLS_LANG="american_america.ZHS16GBK"

export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

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

 

Source .bash_profile 命令使环境变量文件生效;

 

二、静默安装

1.上传介质到oracle用户的/home/oracle/slient目录下

2.解压并备份静默安装文件(*.rsp)

Unzip p13390677_112040_Linux_x86_64_1of7.zip

Unzip p13390677_112040_Linux_x86_64_2of7.zip

 

[oracle@slient response]$ pwd

/home/oracle/slient/database/response

[oracle@slient response]$ ls

dbca.rsp  db_install.rsp  netca.rsp

[oracle@slient response]$ cp *.rsp /home/oracle

[oracle@slient response]$ cd

[oracle@slient ~]$ ls

dbca.rsp  db_install.rsp  netca.rsp  slient

 

3.删除应答文件中的注释行(以#开头)

 sed -i 's/^#.*$//g' *.rsp

 

4.刪除沒有內容的空行(^$)

sed -i '/^$/d' *.rsp

 

5.静默安装软件编辑db_install.rsp文件

[oracle@slient response]$ pwd

/home/oracle/slient/database/response

[oracle@slient response]$ vi db_install.rsp

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

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=slient

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

SELECTED_LANGUAGES=en

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

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0

oracle.install.db.DBA_GROUP=DBA

oracle.install.db.OPER_GROUP=

oracle.install.db.CLUSTER_NODES=

oracle.install.db.isRACOneInstall=

oracle.install.db.racOneServiceName=

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

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

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

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

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

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=

DECLINE_SECURITY_UPDATES=true

PROXY_HOST=

PROXY_PORT=

PROXY_USER=

PROXY_PWD=

PROXY_REALM=

COLLECTOR_SUPPORTHUB_URL=

oracle.installer.autoupdates.option=

oracle.installer.autoupdates.downloadUpdatesLoc=

AUTOUPDATES_MYORACLESUPPORT_USERNAME=

AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

 

6.静默安装软件

[oracle@slient database]$ pwd

/home/oracle/slient/database

[oracle@slient database]$ ls

install  readme.html  response  rpm  runInstaller  sshsetup  stage  welcome.html

[oracle@slient database]$ ./runInstaller  -silent -force -noconfig -responseFile /home/oracle/slient/database/response/db_install.rsp

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 25659 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 4095 MB    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-07-13_04-13-03AM. Please wait ...[oracle@slient database]$ [WARNING] [INS-13014] Target environment do not meet some optional requirements.

   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2017-07-13_04-13-03AM/installActions2017-07-13_04-13-03AM.log

   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2017-07-13_04-13-03AM/installActions2017-07-13_04-13-03AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.

You can find the log of this install session at:

 /u01/app/oraInventory/logs/installActions2017-07-13_04-13-03AM.log

 

[oracle@slient database]$ more The installation of Oracle Database 11g was successful.

Please check '/u01/app/oraInventory/logs/silentInstall2017-07-13_04-13-03AM.log' for more details.

 

As a root user, execute the following script(s):

        1. /u01/app/oraInventory/orainstRoot.sh

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

 

 

Successfully Setup Software.

 

[root@slient ~]# /u01/app/oraInventory/orainstRoot.sh

Changing 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.

[root@slient ~]#

[root@slient ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh

Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_slient_2017-07-13_04-24-08.log for the output of root script

[root@slient ~]# cat /u01/app/oracle/product/11.2.0/dbhome_1/install/root_slient_2017-07-13_04-25-03.log

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

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

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

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

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

 

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.

Finished product-specific root actions.

Finished product-specific root actions.

[root@slient ~]#

 

7.静默安装监听

--编辑监听静默文件:

[oracle@slient response]$ cat netca.rsp

[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"}

[oracle@slient response]$

 

[oracle@slient response]$ $ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/slient/database/response/netca.rsp

 

Parsing command line arguments:

    Parameter "silent" = true

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

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Oracle Net Listener Startup:

    Running Listener Control:

      /u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER

    Listener Control complete.

    Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0

[oracle@slient response]$

 

8.静默dbca建库

[oracle@slient response]$ more dbca.rsp

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "test"

SID = "test

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"

[oracle@slient response]$

 

上面就可以成功建库,但绝大多数情况[CREATEDATABASE]下还需要指定一些其他参数,
因为默认的可能不符合实际要求,尤其是你创建的数据库字符集必须要按你的设计需求显示指定:加入如下部分(em,可以不加

characterSet = "ZHS16GBK"

memoryPercentage = "60"

emConfiguration = "LOCAL"

sysPassword = "oracle"

systemPassword = "oracle"

dbsnmpPassword = "oracle"

sysmanPassword = "oracle"

 

 

[oracle@slient response]$ $ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/slient/database/response/dbca.rsp

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/test/test.log" for further details.

[oracle@slient response]$

注意:如果已经在响应文件中配置sys和system密码,上面就不会提示你输入密码了。



完成!

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

转载于:http://blog.itpub.net/31397003/viewspace-2142051/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值