在Oracle Linux 6.6上安装Oracle 10gR2

查看硬體配置

# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda2        24G  5.2G   18G  23% /

tmpfs           3.8G   76K  3.8G   1% /dev/shm

/dev/sda1       477M   63M  385M  14% /boot

/dev/sda6        31G   48M   29G   1% /oracle

/dev/sdb1      1008G  200M  957G   1% /u1

/dev/sr0        3.6G  3.6G     0 100% /media/OL6.6 x86_64 Disc 1 20141018

 

# more /etc/redhat-release

Red Hat Enterprise Linux Server release 6.6 (Santiago)

[root@dbrebk ~]# more /etc/oracle-release

Oracle Linux Server release 6.6

 

# uname -a

Linux dbrebk 3.8.13-44.1.1.el6uek.x86_64 #2 SMP Wed Sep 10 06:10:25 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

 

top - 08:14:18 up 1 day, 15:40,  2 users,  load average: 0.00, 0.01, 0.05

Tasks: 174 total,   1 running, 173 sleeping,   0 stopped,   0 zombie

Cpu(s):  0.1%us,  0.1%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   7914284k total,  1567316k used,  6346968k free,   183432k buffers

Swap:  4095992k total,        0k used,  4095992k free,   943140k cached

 

# locale

LANG=en_US.UTF-8

LC_CTYPE="en_US.UTF-8"

LC_NUMERIC="en_US.UTF-8"

LC_TIME="en_US.UTF-8"

LC_COLLATE="en_US.UTF-8"

LC_MONETARY="en_US.UTF-8"

LC_MESSAGES="en_US.UTF-8"

LC_PAPER="en_US.UTF-8"

LC_NAME="en_US.UTF-8"

LC_ADDRESS="en_US.UTF-8"

LC_TELEPHONE="en_US.UTF-8"

LC_MEASUREMENT="en_US.UTF-8"

LC_IDENTIFICATION="en_US.UTF-8"

LC_ALL=

 

# gcc -v

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux

Thread model: posix

gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) 

 

# useradd -g root -G root dba

# passwd dba

# vi /etc/passwd

dba:x:0:0::/home/dba:/bin/bash

 

設置主機IP

# more /etc/sysconfig/network-scripts/ifcfg-eth0

 

設置主機名

# more /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 

172.18.60.155 rman rman.pyzs.com.cn

 

# more /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=rman.pyzs.com.cn

GATEWAY=172.18.60.254

# hostname rman.pyzs.com.cn

 

禁用FIREWALL关闭防火墙

service iptables stop

 

禁用SELINUX

修改/etc/selinux/config

将SELINUX=enforced 修改为SELINUX=disabled

 

重启OS

# umount /dev/cdrom

# init 6

 

=========================================================================================

配置yum本地源

将光盘mount至/mnt,再通过yum设置/mnt为本地源:

# mount /dev/cdrom /mnt; cd /mnt/Server

# cd /etc/yum.repos.d/

# mv public-yum-ol6.repo public-yum-ol6.repo.bak

# vi public-yum-ol6.repo

[ol6_u6]

name=Oracle Linux 5.8 64bit DVD

baseurl=file:///mnt/Server

gpgcheck=0

enabled=1

 

# yum search oracle

 

# yum install oracle-rdbms-server-11gR2-preinstall

# yum install glibc.i686

# yum install libXp.i686

# yum install libXt.i686

# yum install libXtst.i686

# yum install glibc-devel.i686 

# yum install compat-libstdc++-296.i686

# yum install compat-libstdc++-33.i686 

# yum install libstdc++.i686  

# yum install libstdc++-devel.i686

# yum install compat-gcc-34.x86_64

 

安装完oracle-rdbms-server-11gR2-preinstall 后,已经拥有oracle用户。

# id oracle

uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)

 

 

=========================================================================================================================================

安装rlwrap

==========

 

# cd /oracle/soft

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/rlwrap-0.42-1.el6.x86_64.rpm

# rpm -ivh rlwrap-0.42-1.el6.x86_64.rpm

 

建立Oracle Base 的目錄 

----------------------

 

下列的步驟建立一個新的目錄,用於存放Oracle的安裝軟體. 

# mkdir -p /oracle/app

# chown -R oracle:oinstall /oracle

# chmod -R 775 /oracle

 

建立資料庫檔案的目錄

 

建立一個新的目錄,用於存放資料庫的檔案: 

# mkdir -p /u1/database

# chown -R oracle:oinstall /u1

# chmod 775 /u1

 

