centos安装oracle11g数据库
一、关闭 SELinux二、关闭防火墙
三、开启swap空间
dd if=/dev/zero of=/var/swap bs=1024 count=8000000
mkswap /var/swap
swapon /var/swap
四、设置limits.conf
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
五、设置sysctl.conf
vim /etc/sysctl.conf 末尾添加:
fs.file-max = 6815744
fs.aio-max-nr=1048576
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
应用
sysctl -p 六、安装依靠包
yum install -y binutils compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel \
ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat \
binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel \
ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel \
make net-tools nfs-utils smartmontools sysstat \
libaio libaio-devel glibc.i686 glibc.x86_64 \
compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 \
elfutils-libelf-devel unixODBC unixODBC-devel pdksh \
libaio.i686 libstdc++.i686 libaio-devel.i686 unixODBC.i686 unixODBC-devel.i686 \
gcc gcc-c++ make binutil scompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel libaio \
libaio-devel libgcc libstdc++ libstdc++-devel unixODBC unixODBC-devel 七、创建oracle用户及目录
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m -d /home/oracle oracle
passwd oracle
#输入密码
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /u01/app/oracle /u01/app/oraInventory
chmod -R 775 /u01/app/oracle /u01/app/oraInventory
su - oracle
下面切换到oracle用户操纵
八、设置环境变量
vim ~/.bash_profile 结尾添加
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
应用设置
source ~/.bash_profile
九、下载、上传并解压安装包
利用迅雷下载安装包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
scp database.tar.gz oracle@172.21.16.13:/u01/app/oracle
解压安装包
unzip linux.x64_11gR2_database_1of2.zip -d /u01/app/oracle
unzip linux.x64_11gR2_database_2of2.zip -d /u01/app/oracle
cd /u01/app/oracle/database 十、修改安装设置文件
vim response/db_install.rsp 具体设置参考:Oracle11g db_install.rsp 设置文件详解_oracle rsp文件-CSDN博客
十一、安装数据库
./runInstaller -silent -responseFile /u01/app/oracle/database/response/db_install.rsp -ignorePrereq 等候Success字样出现,大约3分钟。并且系统会提示必要利用root用户实行一些sh脚本
假如安装失败,再次重新安装则必要清除
rm -rf /u01/app/oracle/product/11.2.0/dbhome_1/*
rm -rf /u01/app/oraInventory/*
安装完成后运行 root 脚本
su - root
sh /u01/app/oraInventory/orainstRoot.sh
sh /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
十二、创建监听器
vim /u01/app/oracle/database/response/netca.rsp
按需修改
netca /silent /responseFile /u01/app/oracle/database/response/netca.rsp
十三、创建数据库实例
vim /u01/app/oracle/database/response/dbca.rsp
修改TOTALMEMORY内存巨细为80%的物理内存
其他按需修改
dbca -silent -responseFile /u01/app/oracle/database/response/dbca.rsp
lsnrctl status 检察状态
十四、登录数据库测试
1、创建表空间
create tablespace test datafile '/u01/app/oracle/oradata/orcl/test.dbf' size 500M autoextend on next 50M maxsize unlimited;
2、创建用户
CREATE USER test IDENTIFIED BY "123456" default tablespace test;
GRANT ALL PRIVILEGES TO test;
3、创建表插入测试数据
CREATE TABLE test.student ( id NUMBER, create_timestamp NUMBER );
INSERT INTO test.student (id ,create_timestamp) VALUES (1,1);
INSERT INTO test.student (id ,create_timestamp) VALUES (2,2);
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]