1 安装依赖
yum install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libXext libX11 libXau libxcb libXi make sysstat libaio-devel -y
yum install libaio.i686 libaio-devel.i686 compat-libstdc++-33.i686 elfutils-libelf-devel.i686 glibc.i686 glibc-devel.i686 libgcc.i686 libstdc++.i686 unixODBC.i686 unixODBC-devel.i686 libaio-devel.x86_64 unixODBC.x86_64 libXext.i686 -y
2 创建组并指定用户所属组
groupadd -g 1000 oinstall
groupadd -g 1001 dba
useradd -u 1101 -g oinstall -G dba oracle
passwd oracle
更改用户 oracle 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
id oracle
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
3 修改内核参数
vi /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 #注意此项已存在
...`
/sbin/sysctl -p
4 修改文件描述符
vi /etc/security/limits.conf
...
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
5 配置oracle环境
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
su - oracle
vi .bash_profile
...
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=ora11g
export PATH=$ORACLE_HOME/bin:$PATH$ORACLE_HOME/bin:$PATH
source .bash_profile
echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
6 域名解析
ifconfig //查看ip
192.168.198.134
hostname //主机名
localhost.localdomain
vi /etc/hosts
...
192.168.198.134 localhost.localdomain
7 关闭SElinux、防火墙
setenforce 0
vi /etc/selinux/config
SELINUX=disable
/etc/init.d/iptables stop
chkconfig iptables off
8 安装oracle
su - oracle
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
cp -R database/response /home/oracle
less database/response/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=localhost.localdomain
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=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=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=
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
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
./runInstaller -silent -responseFile /tmp/database/response/db_install.rsp
...
以下配置脚本需要以 "root" 用户的身份执行。
#!/bin/sh
#要运行的 Root 脚本
/OraInstall/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
要执行配置脚本, 请执行以下操作:
1. 打开一个终端窗口
2. 以 "root" 身份登录
3. 运行脚本
4. 返回此窗口并按 "Enter" 键继续
Successfully Setup Software.
配置oracle监听
cd /tmp/database/response/
netca /silent /responsefile /tmp/database/response/netca.rsp
正在对命令行参数进行语法分析:
参数"silent" = true
参数"responsefile" = /tmp/database/response/netca.rsp
完成对命令行参数进行语法分析。
Oracle Net Services 配置:
完成概要文件配置。
Oracle Net 监听程序启动:
正在运行监听程序控制:
/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
监听程序控制完成。
监听程序已成功启动。
监听程序配置完成。
成功完成 Oracle Net Services 配置。退出代码是0
ll $ORACLE_HOME/network/admin
总用量 12
-rw-r--r-- 1 oracle oinstall 370 4月 14 16:49 listener.ora
drwxr-xr-x 2 oracle oinstall 61 4月 14 14:58 samples
-rw-r--r-- 1 oracle oinstall 187 5月 7 2007 shrept.lst
-rw-r--r-- 1 oracle oinstall 219 4月 14 16:49 sqlnet.ora
lsof -i:1521
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
tnslsnr 6456 oracle 11u IPv6 29993 0t0 TCP *:ncube-lm (LISTEN)
手动启动监听程序
$ORACLE_HOME/bin/lsnrctl start LISTENER
配置oracle数据库
修改建库配置文件
vi /tmp/database/response/dbca.rsp
GDBNAME = "ora11g.dg01" //78 行 全局数据库的名字=SID+主机域名
SID="ora11g" //149行 SID
SYSPASSWORD = "oracle" //190行
SYSTEMPASSWORD = "oracle" //200行
CHARACTERSET="AL32UTF8" //415行
NATIONALCHARACTERSET="UTF8" //425行
$ORACLE_HOME/bin/dbca -silent -responseFile /tmp/database/response/dbca.rsp
启动数据库
sqlplus / as sysdba
start
参数修改
修改最大连接数:
show parameter processes;
alter system set processes=2000 scope = spfile;
禁止回收站功能:
```shell
show parameter recyclebin;
alter system set recyclebin=off scope=spfile;
关闭审计功能:
show parameter audit;
alter system set audit_trail=NONE scope=spfile;
修改用户密码用不过期:
select * from dba_profiles s where s.profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME';
alter profile default limit password_life_time unlimited;
select * from dba_profiles s where s.profile='DEFAULT' and resource_name='FAILED_LOGIN_ATTEMPTS';
alter profile default limit failed_login_attempts unlimited;
修改控制文件里可重复使用的记录所能保存的最小天数:(一般设置为45天)
show parameter control;
alter system set control_file_record_keep_time=45 scope=spfile;
发表评论