設定oracle用戶的環境變數 

 

修改oracle用戶的.bash_profile,設定相關的環境變數 e:

 

登入oracle 用戶: 

# su - oracle

 

# 將oracle用戶的環境變數值設定在 ~oracle/.bash_profile的檔案: 

#  vi $HOME/.bash_profile

ORACLE_BASE=/oracle/app

ORACLE_HOME=$ORACLE_BASE/product/10.2.0

ORACLE_SID=orcl

TNS_ADMIN=$ORACLE_HOME/network/admin

LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"

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

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH

 

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'

 

安裝Oracle Database 10g Release 2 軟體 

======================================

 

(0)、準備 Oracle軟體:

---------------------

 

# mkdir -p /oracle/soft/oracle10g

# cd /oracle/soft/oracle10g

# scp -rp [email protected]:/oracle/soft/10201_database_linux_x86_64.cpio .

# scp -rp [email protected]:/oracle/soft/p8202632_10205_Linux-x86-64.zip .

 

 

(1)、執行下列的步驟安裝Oracle軟體: 

----------------------------------

 

# su - oracle

$ cd /oracle/soft/oracle10g

解壓縮下載的檔案: 

$ gunzip 10201_database_linux_x86_64.cpio.gz

拆開10201_database_linux_x86_64.cpio

$ cpio -idmv <  10201_database_linux_x86_64.cpio 

修改静默安装的参数文件

$ cd /oracle/soft/oracle10g/database/response/

$ cp standard.rsp standard_softonly.rsp

$ vi standard_softonly.rsp

$ sdiff -s standard_softonly.rsp standard.rsp

UNIX_GROUP_NAME="oinstall"                                    | UNIX_GROUP_NAME=<Value Unspecified>

ORACLE_HOME="/oracle/app/product/10.2.0"                      | ORACLE_HOME=<Value Required>

ORACLE_HOME_NAME="OraDbHome1"                                 | ORACLE_HOME_NAME=<Value Required>

s_nameForDBAGrp="dba"                                         | s_nameForDBAGrp=<Value Required>

s_nameForOPERGrp="dba"                                        | s_nameForOPERGrp=<Value Required>

n_configurationOption=3                                       | n_configurationOption=<Value Required>

 

$ chmod 700 standard_softonly.rsp

由於Oracle10.2.0.1不支持redhat-6.

解決方法:

# cp /etc/redhat-release /etc/redhat-release-bak

Red Hat Enterprise Linux Server release 6.6 (Santiago)

# vi /etc/redhat-release 

Red Hat Enterprise Linux AS release 4 (Nahant Update 8)

 

通过response文件运行OUI

/oracle/soft/oracle10g/database/response/standard_softonly.rsp必须是绝对路径,含文件名;

-noconfig表示不运行配置助手只装软件

# su - oracle

$ cd /oracle/soft/oracle10g/database

$ ./runInstaller -silent -noconfig -responseFile /oracle/soft/oracle10g/database/response/standard_softonly.rsp

報錯:

./runInstaller: /oracle/soft/oracle10g/database/install/.oui: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

解決:

# yum install glibc.i686

# yum install glibc-devel.i686

再結果如下:

Setup successful

 

End of install phases.(Thu Jan 15 11:47:20 CST 2015)

WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.

To register the new inventory please run the script '/oracle/app/oraInventory/orainstRoot.sh' with root privileges. 

If you do not register the inventory, you may not be able to update or patch the products you installed.

 

The following configuration scripts 

/oracle/app/product/10.2.0/root.sh

need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts and the configuration tools after exiting the OUI.

 

The installation of Oracle Database 10g was successful.

Please check '/oracle/app/oraInventory/logs/silentInstall2015-01-15_11-45-16AM.log' for more details.

 

安装结束后,su到root用户执行root.sh

# sh /oracle/app/product/10.2.0/root.sh

Running Oracle10 root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/product/10.2.0

 

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.

 

(2)、更新oracle補丁集

---------------------

 

由於Oracle10.2.0.5已支持redhat-6, 回復Red Hat版本設定的檔案:

# cp /etc/redhat-release-bak /etc/redhat-release

Red Hat Enterprise Linux Server release 6.6 (Santiago)

由於安裝時會在/oracle/oraInventory生成腳本文件orainstRoot.sh,需事先創建目錄:

# mkdir -p /oracle/oraInventory

# chown -R oracle:oinstall /oracle/oraInventory/

 

所有Oracle的服務必需要停止.登入oracle用戶使用  OUI installer (runInstaller)更新

