OCP(02).安装Oracle11g

来源:互联网 发布:节流装置计算软件 编辑:程序博客网 时间:2024/06/01 09:48
[root@ocp ~]# ls /tmplinux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip[root@ocp ~]# cd /tmp[root@ocp tmp]# lslinux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip[root@ocp tmp]# unzip linux_11gR2_database_1of2.zip-bash: unzip: command not found[root@ocp tmp]# yum install -y unzi

创建相关用户:

[root@ocp tmp]# groupadd oinstall[root@ocp tmp]# groupadd dba[root@ocp tmp]# useradd -g oinstall -G dba oracle[root@ocp tmp]# passwd oracleChanging password for user oracle.New UNIX password:BAD PASSWORD: it is based on a dictionary wordRetype new UNIX password:passwd: all authentication tokens updated successfully.

创建相关目录

# mkdir -p /u01/app/# chown -R oracle:oinstall /u01/app/# chmod -R 775 /u01/app/

安装X相关软件:

# yum groupinstall -y 'X Window System'

以oracle用户登录

[oracle@ocp ~]$ /tmp/database/runInstaller

这里写图片描述
如果上图是如下所示:
这里写图片描述

# vi /etc/sysconfig/i18nLANG="en_US.UTF-8"

这里写图片描述
这里写图片描述
这里写图片描述

语言随便选 。
选择企业版。
这里写图片描述

这里写图片描述
这里写图片描述
这里写图片描述

这里写图片描述
这里写图片描述

# yum install gcc libgomp libaio compat-libstdc++-33 elfutils-devel elfutils-devel-static glibc-devel glibc-headers kernel-headers gcc-c++ libaio-devel libstdc++-devel sysstat unixODBC unixODBC-devel ksh

开始安装 ……
这里写图片描述

建库

oracle@ocp ~]$ cdoracle@ocp ~]$ vi .bash_profileexport ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin$ source .bash_profile

配置监听程序

[oracle@ocp ~]$ netca  

这里写图片描述

这里写图片描述

这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

$ sqlplus / as sysdbasqlplus: error while loading shared libraries: /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 10 16:29:36 2016Copyright (c) 1982, 2009, Oracle. All rights reserved.ERROR:ORA-12162: TNS:net service name is incorrectly specifiedEnter user-name:ERROR:ORA-12162: TNS:net service name is incorrectly specifiedEnter user-name:ERROR:ORA-12162: TNS:net service name is incorrectly specifiedSP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plu[oracle@ocp ~]$ export ORACLE_SID=ocp[oracle@ocp ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 10 16:30:06 2016Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>$ vi .bash_profileexport ORACLE_SID=ocp

查看主机名:

$ hostnameocp.example.com

检查/etc/hosts文件

# Do not remove the following line, or various programs# that require network functionality will fail.127.0.0.1 localhost.localdomain localhost::1 localhost6.localdomain6 localhost6192.168.10.244 ocp.example.com

启动监听:

[oracle@ocp ~]$ lsnrctl start (stop)

启动实例,挂载数据库

SQL> startup (shutdown abort)

查看监听状态:

[oracle@ocp ~]$ lsnrctl status

安装rlwrap使sqlplus中的方向键好用:
这里写图片描述
安装rlwrap

tar zxvf /home/oracle/rlwrap-0.41.tar.gz lscd rlwrap-0.41ls./configureyum list | grep readlineyum install -y readline-devel./configuremakemake checkmake install

切换到oracle

 su - oracle vi .bashrc# User specific aliases and functionsalias sqlplus='rlwrap sqlplus'alias rman='rlwrap rman' source .bashrc

使用sqldeveloper远程连接
这里写图片描述
问题:
执行startup启动数据库时报错:No space left on device
利用DBCA创建数据库,重启数据库,都可能会出现此类错误,主要原因可能是数据库实例太
多,需要比较多的信号量
报错信息如下:

ORA-27154: post/wait create failedORA-27300: OS system dependent operation:semget failed with status: 28ORA-27301: OS failure message: No space left on deviceORA-27302: failure occurred at: sskgpcreates

解决的办法就是修改Linux 内核参数

[root@linuxserver ~]# /sbin/sysctl -a | grep semkernel.sem = 250 1024 100 128[root@linuxserver ~]# vi /etc/sysctl.conf# semaphores: semmsl, semmns, semopm, semmnikernel.sem = 250 32000 100 128

然后执行命令

sysctl -p
0 0
原创粉丝点击