12c 應答方式安裝 (一)資料庫軟體

snowdba發表於2015-02-28

圖形化安裝資料庫軟體,建立資料庫,配置監聽大家都很熟悉了,本篇部落格分為幾部分來演示應答方式(response)安裝資料庫軟體、建立資料庫等操作。

這種方式的好處是可以深入瞭解沒有安裝配置的細節。

首先來看一張OFA的脈絡圖,雖然生產環境總會自定義這些路徑,但是總的框架還是不會變的。



OFA標準中的幾個重要目錄:

oracle清單目錄
oraInventory
/u01/app/oraInventory
oracle基礎目錄 
ORACLE_BASE
/u01/app/oracle
oracle主目錄 
ORACLE_HOME
/u01/app/oracle/product/12.1.0/db_1

如果環境中有測試、開發可以在這裡用db_1, db_2來區分;
如果只有一個生產環境可以去掉db_1

/u01/app/oracle/product/12.1.0      生產
/u01/app/oracle/product/12.1.0/db_1 開發
/u01/app/oracle/product/12.1.0/db_2 測試
oracle網路目錄
TNS_ADMIN
/u01/app/oracle/product/12.1.0/db_1/network/admin
自動診斷庫目錄
ADR_HOME
/u01/app/oracle/diag/rdbms/db_unique_name/instance_name

select value from v$diag_info where name='ADR Home'

/u01為作業系統掛載點,通常會出現/u01,/u02,/u03等等。 如果命名為/ora01會一目瞭然該掛載點為oracle資料庫所用。

下面開始準備工作

一,OS準備工作
主機名
[root@snow ~]# hostname
snow.oracle.com