patch: 

解壓縮下載的檔案: 

$ cd /oracle/soft/oracle10g

$ unzip  p8202632_10205_Linux-x86-64.zip

 

修改静默安装的参数文件

$ cd /oracle/soft/Disk1/response

$ cp patchset.rsp patchset_softonly.rsp

$ vi patchset_softonly.rsp

$ sdiff -s patchset_softonly.rsp patchset.rsp

UNIX_GROUP_NAME="oinstall"                                    | UNIX_GROUP_NAME=<Value Unspecified>

FROM_LOCATION="/oracle/soft/oracle10g/Disk1/stage/products.xm | FROM_LOCATION=<Value Required>

ORACLE_HOME="/oracle/app/product/10.2.0"                      | ORACLE_HOME=<Value Required>

ORACLE_HOME_NAME="OraDbHome1"                                 | ORACLE_HOME_NAME=<Value Required>

 

$ chmod 700 patchset_softonly.rsp

 

通过response文件运行OUI

/oracle/soft/oracle10g/Disk1/response/patchset_softonly.rsp 必须是绝对路径,含文件名;

安装命令之后必須加上两个参数([email protected] DECLINE_SECURITY_UPDATES=true)

-noconfig 表示不运行配置助手只装软件

-force 表示強制安裝?

$ cd /oracle/soft/oracle10g/Disk1/

$ ./runInstaller -silent -noconfig -responseFile /oracle/soft/oracle10g/Disk1/response/patchset_softonly.rsp [email protected] DECLINE_SECURITY_UPDATES=true -ignoreSysPrereqs -force

結果如下:

Setup successful

 

End of install phases.(Thursday, January 15, 2015 1:29:34 PM CST)

Starting to execute configuration assistants

The following configuration assistants have not been run. This can happen for following reasons - either root.sh is to be run before config or Oracle Universal Installer was invoked with the -noConfig option.

--------------------------------------

The "/oracle/app/product/10.2.0/cfgtoollogs/configToolFailedCommands" script contains all commands that failed, were skipped or were cancelled. This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.

The "/oracle/app/product/10.2.0/cfgtoollogs/configToolAllCommands" script contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.

 

--------------------------------------

WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.

To register the new inventory please run the script '/oracle/oraInventory/orainstRoot.sh' with root privileges. 

If you do not register the inventory, you may not be able to update or patch the products you installed.

The following configuration scripts need to be executed as the "root" user.

#!/bin/sh

#Root script to run

/oracle/oraInventory/orainstRoot.sh

/oracle/app/product/10.2.0/root.sh

To execute the configuration scripts:

    1. Open a terminal window

    2. Log in as "root"

    3. Run the scripts

 

The installation of Oracle Database 10g Release 2 Patch Set 4 was successful.

Please check '/oracle/oraInventory/logs/silentInstall2015-01-15_01-25-37PM.log' for more details.

 

$ su - root

# sh /oracle/oraInventory/orainstRoot.sh

Changing permissions of /oracle/oraInventory to 770.

Changing groupname of /oracle/oraInventory to oinstall.

The execution of the script is complete

 

# sh /oracle/app/product/10.2.0/root.sh

Running Oracle 10g root.sh script...

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/product/10.2.0

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: y

   Copying coraenv to /usr/local/bin ...

 

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.

 

===================================================================================================================

 

建立 orcl資料庫 

===============

 

配置response文件

# chown -R oracle:oinstall /u1

# su - oracle

$ mkdir -p /u1/database/response

$ mkdir -p /u1/database/oradata

$ cd /u1/database/response

