[Oracle] Oracle单机配置 1.Oracle Server配置

环境:Redhat6.5、Oracle11gR2

1.创建用户

groupadd oracle
useradd -m oracle -d /home/db/oracle -s /bin/sh -g oracle

 

2.修改系统参数,先检查,有需要在修改,根据自己的机器参数进行修改。参数请自行必应

vi /etc/sysctl.conf file
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 = 1048586

最好restart,或者理解生效

$ /sbin/chkconfig boot.sysctl on

 

 

3.性能优化,修改/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

修改 /etc/pam.d/login file,如果下行不存在则添加

session required pam_limits.so

 

4.配置环境变量 vi .bash_profile

export ORACLE_BASE=/home/db/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=orcl
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 #unicode编码
export PATH=${PATH}:${ORACLE_HOME}/bin/

 

5.检查相关依赖包是否安装
检查命令如下

rpm -qa | grep binutils
rpm -qa | grep compat-libcap
rpm -qa | grep compat-libstdc++-33-3.2.3
rpm -qa | grep gcc
rpm -qa | grep gcc-c++
rpm -qa | grep glibc
rpm -qa | grep glibc-devel
rpm -qa | grep ksh
rpm -qa | grep libgcc
rpm -qa | grep libstdc++
rpm -qa | grep libstdc++-devel
rpm -qa | grep libaio
rpm -qa | grep libaio-devel
rpm -qa | grep make
rpm -qa | grep sysstat
rpm -qa | grep numactl-devel
rpm -qa | grep unixODBC
rpm -qa | grep unixODBC-devel
rpm -qa | grep pdksh

如果不存在则yum install 包即可

如果没法联网,则挂载rhel镜像来使用rpm -Uvh进行安装
挂载os盘

$ mount -t iso9660 -o loop rhel-server-6.5-x86_64-dvd.iso /mnt/rhel6.5
$ unmout /mnt/rhel6.5

6.解压安装包,目录为product,开始安装

$ chmod 775 *
$ ./runInstaller

按照提示安装即可
7.安装完成后,oracle默认已经启动了
下边我们调整监听 vi /home/db/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora,参考如下:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ebda)
(ORACLE_HOME =/home/db/oracle/product/11.2.0/db_1)
(GLOBAL_DBNAME = ebda)
)

)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST= T364VP42)(PORT= 11521))
)
)

要注意的是,航末尾不要有多余空格。最好是可用toad for oracle进行格式化配置
修改tnsnames.ora

EBDA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = T364VP42)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ebda)
)
)

然后lsnrctl stop再lsnrctl start重启监听即可
配置表空间、用户常用命令见下一节内容:

#查看当前实例
select name from v$database;
#查看表空间和相关信息
SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;

#查看当前用户和表空间

SQL>select username,default_tablespace from user_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
EBDMP_PUB EBDA_DATA_TBS

#创建表空间和索引示例:
CREATE TABLESPACE EBDA_DATA_TBS DATAFILE '/home/db/oracle/oradata/orcl/EBDA_DATA_TBS.DBF'SIZE 1G AUTOEXTEND ON NEXT 512m MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;
CREATE USER EBDMP_PUB
IDENTIFIED by EBDMP_PUB
DEFAULT TABLESPACE EBDA_DATA_TBS
TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON EBDA_DATA_TBS;

grant connect,resource to EBDMP_PUB;

PS:gra#nt中请去掉#

分类上一篇:     分类下一篇:

Leave a Reply