阿里雲伺服器靜默安裝Oracle 11.2.0.4.0 -64bit

孤竹星發表於2018-10-08

阿里雲伺服器靜默安裝Oracle 11.2.0.4.0 -64bit

作業系統版本

[root@loneboo software]# cat /etc/redhat-release 

CentOS Linux release 7.4.1708 (Core) 


上傳檔案

[root@loneboo software]# ll

total 2487208

-rwxr-xr-x 1 root root 1395582860 Sep 29 14:22 p13390677_112040_Linux-x86-64_1of7.zip

-rwxr-xr-x 1 root root 1151304589 Sep 29 15:14 p13390677_112040_Linux-x86-64_2of7.zip


安裝依賴包

yum -y 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


新增swap

[root@loneboo ~]# mkdir /var/swap

[root@loneboo ~]# chmod 700 /var/swap

[root@loneboo ~]# cd /var/swap/

[root@loneboo swap]# dd if=/dev/zero of=./swapfile.swap bs=1M count=8192

8192+0 records out

8589934592 bytes (8.6 GB) copied, 56.534 s, 152 MB/s

[root@loneboo swap]# chmod 0600 swapfile.swap 

[root@loneboo swap]# mkswap swapfile.swap 

Setting up swapspace version 1, size = 8388604 KiB

no label, UUID=d6ed41a8-abd1-4963-9eae-048b2a723e8e

root@loneboo swap]# swapon swapfile.swap 

[root@loneboo swap]# vim /etc/fstab 

/var/swap/swapfile.swap  swap                                     swap    defaults        0 0




修改作業系統核心引數

修改使用者的SHELL的限制,修改/etc/security/limits.conf檔案

[root@loneboo software]# vi /etc/security/limits.conf

新增以下內容

oracle   soft    nproc    2047

oracle   hard    nproc    16384

oracle   soft    nofile     1024

oracle   hard    nofile    65536


修改/etc/pam.d/login 檔案

[root@loneboo software]#  vi /etc/pam.d/login

新增以下內容

session   required    pam_limits.so


修改/etc/profile

[root@loneboo software]# 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

修改linux核心,修改/etc/sysctl.conf檔案。

[root@loneboo ~]# vi /etc/sysctl.conf 

fs.file-max = 6815744 

fs.aio-max-nr = 1048576 

kernel.shmall = 2097152 

kernel.shmmax = 2147483648 

kernel.shmmni = 4096 

kernel.sem = 250 32000 100 128 

net.ipv4.ip_local_port_range = 9000 65500 

net.core.rmem_default = 4194304 

net.core.rmem_max = 4194304 

net.core.wmem_default = 262144 

net.core.wmem_max = 1048576


使/etc/sysctl.conf 更改立即生效,執行以下命令。

[root@loneboo ~]# sysctl -p

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

vm.swappiness = 0

net.ipv4.neigh.default.gc_stale_time = 120

net.ipv4.conf.all.rp_filter = 0

net.ipv4.conf.default.rp_filter = 0

net.ipv4.conf.default.arp_announce = 2

net.ipv4.conf.lo.arp_announce = 2

net.ipv4.conf.all.arp_announce = 2

net.ipv4.tcp_max_tw_buckets = 5000

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_max_syn_backlog = 1024

net.ipv4.tcp_synack_retries = 2

fs.file-max = 6815744

fs.aio-max-nr = 1048576

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576


[root@loneboo ~]# groupadd oinstall

[root@loneboo ~]# groupadd dba

[root@loneboo ~]# groupadd oper

[root@loneboo ~]# useradd -g oinstall -G dba oracle

[root@loneboo ~]# passwd oracle

Changing password for user oracle.

New password: 

BAD PASSWORD: The password is shorter than 8 characters

Retype new password: 

passwd: all authentication tokens updated successfully.