$ scp -rp [email protected]:/u1/database/response/*.* .

$ cp dbca.rsp dbca_orcl.rsp

$ vi dbca_orcl.rsp

$ sdiff -s dbca_orcl.rsp dbca.rsp

GDBNAME = "orcl"                                              | GDBNAME = "orcl10g.us.oracle.com"

SID = "orcl"                                                  | SID = "orcl10g"

SYSPASSWORD = "rman"                                          | #SYSPASSWORD = "password"

SYSTEMPASSWORD = "rman"                                       | #SYSTEMPASSWORD = "password"

EMCONFIGURATION = "LOCAL"                                     | #EMCONFIGURATION = "NONE"

SYSMANPASSWORD = "rman"                                       | #SYSMANPASSWORD = "password"

DBSNMPPASSWORD = "rman"                                       | #DBSNMPPASSWORD = "password"

CHARACTERSET = "AL32UTF8"                                     | #CHARACTERSET = "US7ASCII"

 

$ export ORACLE_SID=rman

$ export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"

 

通过response文件运行DBCA

$ $ORACLE_HOME/bin/dbca -silent -cloneTemplate -datafileDestination /u1/database/oradata -responseFile /u1/database/response/dbca_orcl.rsp

说明:如果未设置 -datafileDestination 参数,则数据文件默认存放到$ORACLE_BASE/oradata下,如果连ORACLE_BASE也没设置,则默认存放$ORACLE_HOME/oradata下。

报错:

java.lang.UnsatisfiedLinkError: /oracle/app/product/10.2.0/lib32/libOsUtils.so: libgcc_s.so.1: cannot open shared object file: No such file or directory

解决:

# yum install libgcc_s.so.1

报错

UnsatisfiedLinkError exception loading native library: njni10

可能是glibc和glibc-devel包仅安装了64bit版的,而32bit版本没安装,那么需手工安装:

# cd /mnt/Server/Packages

# rpm -Uvh glibc-*.i686.rpm glibc-devel-*.i686.rpm

安装完32bit的glibc和glibc-devel后, 再对Oracle进行relink:

$ $ORACLE_HOME/bin/relink all

 

重新运行DBCA

$ $ORACLE_HOME/bin/dbca -silent -cloneTemplate -datafileDestination /u1/database/oradata -responseFile /u1/database/response/dbca_orcl.rsp

Look at the log file "/oracle/app/product/10.2.0/cfgtoollogs/dbca/orcl/orcl.log" for further details.

 

删除数据库

$ dbca -silent -deleteDatabase -sourceDB orcl -sysDBAUserName sys -sysDBAPassword rman

 

通过response文件运行NetCA

# su - oracle

$ cd /u1/database/response

$ $ORACLE_HOME/bin/netca /silent /responsefile /u1/database/response/netca.rsp

报错:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /oracle/app/product/10.2.0/jdk/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory

解决:

# yum install libXp.i686

# yum install libXt.i686

# yum install libXtst.i686

 

重新运行NetCA

$ $ORACLE_HOME/bin/netca /silent /responsefile /u1/database/response/netca.rsp

Parsing command line arguments:

    Parameter "silent" = true

    Parameter "responsefile" = /u1/database/response/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Listener started at port:1521

Oracle Net Listener Startup:

    Running Listener Control: 

      /oracle/app/product/10.2.0/bin/lsnrctl start LISTENER

    Listener Control complete.

    Listener started successfully.

Listener configuration complete.

Default local naming configuration complete.

Oracle Net Services configuration successful. The exit code is 0

 

$ vi $ORACLE_HOME/network/admin/listener.ora

 

連線測試

$ sqlplus system/rman

SQL> select * from v$version;

 

BANNER

----------------------------------------------------------------

Oracle Database 10g Release 10.2.0.5.0 - 64bit Production

PL/SQL Release 10.2.0.5.0 - Production

CORE    10.2.0.5.0      Production

TNS for Linux: Version 10.2.0.5.0 - Produ

 

修改參數:

$ sqlplus '/as sydba'

SQL> show parameter sga;

SQL> shutdown immediate

SQL> startup;

SQL> alter system set sga_max_size=2048m scope=spfile;

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database noarchivelog;

SQL> alter database open;

SQL> alter system set sga_target=2048M;

SQL> show parameter sga;

SQL> show parameter open_links 

SQL> alter system set open_links=200 scope=spfile;

 

修改/etc/oratab 設定開機自動啟動資料庫.

# vi /etc/oratab

bshis:/oracle/app/product/10.2.0:Y

 

# vi /etc/rc.d/rc.local

su - oracle -c 'lsnrctl start'

su - oracle -c 'dbstart'

 

卸载oracle

# cd /etc

# rm oratab

# rm oraInst.loc

# cd /usr/local/bin

# rm coraenv

# rm dbhome

# rm oraenv

 

安装图形化界面 

yum groupinstall "X Window System" "GNOME Desktop Environment"

need KDE

yum groupinstall "X Window System" KDE

need XFCE

yum groupinstall "X Window System" XFCE

 

OS下載地址: 

https://www.quist.ch/downloads/search?Downloads%5Bcategory%5D=os&Downloads%5Bversion%5D=&Downloads%5Bplatform%5D=Linux&Downloads%5Barchitecture%5D=x86_64&yt0=

 

OracleLinux下載地址:  https://edelivery.oracle.com/linux

 

你可能感兴趣的:(oracle)