Oracle靜默安裝(單機)

不一樣的天空w發表於2017-07-13

linux下靜默安裝oracle資料庫各引數選項作用說明

db_install.rsp dbca.rsp netca.rsp 詳解

https://www.cnblogs.com/chenjunjie/p/6116480.html


說明: 1. 作業系統版本為 Redhat6.7 IP 192.168.56.20 ,主機名: slient

    2. 資料庫版本為 11.2.0.4


一:檢查

1.記憶體(至少1G)

grep MemTotal /proc/meminfo


2.SWAP分割槽

   記憶體在 2G 以下 , SWAP 分割槽就設定為記憶體的 1.5

   記憶體在 2G 8G 之間, 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

2047 oracle               hard     nproc    

1024 oracle               hard     nofile   

10240   's/^#.*$//g'

sed -i  *.rsp INSTALL_DB_SWONLY<1span style="font-family:" color:#0000ff;"="">

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 scrip t 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章