LINUX下安装ORACLE 11G

来源:互联网 发布:python学习手册 mobi 编辑:程序博客网 时间:2024/06/05 22:44
1.创建Oracle组和用户帐户
    # groupadd oinstall
    # groupadd dba
    # useradd -g oinstall -G dba oracle

    # passwd oracle

2.创建Oracle Base目录:
    # mkdir -p /u01/oracle/
    # chown -R oracle:oinstall /u01/app/
    # chmod -R 775 /u01/oracle/

3.编辑Oracle用户环境,编辑.bash_profile文件
    # su - oracle
    $ vi .bash_profile
    编辑.bash_profile文件,添加以下内容
    # For Oracle
    export DISPLAY=:0.0

# .bash_profile

 

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

 

PATH=$PATH:$HOME/bin

 

export PATH

ORACLE_BASE=/u01/oracle

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

ORACLE_SID=ORCL

LD_LIBRARY_PATH=$ORACLE_HOME/lib

PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH


4、检查需要的包是否都已安装,命令rpm -q 包名

    安装好Linux系统后需要配置一下系统。因Oracle在Linux下与Windows下有些不同,在Linux下安装时有部分程序需要与Linux的程序包重新编译和链接,所以需要有编译器等软件包。需要用到的软件包在Oracle的用户指南中有说明.以root身份登录Linux后执行以下命令检查软件包是否都已安装:
    # rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel

    # rpm -q glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat


  Oracle官方文档中确定要安装的包如下:
    binutils-2.17.50.0.6
    compat-libstdc++-33-3.2.3
    compat-libstdc++-33-3.2.3 (32 bit)
    elfutils-libelf-0.125
    elfutils-libelf-devel-0.125
    gcc-4.1.2
    gcc-c++-4.1.2
    glibc-2.5-24
    glibc-2.5-24 (32 bit)
    glibc-common-2.5
    glibc-devel-2.5
    glibc-devel-2.5 (32 bit)
    glibc-headers-2.5
    ksh-20060214
    libaio-0.3.106
    libaio-0.3.106 (32 bit)
    libaio-devel-0.3.106
    libaio-devel-0.3.106 (32 bit)
    libgcc-4.1.2
    libgcc-4.1.2 (32 bit)
    libstdc++-4.1.2
    libstdc++-4.1.2 (32 bit)
    libstdc++-devel 4.1.2
    make-3.81
    numactl-devel-0.9.8.x86_64
    sysstat-7.0.2
    注:在REDHAT6.5 中,缺少的安装包有

    compat-libstdc++-33       elfutils-libelf-devel    gcc-c++    ksh   libaio-devel   libstdc++-devel     numactl-devel

安装YUM源,用yum install  compat-libstdc++-33   elfutils-libelf-devel    gcc-c++    ksh   libaio-devel   libstdc++-devel     numactl-devel

redhat 6.5 YUM源配置,由于redhat 6.5 YUM源已存在,只需修改其 /etc/yum.repos.d 文件即可,

cd /etc/yum.repos.d

cp rhel-source.repo  rhel-source.repo.bak

vi  rhel-source.repo

把路径指向本地光盘即可

baseurl=file:///soft/redhat-iso




   (1)安装glibc-2.17-55.el7.i686.rpm时,因为依赖包相互依赖,需要与依赖包同时安装:
    rpm -ivh glibc-2.17-55.el7.i686.rpm nss-softokn-freebl-3.15.4-2.el7.i686.rpm
    (2)RHEL7中缺少包compat-libstdc++-33,可以在RHEL6中找到.


    (3)在Oracle数据库软件安装时,ksh实际是用的pdksh,但ksh也是可以使用的,只是安装时会有警告,pdksh是一个早期的软件包,可以在以下网站找到.
    http://rpm.pbone.net/

 

10、上传安装文件,并解压

[oracle@localhost ~]$ cd /u01/oracle

[oracle@localhost oracle]$ ls

p10404530_112030_Linux-x86-64_1of7.zip  p10404530_112030_Linux-x86-64_2of7.zip

[oracle@localhost oracle]$ unzip p10404530_112030_Linux-x86-64_1of7.zip   

[oracle@localhost oracle]$ unzip p10404530_112030_Linux-x86-64_2of7.zip

 

11、运行安装文件,安装oracle软件

[oracle@localhost oracle]$ mkdir -p $ORACLE_HOME

[oracle@localhost oracle]$ cd database

[oracle@localhost database]$ export DISPLAY=10.100.116

[oracle@localhost database]$ export DISPLAY=10.100.116.83:0.0

[oracle@localhost database]$ xhost +

access control disabled, clients can connect from any host

[oracle@localhost database]$ export LANG=c

[oracle@localhost database]$ ./runInstaller

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 9416 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-30_04-27-29PM. Please wait ...[oracle@localhost database]$ You can find the log of this install session at:

 /app/oraInventory/logs/installActions2015-01-30_04-27-29PM.log

 

12、安装完成后,根据提示以root身份运行两个脚本

[oracle@localhost oraInventory]$ su - root

Password: 

[root@localhost ~]# cd /u01

[root@localhost app]# cd oraInventory

[root@localhost oraInventory]# ./orainstRoot.sh

Changing permissions of /app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /app/oraInventory to oinstall.

The execution of the script is complete.

 

[root@localhost oraInventory]# cd $ORACLE_HOME

[root@localhost ~]# cd /app/oracle

[root@localhost oracle]# cd product

[root@localhost product]# cd 11.2.0

[root@localhost 11.2.0]# cd dbhome_1

[root@localhost dbhome_1]# ./root.sh

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/oracle/product/11.2.0/dbhome_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: /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 script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

[root@localhost dbhome_1]# exit

 

13、切换oracle用户,调用DBCA创建数据库

[oracle@localhost oraInventory]$ cd

[oracle@localhost ~]$ export LANG=c

[oracle@localhost ~]$ export DISPLAY=10.100.116.83:0.0

[oracle@localhost ~]$ xhost +

access control disabled, clients can connect from any host

[oracle@localhost ~]$ dbca

 

14、调用netca配置监听

[oracle@localhost ~]$ netca

 

Oracle Net Services Configuration:

Configuring Listener:LISTENER

Listener configuration complete.

Oracle Net Listener Startup:

    Running Listener Control: 

      /u01/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER

    Listener Control complete.

    Listener started successfully.

Profile configuration complete.

Default local naming configuration complete.

    Created net service name: ggdir

Oracle Net Services configuration successful. The exit code is 0

[oracle@localhost ~]$ lsnrctl status



原创粉丝点击