Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86-64
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_client.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
Install Oracle
- 1. Checking the Hardware Requirements
- 2. Checking the Software Requirements
- 3. Kernel Requirements
- 4. Creating Required Operating System Groups and Users
- 5. Configuring Kernel Parameters
- 6. Setting Shell Limits for the oracle User
- 6. Creating Required Directories
- 7. Configuring the oracle User's Environment
- 8. unzip
- 9. Config Silent Install Parameter
- 10. Start Install Oracle
- 11. Configuring the oracle User's Environment Again
- 13. Config Database Network
- 14. Start Install Database
- 15. Check Database Instance
- 16. 监听状态检查
- 17. Config Oracle Start File
- 18. Check Database
- 20. XXX
- 21. XXX
- 22. XXX
1. Checking the Hardware Requirements
[root@localhost ~]# grep MemTotal /proc/meminfo
[root@localhost ~]# grep SwapTotal /proc/meminfo
[root@localhost ~]# grep "model name" /proc/cpuinfo
Available RAM | Swap Space Required |
---|---|
Between 1 GB and 2 GB | 1.5 times the size of RAM |
Between 2 GB and 16 GB | Equal to the size of RAM |
More than 16 GB | 16 GB |
[root@localhost ~]# free
total used free shared buffers cached
Mem: 2035624 333580 1702044 8980 880 110860
-/+ buffers/cache: 221840 1813784
Swap: 2097148 0 2097148
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.0G 15G 17% /
devtmpfs 985M 0 985M 0% /dev
tmpfs 994M 0 994M 0% /dev/shm
tmpfs 994M 8.7M 986M 1% /run
tmpfs 994M 0 994M 0% /sys/fs/cgroup
/dev/sda1 497M 119M 379M 24% /boot
2. Checking the Software Requirements
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.5 glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
安装没有安装的依赖包
[root@localhost ~]# yum install -y compat-libstdc++-33 elfutils-libelf-devel gcc-c++ glibc-2.5 ksh libaio libaio-devel libstdc++-devel unixODBC unixODBC-devel
3. Kernel Requirements
The following are the kernel requirements for Oracle Database 11g Release 2 (11.2):
For Asianux 2, Oracle Enterprise Linux 4.0, and Red Hat Enterprise Linux 4.0: 2.6.9 or later
4. Creating Required Operating System Groups and Users
[root@localhost ~]# groupadd oinstall && groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba -d /home/oracle -s /bin/bash -c "Oracle software owner" oracle
[root@localhost ~]# echo "password" | passwd --stdin oracle
[root@localhost ~]# chown -R oracle:oinstall /home/oracle
[root@localhost ~]# chmod -R 775 /home/oracle
5. Configuring Kernel Parameters
[root@localhost ~]# vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
6. Setting Shell Limits for the oracle User
[root@localhost ~]# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
[root@localhost ~]# vim /etc/pam.d/login
session required pam_limits.so
[root@localhost ~]# vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@localhost ~]# source /etc/profile
6. Creating Required Directories
[root@localhost ~]# mkdir -p /u01/app/
[root@localhost ~]# chown -R oracle:oinstall /u01/app/
[root@localhost ~]# chmod -R 775 /u01/app/
[root@localhost ~]# vim /etc/oraInst.loc
inventory_loc=/u01/app/oracle/oraInventory
inst_group=oinstall
[root@localhost ~]# chown oracle:oinstall /etc/oraInst.loc
[root@localhost ~]# chmod 664 /etc/oraInst.loc
7. Configuring the oracle User’s Environment
[root@localhost ~]# su – oracle
[oracle@localhost ~]$ vim ~/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
[oracle@localhost ~]$ source /home/oracle/.bash_profile
[oracle@localhost ~]$ env
8. unzip
[oracle@localhost ~]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@localhost ~]$ unzip linux.x64_11gR2_database_2of2.zip
9. Config Silent Install Parameter
[oracle@localhost ~]$ mkdir etc
[oracle@localhost ~]$ cp /home/oracle/database/response/* /home/oracle/etc/
[oracle@localhost ~]$ chmod 777 /home/oracle/etc/*.rsp
[oracle@localhost ~]$ vim /home/oracle/etc/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=michael
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
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=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.password.ALL=oracle
DECLINE_SECURITY_UPDATES=true
10. Start Install Oracle
[oracle@localhost ~]$ cd database
[oracle@localhost ~]$ ./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp -ignorePrereq
[oracle@localhost ~]$ cd $ORACLE_BASE/oraInventory/logs
[oracle@localhost ~]$ tail -100f $ORACLE_BASE/oraInventory/logs/installActions*.log
[oracle@localhost ~]$ su root
[oracle@localhost ~]$ /u01/app/oracle/product/11.2.0/db_1/root.sh
11. Configuring the oracle User’s Environment Again
[oracle@localhost ~]$ su - oracle
[oracle@localhost ~]$ vi ~/.bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=oracle
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data
[oracle@localhost ~]$ source /home/oracle/.bash_profile
13. Config Database Network
[oracle@localhost ~]$ $ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/etc/netca.rsp
14. Start Install Database
[oracle@localhost ~]$ vim /home/oracle/etc/dbca.rsp
GDBNAME="orcl.michael"
SID="orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
CHARACTERSET="AL32UTF8"
NATIONALCHARACTERSET="UTF8"
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp
15. Check Database Instance
[oracle@localhost ~]$ ps -ef | grep ora_ | grep -v grep | wc -l
[oracle@localhost ~]$ ps -ef | grep ora_ | grep -v grep
16. 监听状态检查
[oracle@localhost ~]$ lsnrctl status
17. Config Oracle Start File
[oracle@localhost ~]$ vim /etc/oratab
orcl:/u01/app/oracle/product/11.2.0/db_1:Y
dbstart
dbshut
18. Check Database
[oracle@localhost ~]$ sqlplus / as sysdba
SQL> conn /as sysdba 连接到本地数据库
SQL> alter user system identified by password; 修改 system用户密码为 password
SQL> alter user sys identified by password;
SQL> alter user system account unlock;解锁账号
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; (手工归档测试)