此文是靜默安裝單機版oracle數據庫,如需安裝集羣模式,或datagruad模式,修改db_install.rsp相對應的參數值 oracle 11.2R2 數據庫靜默安裝 1.準備環境 linux操做系統(linux x86 環境:Asianux server 3,4 sp2,3;oracle linux 4,5,6;redhat 4,5,6;suse 10,11; On Linux x86-64:Asianux server 3,4;oracle linux 4,5,6,7;redhat 4,5,6,7;suse 10,11,12;注:centos和redhat是一家,因此centos也是能夠安裝的版本和redhat同樣就好) oracle 環境要求: 最小內存1G 磁盤最小 5G 2.測試環境 linux x86-64環境 oracle 11.2R2 3.建立oracle用戶 #groupadd oinstall #groupadd dba #useradd -g oinstall -G dba oracle #id oracle <!-- 安裝依賴安裝包--> #yum install -y binutils-2.20.51.0.2-5.11.el6.i686 \ compat-libcap1-1.10-1.i686 \ compat-libstdc++-33-3.2.3-69.el6.i686 \ gcc-4.4.4-13.el6.i686 \ gcc-c++-4.4.4-13.el6.i686 \ glibc-2.12-1.7.el6.i686 \ glibc-devel-2.12-1.7.el6.i686 \ ksh \ libgcc-4.4.4-13.el6.i686 \ libstdc++-4.4.4-13.el6.i686 \ libstdc++-devel-4.4.4-13.el6.i686 \ libaio-0.3.107-10.el6.i686 \ libaio-devel-0.3.107-10.el6.i686 \ make-3.81-19.el6.i686 \ sysstat-9.0.4-11.el6.i686 <!-- 修改系統參數/etc/sysctl.conf--> #vim /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 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 #sysctl -p <!-- 修改oracle文件參數/etc/security/limits.conf--> oracle hard nofile 65536 oracle hard nproc 16384 oracle soft nofile 1024 oracle soft nproc 2047 <!-- 修改oracle用戶參數/etc/oraInst.loc--> inst_group=oinstall inventory_loc=/u01/app/oraInventory <!-- 建立用戶所需的目錄--> #mkdir /u01/app/ #mkdir /u01/app/oraInventory #mkdir -p /u01/app/product/11.2.0/dbhome_1 #chown -R oracle.oinstall /u01/ #chmod -R 775 /u01/ <!-- 建立oracle用戶環境變量 ~/.baserc--> #vim /home/oracle/.baserc export ORACLE_BASE=/u01/app export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=ora1 export INVENTORY_LOCATION=$ORACLE_BASE/oraInventory export PATH=$ORACLE_HOME/bin:$PATH <!-- 上次oracle database 11.2R2--> #rz #cd /u01/ #ls linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip <!-- 切換oracle用戶--> $ cd /u01/ $ unzip linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip $ cd database/response $ cp * /opt/ $ cat db_install.rsp |grep -v '#'|grep -v ^$ oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=odc UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u01/app/oraInventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/u01/app/product/11.2.0/dbhome_1 ORACLE_BASE=/u01/app/ oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=false oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0 oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=ora1 oracle.install.db.config.starterdb.SID=ora1 oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.memoryLimit=512 oracle.install.db.config.starterdb.installExampleSchemas=false oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.password.ALL=oralce123! oracle.install.db.config.starterdb.control=DB_CONTROL oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false oracle.install.db.config.starterdb.automatedBackup.enable=false oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=FILE_SYSTEM oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=FILE_SYSTEM SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true #這裏的更新必定要是true,這是oracle 11.2r2的bug $ ./runInstaller -silent -ignorePrereq -force -noconfig -responseFil /opt/db_install.rsp Starting Oracle Universal Installer... Checking Temp space: must be greater than 415 MB. Actual 4211 MB Passed Checking swap space: must be greater than 150 MB. Actual 32768 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-03-02_04-58-19PM. Please wait ...$ You can find the log of this install session at: /u01/app/oraInventory/logs/installActions2017-12-15_03-21-13PM.log #The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run /u01/app/oracle/product/11.2/dbhome_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software. <!-- 切換root用戶--> #/u01/app/oracle/product/11.2/dbhome_1/root.sh #cat /u01/app/product/11.2.0/dbhome_1/install/root_odc_2017-12-15_15-24-32.log Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/product/11.2.0/dbhome_1 Creating /etc/oratab file... 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.sh script. Now product-specific root actions will be performed. <!-- 切換oracle用戶,裝監聽--> #su - oracle $ netca /silent /responsefile /opt/netca.rsp Listener Control complete Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 $ lsnrctl status LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-DEC-2017 17:17:50 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 15-DEC-2017 15:44:41 Uptime 0 days 1 hr. 33 min. 9 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/product/11.2.0/dbhome_1/network/admin/listener.ora Listener Log File /u01/app/diag/tnslsnr/odc/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=odc)(PORT=1521))) Services Summary... Service "ora1" has 1 instance(s). Instance "ora1", status READY, has 1 handler(s) for this service... Service "ora1XDB" has 1 instance(s). Instance "ora1", status READY, has 1 handler(s) for this service... The command completed successfully <!--數據庫實例安裝--> $ cat dbca.rsp |grep -v ^# |grep -v ^$ [GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "ora1" SID = "ora1" TEMPLATENAME = "General_Purpose.dbc" TOTALMEMORY = "512" $ dbca -silent -responseFile /opt/dbca.rsp Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u01/app/cfgtoollogs/dbca/orcl11g/orcl11g.log" for further details. <!--檢查數據是否正常--> $ ps -ef | grep ora_ | grep -v grep | wc -l 23 $ ps -ef | grep ora_ | grep -v grep oracle 67680 1 0 15:56 ? 00:00:00 ora_pmon_ora1 oracle 67682 1 0 15:56 ? 00:00:02 ora_vktm_ora1 oracle 67686 1 0 15:56 ? 00:00:00 ora_gen0_ora1 oracle 67688 1 0 15:56 ? 00:00:00 ora_diag_ora1 oracle 67690 1 0 15:56 ? 00:00:00 ora_dbrm_ora1 oracle 67692 1 0 15:56 ? 00:00:00 ora_psp0_ora1 oracle 67694 1 0 15:56 ? 00:00:02 ora_dia0_ora1 oracle 67696 1 0 15:56 ? 00:00:00 ora_mman_ora1 oracle 67698 1 0 15:56 ? 00:00:00 ora_dbw0_ora1 oracle 67700 1 0 15:56 ? 00:00:00 ora_lgwr_ora1 oracle 67702 1 0 15:56 ? 00:00:04 ora_ckpt_ora1 oracle 67704 1 0 15:56 ? 00:00:00 ora_smon_ora1 oracle 67706 1 0 15:56 ? 00:00:00 ora_reco_ora1 oracle 67708 1 0 15:56 ? 00:00:01 ora_mmon_ora1 oracle 67710 1 0 15:56 ? 00:00:01 ora_mmnl_ora1 oracle 67712 1 0 15:56 ? 00:00:00 ora_d000_ora1 oracle 67714 1 0 15:56 ? 00:00:00 ora_s000_ora1 oracle 67722 1 0 15:56 ? 00:00:00 ora_qmnc_ora1 oracle 67736 1 0 15:56 ? 00:00:01 ora_cjq0_ora1 oracle 67739 1 0 15:56 ? 00:00:00 ora_q000_ora1 oracle 67741 1 0 15:56 ? 00:00:00 ora_q001_ora1 oracle 67823 1 0 16:01 ? 00:00:00 ora_smco_ora1 oracle 69342 1 0 17:21 ? 00:00:00 ora_w000_ora1 $ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 15 17:22:35 2017 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> show user USER is "SYS" SQL> select name ,dbid,open_mode from v$database; NAME DBID OPEN_MODE --------- ---------- -------------------- ORA1 1439683635 READ WRITE SQL> col COMP_ID format a8 SQL> col COMP_NAME format a35 SQL> col VERSION format a12 SQL> col schema format a12 SQL> col OTHER_SCHEMAS format a45 SQL> select comp_id,comp_name,version,schema,other_schemas from dba_registry order by 1; COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS --------------------------------------------- AMD OLAP Catalog 11.2.0.1.0 OLAPSYS APEX Oracle Application Express 3.2.1.00.10 APEX_030200 FLOWS_FILES APS OLAP Analytic Workspace 11.2.0.1.0 SYS COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS --------------------------------------------- CATALOG Oracle Database Catalog Views 11.2.0.1.0 SYS CATJAVA Oracle Database Java Packages 11.2.0.1.0 SYS CATPROC Oracle Database Packages and Types 11.2.0.1.0 SYS APPQOSSYS,DBSNMP,DIP,ORACLE_OCM,OUTLN,SYSTEM COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS--------------------------------------------- CONTEXT Oracle Text 11.2.0.1.0 CTXSYS EM Oracle Enterprise Manager 11.2.0.1.0 SYSMAN EXF Oracle Expression Filter 11.2.0.1.0 EXFSYS COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS--------------------------------------------- JAVAVM JServer JAVA Virtual Machine 11.2.0.1.0 SYS ORDIM Oracle Multimedia 11.2.0.1.0 ORDSYS MDSYS,ORDDATA,ORDPLUGINS,SI_INFORMTN_SCHEMA OWB OWB 11.2.0.1.0 OWBSYS COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS--------------------------------------------- OWM Oracle Workspace Manager 11.2.0.1.0 WMSYS RUL Oracle Rules Manager 11.2.0.1.0 EXFSYS SDO Spatial 11.2.0.1.0 MDSYS COMP_ID COMP_NAME VERSION SCHEMA -------- ----------------------------------- ------------ ------------ OTHER_SCHEMAS--------------------------------------------- XDB Oracle XML Database 11.2.0.1.0 XDB ANONYMOUS,XS$NULL XML Oracle XDK 11.2.0.1.0 SYS XOQ Oracle OLAP API 11.2.0.1.0 SYS 18 rows selected. <!--開啓歸檔日誌--> SQL>shutdown immediate; SQL> startup mount; SQL> alter database archivelog; --開啓歸檔日誌 SQL> alter database flashback on; --設置閃回區 SQL> alter database open; SQL> execute utl_recomp.recomp_serial(); SQL> alter system archive log current;