Install oracle11g_r2 silently under CentOS6.3
1Environment before installation:
Operating System: CetnOS6.4x64 minimal installation. configured network IP address: 172.18.10.213, physical memory 4 GB, hard disk 100 GB.
Downloaded: linux.x64_11gR2_database_1of2.zip
Linux.x64_11gr2_databasesilicate f2.zip
Directory:/sharedisk/11G/
2Preparations
After the root user logs on
# Yum install unzip // download unzip to decompress the preceding two compressed files
# Cd/sharedisk/11G // switch the current directory to the directory where the oracle compressed file is located
# Unzip linux.x64_11gR2_database_1of2.zip // decompress
# Unzip linux.x64_11gr2_database204 f2.zip
After decompression, add/Sharedisk/11G/database Directory, which contains all the oracle installation files after decompression.
In the/etc/hosts file, add the Host Name (obtained through hostname) to the loopback IP address ing as follows:
# Vi/etc/hosts
127.0.0.1 localhost. localdomain localhost4 localhost4.localdomain4
: 1 localhost. localdomain localhost6 localhost6.localdomain6
172.18.10.213 ora11g
# Vi/etc/selinux/confg set SELINUX = disabled
# Setenforce 0 // disable selinux
# Service iptables stop // temporarily close the Firewall
3Install required packages
# Yum install nfs-utils // nfs server can be mounted
# Yum install gcc make binutils gcc-c ++ compat-libstdc ++-33 elfutils-libelf-devel-static ksh libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
4Prepare to install users and user groups
# Groupadd oinstall
# Groupadd dba
# Useradd-g oinstall-G dba oracle
# Passwd oracle // set the oracle Password
5Modify the kernel parameter configuration file
# Vi/etc/sysctl. conf is added at the end of the file (according to the document requirements, it is most reasonable to set kernel. shmmax to half the physical memory)
Fs. aio-max-nr = 1048576
Fs. file-max = 6553600
Kernel. shmall = 2097152
Kernel. shmmax = 2147483648
Kernel. shmmni = 4096
Kernel. sem = 250 32000 100 128
Net. ipv4.ip _ local_port_range = 1024 65000
Net. core. rmem_default = 262144
Net. core. rmem_max = 4194304
Net. core. wmem_default = 262144
Net. core. wmem_max = 1048586
Save the file.
#/Sbin/sysctl-p // make the parameter take effect
6Modify a user's restricted file
# Add vi/etc/security/limits. conf after the file
Oracle soft nproc 2047
Hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
Oracle soft stack 10240
Save the file.
ModifyAdd the/etc/pam. d/login file as follows:
Session required/lib64/security/pam_limits.so // do not write an error/lib/security/pam_limits.so // otherwise, you cannot log on
Session required pam_limits.so
Modify/etc/profile and add:
If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
7Create installation directory and set File Permissions
# Mkdir-p/u01/app/oracle/product/11.2.0 // database system installation directory
# Mkdir/u01/app/oracle/oradata // database data installation directory
# Mkdir/u01/app/oracle/inventory
# Mkdir/u01/app/oracle/fast_recovery_area
# Chown-R oracle: oinstall/u01/app/oracle
# Chmod-R 775/u01/app/oracle
Set environment variables: ModifyThe/home/oracle/. bash_profile file is added as follows:
# Su-oracle
ORACLE_BASE =/u01/app/oracle
ORACLE_HOME = $ ORACLE_BASE/product/11.2.0
ORACLE_SID = ora11
PATH = $ PATH: $ ORACLE_HOME/bin
Export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
8Edit Silent Installation response File
# Su-oracle
$ Cp-R/sharedisk/11G/database/response/home/oracle // copy a template
$ Cd/home/oracle/response
$ Vi db_install.rsp // start to modify the installation response file,This file only installs the database software
You need to set the following options:
Oracle. install. responseFileVersion =/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 // generated by the system, do not modify
Oracle. install. option = INSTALL_DB_SWONLY // only install software, do not install start Database
ORACLE_HOSTNAME = ora11g // obtained through the hostname command
UNIX_GROUP_NAME = oinstall
INVENTORY_LOCATION =/u01/app/oracle/inventory
Selected_ages = en, zh_CN
ORACLE_HOME =/u01/app/oracle/product/11.2.0
ORACLE_BASE =/u01/app/oracle
Oracle. install. db. InstallEdition = EE
Oracle. install. db. isCustomInstall = false
Oracle. install. db. customComponents = oracle. server: 11.2.0.1.0, oracle. sysman. cr: 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 = dba
DECLINE_SECURITY_UPDATES = true // you must set it to true.
9Install oracle based on the response File
$ Cd/sharedisk/11G/database
$./RunInstaller-silent-responseFile/home/oracle/response/db_install.rsp-ignorePrereq
During the installation process, if [WARNING] is prompted, the installer is still running. If [FATAL] is displayed, the installer is stopped. Open another terminal and execute
# Tail-100f/u01/app/oracle/inventory/logs/installActions ...... log
You can track and view the installation logs in real time to learn about the installation progress.
When the following prompt appears, the installation is successful:
Be executed as the "root" user.
#! /Bin/sh
# Root scripts to run
/U01/app/oracle/inventory/orainstRoot. sh
/U01/app/oracle/product/11.2.0/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.
Indicates that the installation is successful. Follow the prompts.
$ Exit // return to root
# Sh/u01/app/oracle/inventory/orainstRoot. sh
# Sh/u01/app/oracle/product/11.2.0/root. sh
10Silent configuration listening
$ Netca/silent/responsefile/home/oracle/response/netca. rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" =/home/oracle/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/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
After the file is successfully run, the sqlnet. ora and listener. ora files are generated under the/u01/app/oracle/11.2.0/network/admin directory.
Run the netstat-tlnp command.
Tcp 0 0: 1521: * LISTEN 10760/tnslsnr
It indicates that the listener has started to work on port 1521.
11Create a new database silently (also create a corresponding instance)
Modify/Home/oracle/response/dbca. rsp. The settings are as follows:
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0" // cannot be changed
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "ora11" // Database Name
SID = "ora11" // corresponding instance name
TEMPLATENAME = "General_Purpose.dbc" // template file for database creation
SYSPASSWORD = "oracle" // SYS administrator password
SYSTEMPASSWORD = "oracle" // SYSTEM Administrator Password
DATAFILEDESTINATION =/u01/app/oracle/oradata // data file storage directory
RECOVERYAREADESTINATION =/u01/app/oracle/fast_recovery_area // restore the data storage directory
CHARACTERSET = "ZHS16GBK" // Character Set, important !!! Generally, it cannot be changed after the database is created. Therefore, you must confirm before creating the database.
TOTALMEMORY = "3276" // oracle memory 3276 MB (allmem * 80%)
The command for silent database creation is as follows:
$ Dbca-silent-responseFile/home/oracle/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/export toollogs/dbca/ora11/ora11.log" for further details.
View log files
$ Cat/u01/app/oracle/export toollogs/dbca/ora11/ora11.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: 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:
/U01/app/oracle/export toollogs/dbca/ora11.
Database Information:
Global Database Name: ora11
System Identifier (SID): ora11
Check instances after creating a database:
$ Ps-ef | grep ora _ | grep-v grep
Oracle 11279 1 0? 00:00:00 ora_pmon_ora11
Oracle 11281 1? 00:00:02 ora_vktm_ora11
Oracle 11285 1 0? 00:00:00 ora_gen0_ora11
Oracle 11287 1 0? 00:00:00 ora_diag_ora11
Oracle 11289 1 0? 00:00:00 ora_dbrm_ora11
Oracle 11291 1 0? 00:00:00 ora_psp0_ora11
Oracle 11293 1 0? 00:00:00 ora_dia0_ora11
Oracle 11295 1 0? 00:00:00 ora_mman_ora11
Oracle 11297 1 0? 00:00:00 ora_dbw0_ora11
Oracle 11299 1 0? 00:00:00 ora_lgwr_ora11
Oracle 11301 1 0? 00:00:01 ora_ckpt_ora11
Oracle 11303 1 0? 00:00:00 ora_smon_ora11
Oracle 11305 1 0? 00:00:00 ora_reco_ora11
Oracle 11307 1? 00:00:02 ora_mmon_ora11
Oracle 11309 1 0? 00:00:01 ora_mmnl_ora11
Oracle 11311 1 0? 00:00:00 ora_d000_ora11
Oracle 11313 1 0? 00:00:00 ora_s000_ora11
Oracle 11323 1 0? 00:00:01 ora_qmnc_ora11
Oracle 11340 1 0? 00:00:01 ora_cjq0_ora11
Oracle 11342 1 0? 00:00:01 ora_q000_ora11
Oracle 11344 1 0? 00:00:00 ora_q0020.ora11
View listener status
$ Lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0-Production on 26-AUG-2014 12:07:54
Copyright (c) 1991,200 9, 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 26-AUG-2014 11:11:10
Uptime 0 days 0 hr. 56 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File/u01/app/oracle/product/11.2.0/network/admin/listener. ora
Listener Log File/u01/app/oracle/diag/tnslsnr/ora11g/listener/alert/log. xml
Listening Endpoints Summary...
(DESCRIPTION = (ADDRESS = (PROTOCOL = ipc) (KEY = EXTPROC1521 )))
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = ora11g) (PORT = 1521 )))
Services Summary...
Service "ora11" has 1 instance (s ).
Instance "ora11", status READY, has 1 handler (s) for this service...
Service "ora11XDB" has 1 instance (s ).
Instance "ora11", status READY, has 1 handler (s) for this service...
The command completed successfully
12Change the database to archive mode (Archive mode supports hot backup and Incremental Backup)
$ Sqlplus/as sysdba
SQL * Plus: Release 11.2.0.1.0 Production on Tue Aug 26 13:37:34 2014
Copyright (c) 1982,200 9, Oracle. All rights reserved.
Connected:
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> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> execute utl_recomp.recomp_serial ();
PL/SQL procedure successfully completed.
SQL> alter system archive log current;
System altered.
SQL> exit
13Modify oracleStart the configuration file
$ Vi/etc/oratab
Ora11:/u01/app/oracle/product/11.2.0: Y
In this way, you can start the instance through dbstart or disable the instance through dbshut.
$ Dbshut/u01/app/oracle/product/11.2.0
Processing Database instance "ora11": log file/u01/app/oracle/product/11.2.0/shutdown. log
In this case, all oracle processes are disabled and listeners are stopped.
$ Dbstart/u01/app/oracle/product/11.2.0
Processing Database instance "ora11": log file/u01/app/oracle/product/11.2.0/startup. log
At this time, the listener works, the hello instance runs, and the listener status is checked again.
$ Lsnrctl status
Boot Method:
Method 1:
To enable the oracle service to automatically start as the system starts, add the following in the/etc/rc. local file:
Su-oracle-c "/u01/app/oracle/product/11.2.0/bin/dbstart/u01/app/oracle/product/11.2.0"
Method 2: Create a STARTUP script
# Vi/etc/rc. d/init. d/oracle
#! /Bin/bash
# Oracle: Start/Stop Oracle Database 11g R2
#
# Chkconfig: 345 90 10
# Description: The Oracle Database is an Object-Relational Database Management System.
#
# Processname: oracle
./Etc/rc. d/init. d/functions
LOCKFILE =/var/lock/subsys/oracle
ORACLE_HOME =/u01/app/oracle/product/11.2
ORACLE_USER = oracle
Case "$1" in
'Start ')
If [-f $ LOCKFILE]; then
Echo $0 already running.
Exit 1
Fi
Echo-n $ "Starting Oracle Database :"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/lsnrctl start"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/dbstart $ ORACLE_HOME"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/emctl start dbconsole"
Touch $ LOCKFILE
;;
'Stop ')
If [! -F $ LOCKFILE]; then
Echo $0 already stopping.
Exit 1
Fi
Echo-n $ "Stopping Oracle Database :"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/lsnrctl stop"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/dbshut"
Su-$ ORACLE_USER-c "$ ORACLE_HOME/bin/emctl stop dbconsole"
Rm-f $ LOCKFILE
;;
'Restart ')
$0 stop
$0 start
;;
'Status ')
If [-f $ LOCKFILE]; then
Echo $0 started.
Else
Echo $0 stopped.
Fi
;;
*)
Echo "Usage: $0 [start | stop | status]"
Exit 1
Esac
Exit 0
# Service oracle on