首页 > 代码库 > CentOS安装Oracle11g Linux 搭建Pro*C/C++开发环境
CentOS安装Oracle11g Linux 搭建Pro*C/C++开发环境
【本文谢绝转载原文来自http://990487026.blog.51cto.com】
系统属性:
CentOS 6.8_X64,基于桌面,附加开发工具包安装.
上传Oracle11g安装文件到:/usr/local/oracle/
[root@oracle11 home]# mkdir -pv /usr/local/oracle mkdir: created directory `/usr/local/oracle‘ [root@oracle11 oracle]# ll /usr/local/oracle/ total 2985244 -rw-r--r--. 1 root root 1239269270 Aug 28 20:23 linux.x64_11gR2_database_1of2.zip -rw-r--r--. 1 root root 1111416131 Aug 28 20:24 linux.x64_11gR2_database_2of2.zip [root@oracle11 oracle]#
准备oracle的安装目标目录[重要]
[root@oracle11 oracle]# mkdir –p /opt/oracle
创建oracle相关用户和用户组
[root@oracle11 oracle]# groupadd dba [root@oracle11 oracle]# groupadd oinstall [root@oracle11 oracle]# useradd -g oinstall -G dba oracle [root@oracle11 oracle]# passwd oracle Changing password for user oracle. New password: oracle Retype new password:oracle passwd: all authentication tokens updated successfully. [root@oracle11 oracle]# chown -R oracle:oinstall /opt/oracle [root@oracle11 oracle]# ll /opt/oracle -d drwxr-xr-x. 2 oracle oinstall 4096 Aug 28 20:27 /opt/oracle
检查安装ORACLE依赖的RPM软件包
[root@oracle11 oracle]# mkdir /mnt/cdrom [root@oracle11 oracle]# mount /dev/cdrom /mnt/cdrom/ [root@oracle11 Packages]# cd /mnt/cdrom/Packages [root@oracle11 Packages]# rpm -ivh kernel-headers-2.6.18-164.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh glibc-headers-2.5-42.i386.rpm [root@oracle11 Packages]# rpm -ivh glibc-devel-2.5-42.i386.rpm [root@oracle11 Packages]# rpm -ivh libgomp-4.4.0-6.el5.i386.rpm| [root@oracle11 Packages]# rpm -ivh sysstat-7.0.2-3.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh libaio-devel-0.3.106-3.2.i386.rpm [root@oracle11 Packages]# rpm -ivh libstdc++-devel-4.1.2-46.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh unixODBC-2.2.11-7.1.i386.rpm [root@oracle11 Packages]# rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm [root@oracle11 Packages]# rpm -ivh gcc-4.1.2-46.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh gcc-c++-4.1.2-46.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh elfutils-libelf-devel-0.137-3.el5.i386.rpm [root@oracle11 Packages]# rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.i386.rpm| 如果找不到elfutils-libelf-devel-static, yum install elfutils-libelf-devel-static 如果找不到libgomp ,yum install libgomp
设置linux内核参数
[root@oracle11 Packages]# vim /etc/sysctl.conf 在最后面添加 #kernel.shmall = 4294967296 #kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 [root@oracle11 Packages]# vim /etc/security/limits.conf 在最后面添加 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 [root@oracle11 Packages]# vim /etc/profile在最后面添加 if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/bash" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
重新启动系统,开始安装过程
[root@oracle11 ~]# reboot [root@oracle11 ~]# chown -R oracle: /usr/local/oracle/ [root@oracle11 ~]# su oracle [oracle@oracle11 oracle]$ cd /usr/local/oracle/ [oracle@oracle11 oracle]$ unzip linux.x64_11gR2_database_1of2.zip [oracle@oracle11 oracle]$ unzip linux.x64_11gR2_database_2of2.zip [oracle@oracle11 oracle]$ cd database/ [oracle@oracle11 database]$ ./runInstaller 开始加载图形安装程序.......................
高清大图:
在这里,会自动找到我为oracle分配的安装路径
提示找不到依赖库,其实我们都全部安装了,
# rpm -q 包名,是可以查出来我已经安装了的
漫长的等待...................
安装完成:
oracle安装的位置:/opt/oracle/
oracle11g的位置:/opt/oracle/app/product/11.2.0/dbhome_1/
设置ORACLE环境变量
[oracle@oracle11 ~]$ cat /home/oracle/.bashrc 添加: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/app/product/11.2.0/dbhome_1/lib/ PATH=$PATH:/opt/oracle/app/product/11.2.0/dbhome_1/bin/ export ORACLE_HOME=/opt/oracle/app/product/11.2.0/dbhome_1/ export ORACLE_SID=orcl export ORACLE_BASE=/home/oracle/oracle
查看pro*C/C++编译器情况:
[oracle@oracle11 ~]$ proc Pro*C/C++: Release 11.2.0.1.0 - Production on Sun Aug 28 23:31:48 2016 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. System default option values taken from: /opt/oracle/app/product/11.2.0/dbhome_1/precomp/admin/pcscfg.cfg Option Name Current Value Description ------------------------------------------------------------------------------- auto_connect no Allow automatic connection to ops$ account char_map charz Mapping of character arrays and strings close_on_commitno Close all cursors on COMMIT cmax 100 CMAX Value for connection pool cmin 2 CMIN Value for connection pool cincr 1 CINCR Value for connection pool ctimeout 0 CTIMEOUT Value for connection pool cnowait 0 CNOWAIT Value for connection pool common_parser no Parse using Common SQL Front End code kr_c The type of code to be generated comp_charset multi_byte The character set type the C compiler supports config default Override system configuration file with another cpool no Support connection pooling cpp_suffix *none* Override the default C++ filename suffix db2_array no Support DB2 array insert/select syntax dbms native v6/v7/v8 compatibility mode def_sqlcode no Generate ‘#define SQLCODE sqlca.sqlcode‘ macro define __x86_64__ Define a preprocessor symbol *none* duration transaction Set pin duration for objects in the cache dynamic oracle Specify Oracle or ANSI Dynamic SQL Semantics errors yes Whether error messages are sent to the terminal errtype *none* Name of the list file for intype file errors events no Support publish-subscribe event notifications fips none FIPS flagging of ANSI noncompliant usage header *none* Specify file extension for Precompiled Headers hold_cursor no Control holding of cursors in the cursor cache implicit_svpt no Implicit savepoint prior to buffered insert iname *none* The name of the input file include *none* Directory paths for included files intype *none* The name of the input file for type information lines no Add #line directives to the generated code lname *none* Override default list file name ltype short The amount of data generated in the list file maxliteral 1024 Maximum length of a generated string literal maxopencursors 10 Maximum number of cached open cursors max_row_insert 0 Maximum number of rows to buffer on insert mode oracle Code conformance to Oracle or ANSI rules native_types no Support for native float/double nls_char *none* Specify National Language character variables nls_local no Control how NLS character semantics are done objects yes Support object types oname *none* The name of the output file oraca no Control the use of the ORACA outline no Category in which Outlines are created [yes/no/<category name>] outlnprefix *none* Outline name prefix pagelen 80 The page length of the list file parse full Control which non-SQL code is parsed prefetch 1 Number of rows pre-fetched at cursor OPEN time release_cursor no Control release of cursors from cursor cache runoutline no If yes, create Outlines in the Database select_error yes Control flagging of select errors sqlcheck syntax Amount of compile-time SQL checking stmt_cache 0 Size of statement cache sys_include /usr/lib64/gcc/Directory where system header files are found /usr/lib64/gcc/x86_64-suse-linux/4.1.0/include /usr/lib/gcc/x86_64-redhat-linux/4.1.1/include /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/include /usr/include $ORACLE_HOME/precomp/public threads no Indicates a multi-threaded application type_code oracle Use Oracle or ANSI type codes for Dynamic SQL unsafe_null no Allow a NULL fetch without indicator variable userid *none* A username/password [@dbname] connect string utf16_charset nchar_charset The character set form used by UTF16 variables varchar no Allow the use of implicit varchar structures version recent Which version of an object is to be returned PCC-F-02135, CMD-LINE: User asked for help [oracle@oracle11 ~]$
监听服务启动/关闭
[oracle@oracle11 ~]$ lsnrctl start/stop
数据库服务的启动/关闭
[oracle@oracle11 root]$ sqlplus /nolog SQL> conn /as sysdba SQL> startup 开启 SQL> shutdown immediate 关闭 SQL> conn scott 切换到scott用户 SQL> conn scott/password 切换到scott用户
如果数据库服务启动时报错
SQL> startup ORA-00845: MEMORY_TARGET not supported on this system [临时解决办法] [root@oracle11 ~]# mount -o remount,size=4G /dev/shm [永久解决方法] [root@oracle11 ~]# vim /etc/fstab tmpfs /dev/shm tmpfs defaults,size=4096M 0 0 [root@oracle11 ~]# reboot
sqlplus操作,增删改查:
[oracle@oracle11 ~]$ sqlplus Enter user-name: scott Enter password: tiger Changing password for scott New password: haha Retype new password:haha SQL> select * from tab; TNAME TABTYPE CLUSTERID ------------------------------ ------- ---------- BONUS TABLE DEPT TABLE EMP TABLE SALGRADE TABLE
ed命令的使用
SQL> ed
Wrote file afiedt.buf
20
写好按q
[root@oracle11 ~]# vim /home/oracle/afiedt.buf
本文出自 “魂斗罗” 博客,谢绝转载!
CentOS安装Oracle11g Linux 搭建Pro*C/C++开发环境
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。