先上传安装包
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
解压到本地
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
安装一些yum包
yum install -y binutils* compat-libcap* compat-libstdc++* gcc* glibc* ksh* libaio* libgcc* libstdc++* libXi* libXtst* make* sysstat*
yum install glibc-static.x86_64 glibc-static.i686 -y
优化sysctl
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 = 1048576
/sbin/sysctl -p
修改/etc/security/limits.conf
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
添加用户和用户组
添加用户组:(组id最好在500以后的值)
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
添加用户并且分组:
/usr/sbin/useradd -g oinstall -G dba oracle
设置密码:
passwd oracle
创建oracle的安装目录
[root@centos01 database]# mkdir -p /u01/app
[root@centos01 database]# chown oracle:oinstall /u01/app/
[root@centos01 database]# chmod 755 /u01/app
[root@centos01 database]# mkdir -p /u01/app/oracle
[root@centos01 database]# chown oracle:oinstall /u01/app/oracle/
[root@centos01 database]# chmod 755 /u01/app/oracle
[root@centos01 database]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@centos01 database]# chown oracle:oinstall -R /u01/app/oracle
修改环境变量
[root@centos01 database]# su oracle
[oracle@centos01 ~]$ vim .bash_profile
export TMP=/tmp
export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_UNQNAME=ORA11G
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ORA11G
export ORACLE_TERM=xterm
export LANG=C
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
umask 022
[oracle@centos01 ~]$ source .bash_profile
安装修改安装文档,
vim /opt/database/response/db_install.rsp
配置文件:
[oracle@centos01 response]$ cat db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=centos01
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
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=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.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
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=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=/u01/app/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_data
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
排坑1:静默安装提示需要取消掉$DISPLAY
echo $DISPLAY
unset DISPLAY
echo $DISPLAY
排坑2:报错信息
[oracle@HOST database]$ [SEVERE] - Email Address Not Specified
解决方式:
修改responseFile文件db_install.rsp,将DECLINE_SECURITY_UPDATES=的值设为true,如果为空系统会假设该值为false,DECLINE_SECURITY_UPDATES=的值默认为空。
切换oracle用户开始安装
su - oracle
./runInstaller -silent -ignorePrereq -responseFile /opt/database/response/db_install.rsp
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /opt/database/response/db_install.rsp ---跳过检查,不是必要不建议加这个参数ignoreSysPrereqs
安装完成后切换root用户执行脚本
/u01/app/oracle/product/11.2.0/db_1/root.sh
静默安装数据库
修改配置文件
vim /opt/database/response/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION = /u01/app/oracle/oradata
RECOVERYAREADESTINATION= /u01/app/oracle/flash_recovery_area
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "819"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "My Copy TEMPLATE"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
切换oracle用户静默安装
su - oracle
dbca -silent -responseFile /opt/database/response/dbca.rsp
查看实例启动
ps -ef|grep smon
启动监控
lsnrctl start
进入数据库
export ORACLE_SID=orcl
sqlplus /nolog
SQL> connect /as sysdba
如果是关闭数据库,命令:shutdown abort
启动数据库,命令:startup
创建用户
SQL> create user admin identified by 888888;
SQL> grant connect,resource,dba to admin;