[root@loneboo ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1

[root@loneboo ~]# mkdir -p /u01/app/oraInventory

[root@loneboo ~]# chown -R oracle:oinstall /u01/

[root@loneboo ~]# chmod -R 775 /u01/


[root@loneboo ~]# vi /home/oracle/.bash_profile


# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi


# User specific environment and startup programs


PATH=$PATH:$HOME/.local/bin:$HOME/bin

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

ORACLE_SID=orcl

PATH=$ORACLE_HOME/bin:$PATH


export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH


[root@loneboo ~]# su - oracle

Last login: Mon Oct  8 09:35:36 CST 2018 on pts/2

[oracle@loneboo ~]$ source ~/.bash_profile 


檢查網路 

/etc/hosts

/etc/sysconfig/network

/etc/sysconfig/network-scripts/ifcfg-eth0


[root@loneboo ~]# vim /etc/hosts

127.0.0.1   localhost loneboo


解壓軟體,多個軟體包解壓 unzip linux.x64_11gR2_database_\*.zip


[root@loneboo ~]# cd /software/

[root@loneboo software]# unzip p13390677_112040_Linux-x86-64_\*.zip


[root@loneboo software]# ll

total 2487212

drwxr-xr-x 7 root root       4096 Aug 27  2013 database


修改安裝包許可權

[root@loneboo software]# chown -R oracle:oinstall database/


配置應答檔案db_install.rsp

應答檔案模版目錄response在解壓後database目錄下

[root@loneboo software]# cd database/response/

[root@loneboo response]# ls

dbca.rsp  db_install.rsp  netca.rsp


oracle修改db_install.rsp

配置內容如下

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

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=loneboo

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oraInventory

SELECTED_LANGUAGES=en,zh_CN

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

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.EEOptionsSelection=false

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

oracle.install.db.CLUSTER_NODES=

oracle.install.db.isRACOneInstall=

oracle.install.db.racOneServiceName=

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=

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


安裝資料庫

./runInstaller -silent -responseFile /software/database/response/db_install.rsp

[oracle@loneboo database]$ ./runInstaller -silent -responseFile /software/database/response/db_install.rsp

Starting Oracle Universal Installer...


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

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

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-10-08_10-58-06AM. Please wait ...[oracle@loneboo 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/OraInstall2018-10-08_10-58-06AM/installActions2018-10-08_10-58-06AM.log

   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2018-10-08_10-58-06AM/installActions2018-10-08_10-58-06AM.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/installActions2018-10-08_10-58-06AM.log


The installation of Oracle Database 11g was successful.

Please check '/u01/app/oraInventory/logs/silentInstall2018-10-08_10-58-06AM.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/db_1/root.sh



Successfully Setup Software.


[root@loneboo tmp]# sh /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@loneboo tmp]# sh /u01/app/oracle/product/11.2.0/db_1/root.sh

Check /u01/app/oracle/product/11.2.0/db_1/install/root_loneboo_2018-10-08_11-02-12.log for the output of root script


建立監聽

[oracle@loneboo ~]$ netca -silent -responsefile /software/database/response/netca.rsp 


建立資料庫

[oracle@loneboo database]$ cat response/dbca.rsp | grep -v '#' | grep -v '^$'

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "orcl"

SID = "orcl"

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 = "orcl"

[CONFIGUREDATABASE]

[ADDINSTANCE]

DB_UNIQUE_NAME = "orcl"

NODELIST=

SYSDBAUSERNAME = "sys"

[DELETEINSTANCE]

DB_UNIQUE_NAME = "orcl"

INSTANCENAME = "orcl"

SYSDBAUSERNAME = "sys" 

[oracle@loneboo database]$ dbca  -silent -responseFile /software/database/response/dbca.rsp 

Enter SYS user password: 

 

Enter SYSTEM user password: 

 

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/orcl/orcl.log" for further details.

[oracle@loneboo database]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 8 11:24:32 2018


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


Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

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


SQL> select instance_name,status from v$instance;                                                         


INSTANCE_NAME    STATUS

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

orcl             OPEN

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28282660/viewspace-2215544/,如需轉載,請註明出處,否則將追究法律責任。

相關文章