您的位置:首页 > 数据库 > Oracle

OCP(02).安装Oracle11g

2016-05-23 19:14 447 查看
[root@ocp ~]# ls /tmp
linux_11gR2_database_1of2.zip linux_11gR2_database_2of2.zip
[root@ocp ~]# cd /tmp
[root@ocp tmp]# ls
linux_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 oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype 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/i18n
LANG="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 ~]$ cd
oracle@ocp ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
$ source .bash_profile


配置监听程序

[oracle@ocp ~]$ netca
















$ sqlplus / as sysdba
sqlplus: 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 sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 10 16:29:36 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plu
[oracle@ocp ~]$ export ORACLE_SID=ocp
[oracle@ocp ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 10 16:30:06 2016
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
$ vi .bash_profile
export ORACLE_SID=ocp


查看主机名:

$ hostname
ocp.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 localhost6
192.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
ls
cd rlwrap-0.41
ls
./configure
yum list | grep readline
yum install -y readline-devel
./configure
make
make check
make install


切换到oracle

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


使用sqldeveloper远程连接



问题:

执行startup启动数据库时报错:No space left on device

利用DBCA创建数据库,重启数据库,都可能会出现此类错误,主要原因可能是数据库实例太

多,需要比较多的信号量

报错信息如下:

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


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

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


然后执行命令

sysctl -p
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: