首先看一下我的软件环境:
DATABASE:Oracle Database 11g Release 2
下面是安装steps:
Step1. 创建用户和组(#表示以root身份,$表示以普通用户身份)
下面是oracle 数据库文档中的一段话,依照下面的话去创建或修改DB所需的用户和组:
The following local operating system groups and users are required if you are installing Oracle Database:
*The Oracle Inventory group (typically, oinstall)
*The OSDBA group (typically, dba)
*The Oracle software owner (typically, oracle)
*The OSOPER group (optional. Typically, oper)
To determine whether these groups and users already exist, and if necessary, to create them, follow these steps:
1.To determine whether the oinstall group exists, enter the following command:
# more /etc/oraInst.loc
If the output of this command shows the oinstall group name, then the group already exists.
If the oraInst.loc file exists, then the output from this command is similar to the following:
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
The inst_group parameter shows the name of the Oracle Inventory group, oinstall.
2.To determine whether the dba group exists, enter the following command:
# grep dba /etc/group
If the output from this commands shows the dba group name, then the group already exists.
3.If necessary, enter the following commands to create the oinstall and dba groups:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
4.
To determine whether the oracle user exists and belongs to the correct groups, enter the following command:
# id oracle
If the oracle user exists, then this command displays information about the groups to which the user belongs. The output should be similar to the following, indicating that oinstall is the primary group and dba is a secondary group:
uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)
5.If necessary, complete one of the following actions:
*If the oracle user exists, but its primary group is not oinstall or it is not a member of the dba group, then enter the following command:
# /usr/sbin/usermod -g oinstall -G dba oracle
*If the oracle user does not exist, enter the following command to create it:
# /usr/sbin/useradd -g oinstall -G dba oracle
This command creates the oracle user and specifies oinstall as the primary group and dba as the secondary group.
6.Enter the following command to set the password of the oracle user:
# passwd oracle
Step2. 进入db的解压目录执行runInstaller,下面是我当时的操作:
[oracle@DBServer ~]$ ls
Desktop linux_11gR2_database
[oracle@DBServer ~]$ cd linux_11gR2_database/
[oracle@DBServer linux_11gR2_database]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
[oracle@DBServer linux_11gR2_database]$ ./runInstaller
接下来就是完全的图形界面操作了,这里面就没什么好说的了。
Step3. 安装系统缺失软件与修改系统配置参数
关于这一步你可以按照安装文档里的要求那样做。但是有一个更简单的办法,安装程序会检查系统配置参数,当有参数不满足配置的时候,你要做的就是修复并重新检查,这个时候安装程序会生成一个修复脚本并提示你脚本所在的位置及你要如何操作。对于系统缺少的软件,修复脚本不会安装,需要自己手动安装。当所有的软件配置参数都满足的时候,你就可以一直next而不会再遇到什么困难了。
当初我安装的时候选择的是仅安装数据库软件,所以我现在需要创建一个监听和数据库。下面的ORACLE_HOME需要你在配置文件(~/.bash_profile)中手动设置,当然最好是把$ORACLE_HOME/bin加入到PATH中去,这样的话我们就可以在任何地方直接输入命令了
[oracle@DBServer ~]$ cd $ORACLE_HOME
[oracle@DBServer dbhome_1]$ pwd
/home/oracle/app/oracle/product/11.2.0/dbhome_1
[oracle@DBServer dbhome_1]$ cd bin/
[oracle@DBServer bin]$ netca
注:netca配置监听,图形界面
[oracle@DBServer bin]$ dbca
注:dbca 创建数据库,图形界面
上述step执行完后,数据库就可以使用了
下面讨论如何启动和关闭数据库,我们只讨论一种最简单的方法:
默认情况下,linux中的oracle是不会随系统启动而启动的。当我们reboot系统的时候,可以用如下steps启动我们的db:
[oracle@DBServer ~]$ lsnrctl start注:启动监听
LSNRCTL for Linux: Version 11.2.0.1.0 - Production