安装准备检查的命令
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah
安装目录 /data/oracle
给予目录普通用户oracle权限
关闭Selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
设置主机名
Hostname oracledb
vim /etc/hosts 添加
127.0.0.1 oracledb
创建用户和组(root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户),并设置oracle用户密码:oracle
修改内核参数(root用户:修改 /etc/sysctl.conf 文件,加上如下参数)
vim /etc/sysctl.conf #末尾添加如下
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
sysctl -p
#使配置生效
修改系统资源限制(root用户:修改 /etc/security/limits.conf 文件,加上下面的参数)
vim /etc/security/limits.conf #末尾添加如下
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
修改用户验证选项(修改/etc/pam.d/login文件加上如下参数)
vim /etc/pam.d/login
session required pam_limits.so
创建安装目录及设置权限
mkdir -p /data/oracle/
chmod 755 /data
chown oracle.oinstall -R /data
设置oracle环境变量
su - oracle
vim .bash_profile在末尾添加
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
#export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_PID=ora11g
export ORACLE_SID=ora11g
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
source .bash_profile 让它生效
步骤2 ****
安装依赖包
Exit 退出oracle用户
执行
yum -y install binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-commonglibc-devel libaio libaio-devel libgcclibstdc++ libstdc++-devel unixODBC unixODBC-devel
Su - oracle切换用户 解压包
cd /data/
上传的oracle 11g的包放在/data/dba
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
解压后得到database目录,其中database目录下的response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。
修改静默安装的配置文件
给/data/database/response 权限
chmod +x /data/database/response/*
vim db_install.rsp 修改下面的内容
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracledb
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/11.2.0/db_1
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=ora11g
oracle.install.db.config.starterdb.SID=ora11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
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.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
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=true //一定要设为 true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
开始静默安装
cd 进入/data/database
./runInstaller -ignorePrereq -silent -force -responseFile /data/database/response/db_install.rsp
安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了
执行完会出现两个脚本 复制这两个脚本 切换到root用户执行就行
步骤3 ***
配置监听程序 切换oracle用户执行
[oracle@liukaibo dba]$ $ORACLE_HOME/bin/netca /silent /responseFile /data/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /data/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener "LISTENER" already exists.
Oracle Net Services configuration successful. The exit code is 0
启动监控程序
$ /data/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 30-JAN-2015 13:23:46
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /data/dba/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
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 30-JAN-2015 13:23:47
Uptime 0 days 0 hr. 1 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
The listener supports no services
The command completed successfully
启动成功
静默dbca建库
vim /data/database/response/dbca.rsp修改里面的内容
GDBNAME= "ora11g"
SID ="ora11g"
SYSPASSWORD= "oracle"
SYSTEMPASSWORD= "oracle"
SYSMANPASSWORD= "oracle"
DBSNMPPASSWORD= "oracle"
DATAFILEDESTINATION=/data/oracle/oradata
RECOVERYAREADESTINATION=/data/oracle/fast_recovery_area
CHARACTERSET= "AL32UTF8"
TOTALMEMORY= "1638"
这个信息一定要配置全,不然后面问题很多
[oracle@liukaibo response]$ $ORACLE_HOME/bin/dbca -silent -responseFile /data/database/response/dbca.rsp
The Oracle system identifier(SID) "xxx" already exists. Specify another SID
如果报错这个,那时系统与oracle的SID冲突:用root用户以远程登录模式编辑etc/oratab,删除最后一行或注释掉: xxx:/u01/oracle:N ,保存退出问题解决
Enter SYS user password:
Enter SYSTEM user password:
sh: /bin/ksh: No such file or directory
sh: /bin/ksh: No such file or directory
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
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
74% complete
85% complete
96% complete
100% complete
Look at the log file "/data/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.
出现这些百分比就代表安装成功了
启动数据库
[oracle@oracledb ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 16 14:26:57 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> start
SP2-1506: START, @ or @@ command has no arguments
SQL> startup
ORACLE instance started.
Total System Global Area 3290345472 bytes
Fixed Size 2217832 bytes
Variable Size 1795164312 bytes
Database Buffers 1476395008 bytes
Redo Buffers 16568320 bytes
Database mounted.
Database opened.
SQL>
出现这两个,代表安装成功
使用show parameter;或者select table_name from dba_tables看看是否正常
启动监听
启动监听:lsnrctl start
查看监听:lsnrctl status
停止监听:lsnrctl stop
[oracle@oracledb ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-FEB-2015 14:45:01
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /opt/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
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 16-FEB-2015 14:45:02
Uptime 0 days 0 hr. 1 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
The listener supports no services
The command completed successfully
解决方法:
在root权限下执行这条命令dd if=/dev/zero of=/opt/image/swap bs=1024 count=2048000
如果出现报错 主要看这里。看什么报错。如果不是严重性的错误。不用管。等他执行完就行。如果输出内容卡在这里。不执行了。。就得看报什么错误
解决方法:
根据报错内容。去百度查下。基本都有解决