hosts配置
[root@snow ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.228.12 snow.oracle.com

作業系統版本
[root@snow ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)

磁碟空間
[root@snow ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 36G 3.2G 31G 10% /
tmpfs 1.8G 72K 1.8G 1% /dev/shm

記憶體大小
[root@snow ~]# grep MemTotal /proc/meminfo
MemTotal: 3772548 kB

swap使用情況
[oracle@snow ~]$ free -t
total used free shared buffers cached
Mem: 3772548 3237804 534744 2372 44880 2819740
-/+ buffers/cache: 373184 3399364
Swap: 4194300 0 4194300
Total: 7966848 3237804 4729044

掛載OS安裝光碟
[root@snow ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

建立repos檔案
root@snow ~]# cd /etc/yum.repos.d/
[root@snow yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak

[root@snow yum.repos.d]# vi snow12c.repo
[Oracle]
name=OEL-$releasever - Media
baseurl=file:///mnt
gpgcheck=0
enabled=1

建立組、使用者、安裝rpm包
[root@snow yum.repos.d]# yum install oracle-rdbms-server-12cR1-preinstall

檢測組、使用者建立效果
[oracle@snow ~]$ id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)

修改oracle密碼
root@snow yum.repos.d]# passwd oracle
Changing password for user oracle

cat /etc/group
cat /etc/passwd

如果不符合要求可以修改或刪除
groupmod/groupdel
usremode/userdel

修改限制檔案
[root@snow yum.repos.d]# vi /etc/security/limits.conf

oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768

禁用防火牆
# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]

禁用SELINUX,注意黃色字型
[root@snow yum.repos.d]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

建立oracle安裝目錄
[root@snow yum.repos.d]# mkdir -p /u01/app/oracle
[root@snow yum.repos.d]# chown -R oracle:oinstall /u01
[root@snow yum.repos.d]# chmod -R 775 /u01

二,資料庫軟體準備工作
建立安裝介質目錄
su - oracle
[oracle@snow ~]$ mkdir -p orainst/12.1.0.1

ftp上傳介質到指定目錄
ftp linux_12c_database_1of2.zip /home/oracle/orainst/12.1.0.1
ftp linux_12c_database_2of2.zip /home/oracle/orainst/12.1.0.1

解壓縮安裝包
cd /home/oracle/orainst/12.1.0.1
unzip linux_12c_database_1of2.zip
unzip linux_12c_database_2of2.zip

建立oraInst.loc
$ cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

chown oracle:oinstall oraInst.loc
chmod 664 oraInst.loc

配置bash_profile
cd /home/oracle
[oracle@snow ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0.1/db_1
export ORACLE_SID=cdb
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
stty erase ^h

[oracle@snow ~]$ . .bash_profile

檢查環境變數是否生效
[oracle@snow ~]$ env|grep ORA
ORACLE_SID=cdb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1

三,配置應答檔案
複製一個應答檔案作為模板來修改
通常應答檔案在資料庫軟體解壓縮路徑下的response
cd /home/oracle/orainst/12.1.0.1/database/response
-rwxrwxr-x. 1 oracle oinstall 58021 Aug 29 2012 dbca.rsp
-rw-rw-r--. 1 oracle oinstall 26690 May 24 2013 db_install.rsp
-rwxrwxr-x. 1 oracle oinstall 6038 Jun 18 2012 netca.rsp

cp -rp db_install.rsp inst.rsp

修改後的inst.rsp如下
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=snow.oracle.com
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/product/12.1.0.1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.BACKUPDBA_GROUP=dba
oracle.install.db.DGDBA_GROUP=dba
oracle.install.db.KMDBA_GROUP=dba
DECLINE_SECURITY_UPDATES=true
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
oracle.installer.autoupdates.option=SKIP_UPDATES

執行應答方式安裝資料庫
[oracle@snow database]$ ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/orainst/12.1.0.1/database/response/inst.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB. Actual 25953 MB Passed
Checking swap space: must be greater than 150 MB. Actual 4095 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-02-28_07-20-40AM. Please wait ...[oracle@snow database]$ [WARNING] [INS-35342] The specified group for Database Operator (OSOPER) group (Optional): may not be defined in the system.
CAUSE: The OS group you specified as Database Operator (OSOPER) group (Optional): may not be configured on the server, or in the Network Information Service (NIS).
ACTION: Check the group name you selected, and specify a different group, or create the group on the server or in the Network Information Service.
You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2015-02-28_07-20-40AM.log
The installation of Oracle Database 12c was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2015-02-28_07-20-40AM.log' for more details.

As a root user, execute the following script(s):
1. /u01/app/oracle/product/12.1.0.1/db_1/root.sh


Successfully Setup Software.

按照提示使用root使用者執行指令碼
[root@snow ~]# /u01/app/oracle/product/12.1.0.1/db_1/root.sh
Check /u01/app/oracle/product/12.1.0.1/db_1/install/root_snow.oracle.com_2015-02-28_07-23-11.log for the output of root script

測試軟體安裝效果
[oracle@snow ~]$ sqlplus /nolog

SQL*Plus: Release 12.1.0.1.0 Production on Sat Feb 28 08:30:43 2015

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

SQL>

由於篇幅較長,應答方式建立資料庫、配置等再後續的部落格中發出。


附錄
完整版應答檔案內容很多
除去註釋內容的方法:
[oracle@snow database]$ sed -n '/^[^#]/p' response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0
oracle.install.option=
ORACLE_HOSTNAME=
UNIX_GROUP_NAME=
INVENTORY_LOCATION=
SELECTED_LANGUAGES=en
ORACLE_HOME=
ORACLE_BASE=
oracle.install.db.InstallEdition=
oracle.install.db.DBA_GROUP=
oracle.install.db.OPER_GROUP=
oracle.install.db.BACKUPDBA_GROUP=
oracle.install.db.DGDBA_GROUP=
oracle.install.db.KMDBA_GROUP=
oracle.install.db.rac.configurationType=
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.rac.serverpoolName=
oracle.install.db.rac.serverpoolCardinality=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.ConfigureAsContainerDB=
oracle.install.db.config.PDBName=
oracle.install.db.config.starterdb.characterSet=
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=
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.DBSNMP=
oracle.install.db.config.starterdb.password.PDBADMIN=
oracle.install.db.config.starterdb.managementOption=
oracle.install.db.config.starterdb.omsHost=
oracle.install.db.config.starterdb.omsPort=
oracle.install.db.config.starterdb.emAdminUser=
oracle.install.db.config.starterdb.emAdminPassword=
oracle.install.db.config.starterdb.enableRecovery=
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=
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=

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

相關文章