Oracle11g-linux安装
Posted ☆☆☆★☆☆☆
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle11g-linux安装相关的知识,希望对你有一定的参考价值。
1、检查交换空间
用fdisk命令(例:# fdisk /dev/sdb)对磁盘进行分区,添加swap分区,新建分区,在fdisk中用“t”命令将新添的分区id改为82(Linux swap类型),最后用w将操作实际写入硬盘(没用w之前的操作是无效的)。
# mkswap /dev/xvde2 #格式化swap分区,这里的sdb2要看您加完后p命令显示的实际分区设备名
# swapon /dev/xvde2 #启动新的swap分区
为了让系统启动时能自动启用这个交换分区,可以编辑/etc/fstab,加入下面一行
/dev/xvde2 swap swap defaults 0 00
mkfs.ext4 /dev/tianyiyun/etfs
磁盘挂载: 磁盘使用fdisk 命令分区之后,选择需要使用的分区 通过 mkfs.ext4 /dev/xvde1 来格式化该分区,
然后使用命令 blkid 查看分区后的UUID
复制对应的UUID使用vim /etc/fstab 命令编辑 /etc/fstab 来加入下行设置磁盘的永久挂载点(本例挂载到 /app 目录)
UUID=xxxxxxxxxxxxxxx /app ext4 defaults 00
2、修改主机名禁用防火墙
vim /etc/sysconfig/network
vim /etc/hosts
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 0
chkconfig iptables off
service iptables stop
service iptables status
3、检查依赖包
rpm -q --qf ‘%{NAME}-%{VERSION}-%{RELEASE}(%{ARCH})\n‘ binutils \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel
4、根据缺少的安装依赖包
----其中pdksh依赖包无法通过yum 在线安装,需要下载它的rpm 包 使用 rpm方式安装
yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf \
elfutils-libelf-devel glibc glibc-common glibc-devel \
libaio libaio-devel libgcc libstdc++ libstdc++-devel \
unixODBC unixODBC-devel
rpm -e ksh-20120801-35.el6_9.x86_64
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
yum -y install glibc*.i686*
yum -y install compat-libstdc++*x86*64*
yum -y install elfutils-libelf-devel
yum -y install libaio-devel
yum -y install elfutils-libelf-devel
yum -y install libaio-devel
yum -y install unixODBC
yum -y install unixODBC-devel
5、设置操作系统参数
vim /etc/sysctl.conf
net.ipv4.ip_local_port_range= 9000 65500
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
sysctl -p ---检查配置是否有报错
/sbin/sysctl -a 确认所有值已修改好
6、设置操作系统资源限制配置
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
7、在namespace 下面加入这三行
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required /lib/security/pam_limits.so
session required pam_limits.so
8、添加oracle用户分配用户组
groupadd oinstall
groupadd dba
groupadd oper
useradd -u600 -g oinstall oracle
usermod -G dba,oper oracle
id oracle
passwd oracle
9、创建oracle主目录,分配给oracle用户相应权限
mkdir /oracle/u01
mkdir /oracle/u02
chown -R oracle:oinstall /oracle/u01
chown -R oracle:oinstall /oracle/u02
su oracle
mkdir -p /oracle/u01/app/oracle/product/11.2.0/dbhome_1
mkdir -p /oracle/u02/oradata
mkdir -p /oracle/u02/oradata/oracledb
10、以oracle用户登录:设置环境变量
vim ~/.bash_profile
ORACLE_BASE=/oracle/u01/app/oracle;
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;
export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib;
export LD_LIBRARY_PATH
ORACLE_SID=oracledb; export ORACLE_SID
ORA_NLS33=$ORACLE_HOME/nls/admin/data;
export ORA_NLS33
NLS_LANG=american_america.zhs16gbk;
export NLS_LANG
PATH=$ORACLE_HOME/bin:$PATH;
export PATH
source ~/.bash_profile ----使刚配置的环境变量生效
11、安装桌面
runlevel
yum grouplist | more
yum -y groupinstall "desktop" "X Window System"
/etc/inittab文件,修改启级别为5,如下图,然后重新启动就可以进入桌面环境了。因为我这是远程环境的,只是运用了命令行,可以使用VNC进行桌面环境的远程。
将 id:3:initdefault: 改为 id:5:initdefault:
12、安装vnc
yum install tigervnc-server -y
chkconfig vncserver on
vim /etc/sysconfig/vncservers
su oracle
vncpasswd oracle
vncserver &
13、PLSQL连接数据库时
首选项配置oci.dll
机器添加两个环境变量,名为TNS_ADMIN,值为tnsnames.ora文件所在路径。比如我的本机为:D:/instantclient_11_2/
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
14、数据库基础配置:
SELECT * FROM dba_profiles s WHERE s.profile=‘DEFAULT‘ AND resource_name=‘PASSWORD_LIFE_TIME‘;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
alter system set processes = 5000 scope = spfile;
--限制sys用户不能以普通身份登录,这个是处于安全审计才需要调整的 你可以不调
alter system set O7_DICTIONARY_ACCESSIBILITY=false scope=spfile;
alter system set remote_login_passwordfile=NONE scope=spfile;
shutdown immediate;
startup;
lsnrctl status
15、创建表空间
alter tablespace P_OA
add datafile ‘P_OA1‘ size 20480M
autoextend on next 200M maxsize 30720M
----添加表空间P_OA 添加数据文件P_OA1 初始大小20G 每次扩展200M最大扩展到30G
16、创建用户:
-- Create the user
create user t_pt
identified by "8888"
default tablespace P_OA;
-- Grant/Revoke role privileges
grant dba to t_pt with admin option;
grant resource to t_pt with admin option;
grant connect to t_pt with admin option;
-- Create the user
create user t_mflow
identified by "8888"
default tablespace P_OA;
-- Grant/Revoke role privileges
grant dba to t_mflow with admin option;
grant resource to t_mflow with admin option;
grant connect to t_mflow with admin option;
-- Create the user
create user t_du
identified by "8888"
default tablespace P_OA;
-- Grant/Revoke role privileges
grant dba to t_du with admin option;
grant resource to t_du with admin option;
grant connect to t_du with admin option;
-- Create the user
create user t_ca
identified by "8888"
default tablespace P_OA;
-- Grant/Revoke role privileges
grant dba to t_ca with admin option;
grant resource to t_ca with admin option;
grant connect to t_ca with admin option;
-- Create the user
create user t_sys
identified by "8888"
default tablespace P_OA;
-- Grant/Revoke role privileges
grant dba to t_sys with admin option;
grant resource to t_sys with admin option;
grant connect to t_sys with admin option;
以上是关于Oracle11g-linux安装的主要内容,如果未能解决你的问题,请参考以下文章