惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
O
OpenAI News
D
Docker
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
Security Latest
Security Latest
T
Tailwind CSS Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
N
News and Events Feed by Topic
aimingoo的专栏
aimingoo的专栏
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
爱范儿
爱范儿
宝玉的分享
宝玉的分享
腾讯CDC
H
Heimdal Security Blog
Webroot Blog
Webroot Blog
AI
AI
WordPress大学
WordPress大学
Recorded Future
Recorded Future
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
C
Check Point Blog
TaoSecurity Blog
TaoSecurity Blog
Cisco Talos Blog
Cisco Talos Blog
The Cloudflare Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - Franky
云风的 BLOG
云风的 BLOG

博客园 - Robert.H.fu

国内最大的免费空间站,国内最便宜最稳定的空间 编程连接远程SQL服务器出现问题及对策 SQL Server 中的时间算法 sql server 2008 CDC sql server & excel 保持一颗好学之心 log4net 配置 在oracle中使用自增字段 今年国庆过得特别快 J2EE中的13种技术规范 AMO 对象模型 Oracle常用数据字典表 怎样提高自己-驱动你的同事 七个爱情故事 人生拥有的,是不断的抉择 中国书信礼仪 (三) 中国书信礼仪 (二) 中国书信礼仪 (一) 学会提问
在ubuntu 下安装Oracle 11g
Robert.H.fu · 2008-10-13 · via 博客园 - Robert.H.fu

$ sudo su -
# apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

root@hardy:~# cd /bin
root@hardy:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2008-04-28 19:59 /bin/sh -> dash
root@hardy:/bin# ln -sf bash /bin/sh
root@hardy:/bin# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2008-05-01 22:51 /bin/sh -> bash

# echo "Red Hat Linux release 4" > /etc/redhat-release

root@hardy:/bin# cd
root@hardy:~# pwd
   /root
root@hardy:~# addgroup oinstall
   Adding group `oinstall' (GID 1001) ...
   Done.
root@hardy:~# addgroup dba
   Adding group `dba' (GID 1002) ...
   Done.
root@hardy:~# addgroup nobody
   Adding group `nobody' (GID 1003) ...
   Done.
root@hardy:~# usermod -g nobody nobody
root@hardy:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root@hardy:~# passwd -l oracle
   Password changed.
root@hardy:~# mkdir /home/oracle
root@hardy:~# chown -R oracle:dba /home/oracle
root@hardy:~# ln -s /usr/bin/awk /bin/awk
root@hardy:~# ln -s /usr/bin/rpm /bin/rpm
root@hardy:~# ln -s /usr/bin/basename /bin/basename
root@hardy:~# mkdir /etc/rc.d
root@hardy:~# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
root@hardy:~# mkdir -p /u01/app/oracle
root@hardy:~# chown -R oracle:dba /u01
root@hardy:~#

修改etc/sysctl.conf文件,在末尾增加:

fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

修改/etc/security/limits.conf文件,在末尾增加:
oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535

为了强制使用刚才我们增加的东西,修改/etc/pam.d/login文件末尾:
session required /lib/security/pam_limits.so
session required pam_limits.so
# sysctl -p

现在将oracle11g的安装包解压到/home/oracle/install/目录下。然后进入目录,设置DISPLAY参数(不设置Oracle装不上,可以一试),开始安装:
root@hardy:~# cd /home/oracle
root@hardy:/home/oracle# chown -R oracle:dba install
root@hardy:/home/oracle# su - oracle
Your account has expired; please contact your system administrator
su: User account has expired
(Ignored)
oracle@hardy:~$ export DISPLAY=127.0.0.1:0.0
oracle@hardy:~$ pwd
/home/oracle
oracle@hardy:~$ ls -l
total 4
drwxr-xr-x 6 oracle dba 4096 2007-09-18 18:50 install
oracle@hardy:~$ cd install
oracle@hardy:~/install$ ls -l

oracle@hardy:~$./runInstaller -ignoreSysPrereqs -jreLoc /usr/lib/jvm/java-6-sun/jre

在安装第二个界面,将用户组选择为dba,选择"Enterprise Edition",将检查到的所有非“Succeeded”的都打上勾,在创建完数据库后,先不点击OK.
进行如下操作:
root@hardy:~# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname of /u01/app/oraInventory to dba.
The execution of the script is complete
root@hardy:~# /u01/app/oracle/product/11.1.0/db_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.1.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
root@hardy:~#

然后,在/etc/profile文件中加入下面几句:
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export PATH=$PATH:/u01/app/oracle/product/11.1.0/db_1/bin

创建一个Oracle 11g数据库的启动脚本,名字可以叫做:oracledb,在/u01/app/oracle/product/11.1.0/db_1/bin下建立文件:oracledb,内容:

#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Listener and Instances
# It relies on the information on /etc/oratab

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export ORACLE_OWNR=oracle
export PATH=$PATH:$ORACLE_HOME/bin

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
    echo "Oracle startup: cannot start"
    exit 1
fi

case "$1" in
    start)
        # Oracle listener and instance startup
        echo -n "Starting Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
        touch /var/lock/oracle
        echo "OK"
        ;;
    stop)
        # Oracle listener and instance shutdown
        echo -n "Shutdown Oracle: "
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
        su $ORACLE_OWNR -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"
        rm -f /var/lock/oracle
        echo "OK"
        ;;
    reload|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: `basename $0` start|stop|restart|reload"
        exit 1
esac

exit 0

修改脚本为可执行的:

root@hardy:~# chmod a+x /u01/app/oracle/product/11.1.0/db_1/bin/oracledb

如果你希望开机自动启动Oracle 11g数据库,那么就作下面的工作:

root@hardy:~# ln -s /u01/app/oracle/product/11.1.0/db_1/bin/oracledb /etc/init.d/oracledb
root@hardy:~# sudo sysv-rc-conf --level 2345 oracledb on

如果没有sysv-rc-conf命令,就apt-get一个。

最后,增加你自己的用户名到dba组:

root@hardy:~# usermod -G dba -a user(注意user为你当前使用的用户,每个人的都不一定相同。)

好了,至此,Oracle 11g就安装完了。重新登录后,你就可以使用oracle的命令了。
你可以通过netca增加LISTENER,通过dbca增加数据库。测试一下是否安装成功:
(ORACLE_SID=heron 是你安装时候设置的值)

oracle@hardy:~$ export ORACLE_SID=orcl
oracle@hardy:~$ sqlplus '/as sysdba'

--startup nomount
startup open
--shutdown immediate

sql> select count(*) from dba_users;