Oracle Linux 6.4 安装Oracle 12c

Oracle Linux 6.4 安装Oracle 12c

1.安装Oracle Linux 6.4系统,安装时选择Desktop,因为要用Oracle 12c图形安装,避免麻烦

2.安装完成后,第一次进入系统是,我没有新建用户,到时候直接用root登陆

3.安装完成后,用root登陆系统 打开 终端 使用 yum update -y 更新系统

[root@hostname ~]# yum update -y

4.更新完系统以后,安装Oracle 12c需要的组件,使用以下整理好的命令

[root@hostname ~]# yum install -y binutils-* compat-libstdc++-* compat-libcap1-* gcc-* glibc-* gilbc-devel-* ksh* libaio-* libaio-devel-* libgcc-* libstdc++-* libXext-* libX11-* libXau-* libXi-* make-* systat-*

5.创建oracle用户和组
[root@hostname ~]# groupadd oinstall
[root@hostname ~]# groupadd dba
[root@hostname ~]# useradd -g oinstall -G dba oracle
[root@hostname ~]# passwd oracle
(输入两次密码,设置oracle用户的密码,输入过程中没有信息回显)

6.安装完需要的组件后,创建Oracle 12c需要用到的路径,并修改权限

习惯这样这样规划,并非硬性规定

/u01: 放oracle的程序
/u02: 放数据库文件
/u03: 放备份数据,oracle的安装程式也存放在这里

创建路径并修改权限
[root@hostname ~]# mkdir /u01
[root@hostname ~]# mkdir /u02
[root@hostname ~]# mkdir /u03
[root@hostname ~]# chown -R oracle:oinstall /u01
[root@hostname ~]# chown -R oracle:oinstall /u02
[root@hostname ~]# chown -R oracle:oinstall /u03
[root@hostname ~]# chmod -R 775 /u01
[root@hostname ~]# chmod -R 775 /u02
[root@hostname ~]# chmod -R 775 /u03

7.修改内核参数

(1)修改/etc/sysctl.conf文件,添加如下参数

[root@hostname ~]# vim /etc/sysctl.conf

#Add For Oracle 12c
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1052192768
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

(2)/sbin/sysctl -p 加载新修改的参数
[root@hostname ~]# /sbin/sysctl -p

8.修改用户限制

修改/etc/security/limits.conf添加如下参数

[root@hostname ~]# vim /etc/security/limits.conf
#Add For Oracle 12c
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240

9.修改oracle用户的环境变量

(1)在 /home/oracle/.bash_profile文件中添加如下参数

[oracle@hostname ~]$ vim .bash_profile

#Add For Oracle 12c
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export EDITOR=/bin/vi

(2)

使配置文件生效
[oracle@hostname ~]$ source .bash_profile

10.下载安装程序
(1)将提前下好的linuxamd64_12c_database_1of2.zip和linuxamd64_12c_database_2of2.zip两个文件上传到/u03
提前没有下载的话可以直接下载放到这里
(2)解压文件
[oracle@hostname u03]$ unzip linuxamd64_12c_database_1of2.zip
[oracle@hostname u03]$ unzip linuxamd64_12c_database_1of2.zip

解压后得到如下文件夹 /u03/database
保险起见,重新改下database文件夹的权限,以免没有执行权限
[root@hostname ~]# chown -R oracle:oinstall /u03
[root@hostname ~]# chmod -R 775 /u03

PS:觉得Linux麻烦,也可以下载好linuxamd64_12c_database_1of2.zip和linuxamd64_12c_database_2of2.zip之后
先在Windows下解压出来,再把database上传到 /u03 然后改权限

11.运行OUI安装程序
以oracle用户登录图形系统
打开 终端 , cd /u03/database

[oracle@hostname ~]$ cd /u03/database
[oracle@hostname database]$ ./runInstaller

12.然后会打开图形的安装界面,跟着界面提示,点下一步安装
(1)在出现安装位置的时候注意下安装的位置
改一下数据库文件的位置为 /u02/oradata
(2)安装的过程中,需要以root身份运行两个安装脚本
[root@hostname ~]# /u01/app/oraInventory/orainstRoot.sh
[root@hostname ~]# /u01/app/oracle/product/12.1.0/dbhome_1/root.sh
(3)安装完成之后,如果选择了创建数据库,会启动数据库创建过程,如果失败了的话,可以重试一下,可能就能创建了

13.正常的话,创建数据库时,会自动创建监听
可以查看下状态
[oracle@hostname ~]$ lsnrctl status

14.使用sqlplus连接数据库
[oracle@hostname ~]$ sqlplus /as sysdba
sql>select * from v$version(查看数据库版本信息)

至此,数据库安装完成,并创建了一个数据库实例



遇到的问题及解决办法:

1.问题:
[oracle@hostname ~]$ lsnrctl status
提示:command not found

解决办法:
环境变量设置错误,或者没有加载修改后的环境变量
修改 /home/oracle/.bash_profile 中的参数
修改完成后 使用 source .bash_profile 命令加载环境变量

2.问题:
[oracle@hostname ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2013 18:00:46
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=219.146.13.36)(PORT=1521)))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation ti

med out

解决办法:
这是listener.ora中的主机参数设置错误,需要修改listener.ora中的 HOST 的值
[oracle@hostname ~]$ vim /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 这里改为你的IP地址或域名 )(PORT = 1521))
)
)

然后再运行 lsnrctl start 启动监听

[oracle@hostname ~]$ lsnrctl start
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2013 18:34:59
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/hostname/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx(IP地址))(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 07-OCT-2013 18:35:10
Uptime 0 days 0 hr. 0 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/hostname/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx(IP地址))(PORT=1521)))
The listener supports no services
The command completed successfully

这样监听就起来了

3.问题:
修改完listener.ora的HOST之后,运行 lsnrctl status,报错
[oracle@hostname ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2013 18:31:08
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx.xxx.xxx.xxx(IP地址))(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560:

TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

解决办法:监听没有启动,运行 lsnrctl start 启动监听
[oracle@hostname ~]$ lsnrctl start
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 07-OCT-2013 18:34:59
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/hostname/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx(IP地址))(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 07-OCT-2013 18:35:10
Uptime 0 days 0 hr. 0 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/hostname/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx(IP地址))(PORT=1521)))
The listener supports no services
The command completed successfully

4.问题:
如果 lsnrctl start 启动监听以后 最后显示的是
The listener supports no services
The command completed successfully
oracle client无法连接数据库,
报错:oracle ORA-12514:TNS:listener does not currently know of service requested in connect descriptor

解决办法:
说明监听启动了,但是oracle实例没有注册到监听中,还需要将是oracle实例注册到监听中
[oracle@hostname ~]$ sqlplus / as sysdba
SQL>show parameter service_names(显示服务名)
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string orcl

SQL>alter system register(强制注册服务)

或者 在/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora 文件中加入如下参数
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl(此为数

据库实例名))
(SID_NAME = orcl(此为数据库实例名))
)
)
或者 执行 netmgr
[oracle@hostname ~]$ netmgr
在 Oracle Net Manager 界面中 点 监听程序--> listener 在右边选择 数据库实例,注册数据库实例

5.问题:
Oracle SQL Developer报错:状态: 失败 -测试失败: IO 错误: The Network Adapter could not establish the connection

解决办法:
服务器的防火墙开放Oracle要用的的1521端口,因我的是测试环境,直接禁用了防火墙

相关文档
最新文档