轻量快捷版本,适合开发
0. /etc/hosts 添加 本机hostname
# hostname
promote.cache-dns.local
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 promote.cache-dns.local
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 promote.cache-dns.local
1. 下载Oracle XE
根据操作系统,选择版本下载即可。
2. 解压缩Oracle XE安装程序
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
3. 创建用户
root@localhost ~]# groupadd oinstall //创建oracle数据库安装组
[root@localhost ~]# groupadd dba //创建oracle数据库管理组
[root@localhost ~]# useradd -m -g oinstall -G dba oracle //创建oracle用户
[root@localhost ~]# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
passwd oracle //为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.
4. 建立安装目录
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
5. 开始安装
>> cd Disk1
>> rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
6. 运行配置oracle xe的命令
>> /etc/init.d/oracle-xe configure
7. 修改bash_profile中环境变量
安装结束后,系统会自动建立一个名为oracle的用户:
修改.bash_profile.在其中添加如下内容:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe; export ORACLE_HOME
ORACLE_SID=XE; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
8. 测试是否成功
sqlplus /nolog
conn / as sysdba
startup
create user ucr_param identified by "123456" default tablespace USERS;
grant all privileges to ucr_param;
conn ucr_param/123456@XE;
create table mytable(name varchar(10), age int);
insert into mytable values('user1',12);
select * from mytable;
备注:
http://www.cnblogs.com/gaojun/archive/2012/11/22/2783257.html