6、关闭防火墙
关闭防火墙
chkconfig iptables off ---永久
/etc/init.d/iptables status
7、新建用户和组
The Oracle Inventory group (oinstall)数据库安装组
The OSDBA group (dba)数据库管理员组
The Oracle software owner (oracle)管理员用户
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba -m oracle
passwd oracle
[root@oracle ~]# groupadd oinstall
[root@oracle ~]# groupadd dba
[root@oracle ~]# useradd -g oinstall -G dba -m oracle
[root@oracle ~]# passwd oracle
-m表示为用户oracle新建一个根目录-g表示为用户指定一个主group-G表示为用户指定一个副group这样oracle既属于oinstall组也属于dba组。平时主要是oinstall组发生作用。
8、新建安装目录
ROOT执行:
mkdir -p /u02/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u02
chmod -R 775 /u02
9、新建/etc/oraInst.loc
在/etc目录下创建一个名为 oraInst.loc 的文件,文件中的内容(两行代码)如下:inventory_loc=$ORACLE_BASE/oraInventoryinst_group= oinstall
[root@ORCLTEST ~]# vi /etc/oraInst.locinventory_loc=/u02/app/oracle/oraInventoryinst_group= oinstall
4. 输入下面的命令在oraInst.loc文件上设置合适的拥有者,组和权限:
[root@ORCLTEST ~]chown oracle:oinstall /etc/oraInst.loc[root@ORCLTEST ~]chmod 664 /etc/oraInst.loc
10、设置环境变量
Vi ~/.bash_profile增加如下内容:
export EDITOR=vi
export ORACLE_SID=orcltest
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export PATH=$ORACLE_HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
umask 022
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export SQLPATH=$ORACLE_HOME/sqlplus/admin
二、开始安装
1、准备oracle安装文件
解压oracle安装文件包
[oracle@rhel6 tmp]$ ll
total 2442088
drwxr-x---. 2 grid oinstall 4096 Jan 6 00:10 hsperfdata_grid
drwxr-x---. 2 oracle oinstall 4096 Jan 6 00:36 hsperfdata_oracle
drwxr-xr-x. 2 root root 4096 Jan 5 23:49 hsperfdata_root
drwx------. 2 oracle oinstall 4096 Jan 5 22:08 keyring-5qr0Bb
drwx------. 2 gdm gdm 4096 Jan 5 22:08 orbit-gdm
drwx------. 2 oracle oinstall 4096 Apr 21 09:26 orbit-oracle
-rwxr-xr-x. 1 oracle oinstall 1358454646 Apr 21 09:35 p10404530_112030_Linux-x86-64_1of7.zip
-rwxr-xr-x. 1 oracle oinstall 1142195302 Apr 21 09:36 p10404530_112030_Linux-x86-64_2of7.zip
drwx------. 2 oracle oinstall 4096 Jan 5 22:08 pulse-LbDtLtLYhc91
drwx------. 2 root root 4096 Apr 8 17:40 vmware-root-2083271499
[oracle@rhel6 tmp]$
[oracle@rhel6 tmp]$unzip p10404530_112030_Linux-x86-64_1of7.zip && unzip p10404530_112030_Linux-x86-64_2of7.zip
。。。。。。。。。。。。。。。
2、执行静默安装
修改解压后的安装文件夹下response下面的db_install.rsp文件,将相关的参数设置为如下:
ORACLE_HOSTNAME=192.168.59.129
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u02/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u02/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u02/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.isRACOneInstall=false
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
oracle.installer.autoupdates.option=SKIP_UPDATES
然后执行安装:
[oracle@ORCLTEST database]$cd/tmp/database
[oracle@ORCLTEST database]$./runInstaller -silent -noconfig -responseFile /tmp/database/response/db_install.rsp -ignoreSysPrereqs-ignorePrereq
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 796 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-04-21_12-09-17PM. Please wait ...[oracle@ORCLTEST 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. /u02/app/oracle/oraInventory/logs/installActions2015-04-21_12-09-17PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /u02/app/oracle/oraInventory/logs/installActions2015-04-21_12-09-17PM.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:
/u02/app/oracle/oraInventory/logs/installActions2015-04-21_12-09-17PM.log
The installation of Oracle Database 11g was successful.
Please check '/u02/app/oracle/oraInventory/logs/silentInstall2015-04-21_12-09-17PM.log' for more details.
As a root user, execute the following script(s):
1. /u02/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
[oracle@ORCLTEST database]$
安装时后台进程
[root@ORCLTEST dbhome_1]# ps -ef|grep install
oracle 45527 1 48 12:09 pts/5 00:00:46 /tmp/OraInstall2015-04-21_12-09-17PM/jdk/jre/bin/java -Doracle.installer.library_loc=/tmp/OraInstall2015-04-21_12-09-17PM/oui/lib/linux64 -Doracle.installer.oui_loc=/tmp/OraInstall2015-04-21_12-09-17PM/oui -Doracle.installer.bootstrap=TRUE -Doracle.installer.startup_location=/tmp/database/install -Doracle.installer.jre_loc=/tmp/OraInstall2015-04-21_12-09-17PM/jdk/jre -Doracle.installer.nlsEnabled="TRUE" -Doracle.installer.prereqConfigLoc= -Doracle.installer.unixVersion=2.6.32-431.el6.x86_64 -mx150m -cp /tmp/OraInstall2015-04-21_12-09-17PM::/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/prov_fixup.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/log4j-core.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/instcommon.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/instdb.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/orai18n-utility.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/emConfigInstall.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/orai18n-mapping.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/cvu.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/remoteinterfaces.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/OraPrereqChecks.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/ojdbc5.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/emagentSDK.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/installcommons_1.0.0b.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/ssh.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/jsch.jar:/tmp/OraInstall2015-04-21_12-09-17PM/ext/jlib/OraPrereq.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/OraInstaller.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/oneclick.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/xmlparserv2.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/share.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/OraInstallerNet.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/emCfg.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/emocmutl.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/OraPrereq.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/jsch.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/ssh.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/remoteinterfaces.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/http_client.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/OraSuiteInstaller.jar:../stage/Components/oracle.swd.opatch/11.2.0.3.0/1/DataFiles/jlib/opatch.jar:../stage/Components/oracle.swd.opatch/11.2.0.3.0/1/DataFiles/jlib/opatchactions.jar:../stage/Components/oracle.swd.opatch/11.2.0.3.0/1/DataFiles/jlib/opatchprereq.jar:../stage/Components/oracle.swd.opatch/11.2.0.3.0/1/DataFiles/jlib/opatchutil.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/OraCheckPoint.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstImages.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_de.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_es.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_fr.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_it.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_ja.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_ko.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_pt_BR.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_zh_CN.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/InstHelp_zh_TW.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/oracle_ice.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/help4.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/help4-nls.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/ewt3.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/ewt3-swingaccess.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/ewt3-nls.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/swingaccess.jar::/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/jewt4.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/jewt4-nls.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/orai18n-collation.jar:/tmp/OraInstall2015-04-21_12-09-17PM/oui/jlib/orai18n-mapping.jar:/tmp/OraInstall2015-04-21_12-09
root 46585 45299 0 12:10 pts/12 00:00:00 grep install
[root@ORCLTEST dbhome_1]#
文件大小:
[root@ORCLTEST dbhome_1]# du . -sh
4.1G .
[root@ORCLTEST dbhome_1]#
Root脚本:
[root@ORCLTEST ~]#/u02/app/oracle/product/11.2.0/dbhome_1/root.sh
Check /u02/app/oracle/product/11.2.0/dbhome_1/install/root_ORCLTEST_2015-04-21_12-16-26.log for the output of root script
[root@ORCLTEST ~]# more /u02/app/oracle/product/11.2.0/dbhome_1/install/root_ORCLTEST_2015-04-21_12-16-26.log
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u02/app/oracle/product/11.2.0/dbhome_1
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.
[root@ORCLTEST ~]#
至此,数据库软件静默安装完成。
如果安装错误,可以删除目录(rm -rf /u02)然后重新创建目录再执行命令创建。
rm -rf /u02
mkdir -p /u02/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u02
chmod -R 775 /u02
3、Dbca静默方式建库
[oracle@orcltest database]$ strings $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc | grep -i arch
true
[oracle@orcltest database]$
[oracle@ORCLTEST oracle]$dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcltest -sid orcltest -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u02/app/oracle/oradata/ -redoLogFileSize 50 -recoveryAreaDestination /u02/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 20 -totalMemory 200 -databaseType OLTP -emConfiguration NONE
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
57% 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 "/u02/app/oracle/cfgtoollogs/dbca/orcltest/orcltest.log" for further details.
[oracle@orcltest database]$more /u02/app/oracle/cfgtoollogs/dbca/orcltest/orcltest.log
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 3%
DBCA_PROGRESS : 11%
DBCA_PROGRESS : 18%
DBCA_PROGRESS : 26%
DBCA_PROGRESS : 37%
Creating and starting Oracle instance
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 45%
DBCA_PROGRESS : 50%
DBCA_PROGRESS : 55%
DBCA_PROGRESS : 56%
DBCA_PROGRESS : 57%
DBCA_PROGRESS : 60%
DBCA_PROGRESS : 62%
Completing Database Creation
DBCA_PROGRESS : 66%
DBCA_PROGRESS : 70%
DBCA_PROGRESS : 73%
DBCA_PROGRESS : 85%
DBCA_PROGRESS : 96%
DBCA_PROGRESS : 100%
Database creation complete. For details check the logfiles at:
/u02/app/oracle/cfgtoollogs/dbca/orcltest.
Database Information:
Global Database Name:orcltest
System Identifier(SID):orcltest
[oracle@ORCLTEST oracle]$ ORACLE_SID=orcltest
[oracle@orcltest database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 21 15:41:57 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string orcltest
db_unique_name string orcltest
global_names boolean FALSE
instance_name string orcltest
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string orcltest
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL>
三、静默配置监听
通过response文件运行netca,生成sqlnet.ora和listener.ora文件, 位于$ORACLE_HOME/network/admin目录下:
# su - oracle
$$ORACLE_HOME/bin/netca /silent /responsefile /u01/database/netca.rsp
$ ll $ORACLE_HOME/network/admin/*.ora
$ lsnrctl status
[oracle@orcltest admin]$netca -silent -responsefile $ORACLE_HOME/assistants/netca/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u02/app/oracle/product/11.2.0/dbhome_1/assistants/netca/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Warning: Oracle Restart is not running.
Listener configuration will not be registered/unregistered with Oracle Restart.
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u02/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@orcltest admin]$
[oracle@orcltest admin]$ cd $ORACLE_HOME/network/admin
[oracle@orcltest admin]$ ll
total 20
-rw-r--r-- 1 oracle oinstall 379 Apr 21 16:33 listener.ora
drwxr-xr-x 2 oracle oinstall 4096 Apr 21 16:02 samples
-rw-r--r-- 1 oracle oinstall 205 May 11 2011 shrept.lst
-rw-r--r-- 1 oracle oinstall 223 Apr 21 16:33 sqlnet1504214PM3315.bak
-rwxr-xr-x 1 oracle oinstall 223 Apr 21 16:33 sqlnet.ora
[oracle@orcltest admin]$
成功运行后在$ORACLE_HOME/network/admin目录下生成sqlnet.ora和listener.ora两个文件。
...........................................................................................................................................................................................
本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用
本文pdf版: 提取码:af2d
QQ:642808185 注明:ITPUB的文章标题
...........................................................................................................................................................................................