CentOS6.5安装Oracle 12c

时间:2022-02-09 16:44:19

CentOS6.5 安装 ORACLE 12c步骤
Oracle官网下载oracle12c安装包,解压软件:unzip linuxx64_12201_database.zip

一、创建用户和组
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle

二、创建安装目录并授权:
#mkdir /oracle/app/
#chown -R oracle:oinstall /oracle/app

三、修改内核参数:
#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
#sysctl -p

#vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

#vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

四、配置oracle环境变量
#su - oracle
#vi .bash_profile
ORACLE_BASE=/oracle/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
ORACLE_SID=JHKDB
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

五、安装依赖包:
#yum install xorg-x11-apps libaio* gcc* ksh libstdc++* compat-*
[注:如果安装oracle时检测到还有依赖没有安装,均需要再次安装完后重新检测。]

六、安装oracle:
#export DISPLAY=192.168.0.100:0.0
#./runInstaller

图形化安装选项略。。。。。。

安装过程中提示:以root用户顺序执行以下脚本:
#/oracle/app/oraInventory/orainstRoot.sh
#/oracle/app/oracle/product/12.2.0/db_1/root.sh

七、创建监听和实例:
#su - oracle
#/oracle/app/oracle/product/12.2.0/db_1/bin/netca
#/oracle/app/oracle/product/12.2.0/db_1/bin/dbca

八、创建表空间和用户并授权:
>create tablespace JHKDB_DATA datafile '/oracle/app/oracle/oradata/JHKDB/jhkdb_data01.dbf' size 2G;
>create user cmo identified by 123456 default tablespace JHKDB_DATA quota unlimited on JHKDB_DATA;
>grant create session to cmo;
>grant select any dictionary to cmo;
>grant create table to cmo;
>grant create procedure to cmo;
>grant create synonym to cmo;
>grant create view to cmo;
>grant create sequence to cmo;
>grant select any sequence to cmo;
>grant debug any procedure to cmo;
>grant execute any procedure to cmo;
>grant debug connect session to cmo;
>grant select any table to cmo;
>grant unlimited tablespace to cmo;
>grant alter any snapshot to cmo;
>grant dba to cmo;

>grant sysdba to cmo;
>grant all privileges to cmo;

九、配置PL/SQL连接ORACLE12c:
在PL/SQL客户端的tnsnames.ora文件中添加以下连接串
JHKDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.132)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = JHKDB)
)
)
重启PL/SQL客户端即可。

其他参数修改:

登录sql终端:sqlplus "/ as sysdba"

修改最大连接数:

查看当前连接数:
select count(*) from v$process;

查询当前设置的最大连接数:
select value from v$parameter where name ='processes';

修改最大连接数:
alter system set processes = 1500 scope = spfile;
修改会话游标数:

查询游标数:
show parameter open_cursors;

修改游标数:
alter system set open_cursors = 1000 scope = spfile;

重启:

shutdown immediate;
startup;

lsrnctl stop/start