RedHat Linux 5.3 下安装ORACLE DATABASE 10G

一、根据Oracle 10g 官方文档安装数据库

二、安装过程如下:

  1. The system must meet the following minimum hardware requirements:

    • At least 1024 MB of physical RAM

    • The following table describes the relationship between installed RAM and the configured swap space requirement.

      RAMSwap Space
      Between 1024 MB and 2048 MB 1.5 times the size of RAM
      Between 2049 MB and 8192 MB Equal to the size of RAM
      More than 8192 MB 0.75 times the size of RAM
    • 400 MB of disk space in the /tmp directory

    • Between 1.5 GB and 3.5 GB of disk space for the Oracle software, depending on the installation type

    • 1.2 GB of disk space for a preconfigured database that uses file system storage (optional)

      Note:

      The disk space requirement for databases that use Automatic Storage Management or raw device storage is described later in this chapter.

      Additional disk space, either on a file system or in an Automatic Storage Management disk group, is required for the flash recovery area if you choose to configure automated backups.

    To ensure that the system meets these requirements:

    1. To determine the physical RAM size, enter the following command:

      [oracle@rhel database]$ grep MemTotal /proc/meminfo
      MemTotal: 897024 kB

      If the size of the physical RAM is less than the required size, then you must install more memory before continuing.

    2. To determine the size of the configured swap space, enter the following command:

      [oracle@rhel database]$ grep SwapTotal /proc/meminfo
      SwapTotal: 907632 kB

      If necessary, refer to the operating system documentation for information about how to configure additional swap space.

    3. To determine the amount of disk space available in the /tmp directory, enter the following command:

      [oracle@rhel database]$ df -k /tmp
      Filesystem 1K-blocks Used Available Use% Mounted on
      /dev/sda2 1019240 334408 632220 35% /

      If there is less than 400 MB of free disk space available in the /tmp directory, then complete one of the following steps:

      • Delete unnecessary files from the /tmp directory to meet the disk space requirement.

      • Set the TMP and TMPDIR environment variables when setting the oracle user's environment (described later).

      • Extend the file system that contains the /tmp directory. If necessary, contact your system administrator for information about extending file systems.

    4. To determine the amount of free disk space on the system, enter the following command:

      [oracle@rhel tmp]$ df -k
      Filesystem 1K-blocks Used Available Use% Mounted on
      /dev/sda2 1019240 334408 632220 35% /
      /dev/sda8 8154316 860364 6873052 12% /home
      /dev/sda6 2030736 95460 1830456 5% /var
      /dev/sda5 4061540 2429624 1422272 64% /usr
      /dev/sda3 4061572 74384 3777540 2% /usr/local
      /dev/sda1 101086 11300 84567 12% /boot
      tmpfs 448512 0 448512 0% /dev/shm

      The following table shows the approximate disk space requirements for software files for each installation type:

      Installation TypeRequirement for Software Files (GB)
      Enterprise Edition 1.5
      Standard Edition 1.5
      Custom (maximum) 1.5
    5. To determine whether the system architecture can run the software, enter the following command:

      [oracle@rhel usr]$ grep "model name" /proc/cpuinfo
      model name : Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
      model name : Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz

      Note:

      This command displays the processor type. Verify that the processor architecture matches the Oracle software release that you want to install. If you do not see the expected output, then you cannot install the software on this system。
  2. To ensure that the system meets these requirements:

    1. To determine which distribution and version of Linux is installed, enter the following command:

      [oracle@rhel usr]$ cat /etc/issue
      Red Hat Enterprise Linux Server release 5.3 (Tikanga)
      Kernel \r on an \m

      Note:

      Only the distributions and versions listed in the previous table are supported. Do not install the software on other versions of Linux.
    2. To determine whether the required kernel is installed, enter the following command:

      [oracle@rhel usr]$ uname -r
      2.6.18-128.el5

      If the kernel version does not meet the requirement specified earlier in this section, then contact your operating system vendor for information about obtaining and installing kernel updates.

    3. OraToolKit (OTK) assists you through the whole installation process and the only thing what you have to do is to copy and paste the sample commands from this howto。https://www.oratoolkit.ch/knowledge/howto/installation/seSrv-10g-R2-on-RHEL-4.1-x86_64.php
    4. Installing oraToolKit

      [root@rhel oracle]# ls
      oratoolkit-1.0.2.1.5-1.noarch.rpm
      [root@rhel oracle]# rpm -ivh oratoolkit-1.0.2.1.5-1.noarch.rpm
      Preparing... ########################################### [100%]
      1:oratoolkit ########################################### [100%]

    5. Run software requirement check (swReqCheck) action of installManager

      [root@rhel oracle]# /opt/oracle/otk/current/bin/installManager swReqCheck osSetup10gR2.cfg
      20120604_091741: Info: Action swReqCheck of installManager started
      ----------------------------------------------------------------------------------------------------
      20120604_091741: Info: Listing environment information
      20120604_091741: Info: ---------------------------------------------
      20120604_091741: Info: Object/Name | Value/Version
      20120604_091741: Info: ---------------------------------------------
      20120604_091741: Info: hostname | rhel
      20120604_091741: Info: OS | RHEL
      20120604_091742: Info: OS Version | 5
      20120604_091742: Info: OS Release | 3
      20120604_091742: Info: HW Architecture | x86
      20120604_091742: Info: user | root
      20120604_091742: Info: user shell | /bin/bash
      20120604_091742: Info: OTK | OTK_1_0_2_1_5
      20120604_091742: Info: installManager | 1.23
      20120604_091742: Info: Process ID | 7307
      20120604_091742: Info: libmiscellaneous.ksh | 1.24
      20120604_091742: Info: libstring.ksh | 1.10
      20120604_091742: Info: libfile.ksh | 1.2
      20120604_091742: Info: libotk.ksh | 1.14
      20120604_091742: Info: liberror.ksh | 1.24
      20120604_091742: Info: libosadmin.ksh | 1.19
      20120604_091742: Info: libinstallManager.ksh | 1.45
      20120604_091742: Info: libnetwork.ksh | 1.8
      20120604_091742: Info: libappctl.ksh | 1.21
      20120604_091742: Info: libdynsql.ksh | 1.2
      ----------------------------------------------------------------------------------------------------
      20120604_091742: Info: Executing libmiscellaneous.checkExecMode function
      20120604_091742: Info: Executing installManager in NORMAL mode
      20120604_091742: Info: Executing libfile.sourceConf function
      20120604_091742: Info: Sourcing /opt/oracle/otk/1.0/conf/installManager/osSetup10gR2.cfg
      ----------------------------------------------------------------------------------------------------
      20120604_091742: Info: Executing libinstallManager.setScriptVars function
      20120604_091742: Info: export SYSDATE="20120604"
      20120604_091742: Info: export EXEC_ACTION="swreqcheck"
      20120604_091742: Info: export LOG_FILE="/var/opt/oracle/otk/1.0/log-old/installManager/swreqcheck-20120604_091742.log"
      20120604_091742: Info: export PLATFORM="Linux"
      20120604_091742: Info: export OS_DISTRIBUTION="RHEL"
      20120604_091742: Info: export OS_VERSION="5"
      20120604_091742: Info: export OS_RELEASE="3"
      20120604_091742: Info: export RAM_MB="876"
      20120604_091742: Info: export HW_ARCH="x86"
      ----------------------------------------------------------------------------------------------------
      20120604_091742: Info: Executing libinstallManager.doSwRequirementCheck function
      20120604_091742: Info: Checking requirement file
      20120604_091742: Info: export SW_REQUIREMENT_FILE="/opt/oracle/otk/1.0/conf/installManager/requirement/ora10gR2-redhat-5-x86.pkg.lst"
      20120604_091742: Info: Using default package requirement file /opt/oracle/otk/1.0/conf/installManager/requirement/ora10gR2-redhat-5-x86.pkg.lst
      20120604_091742: Info: Checking if file /opt/oracle/otk/1.0/conf/installManager/requirement/ora10gR2-redhat-5-x86.pkg.lst exists
      20120604_091743: Info: Checking 32-bit OS packages
      20120604_091743: Info: export ARCH_PATTERN="i[356]86"
      20120604_091743: Info: export SW_REQUIREMENT_EGREP_PATTERN="req|opt"
      20120604_091744: Info: Higher version (2.17.50.0.6-9) as required (2.17.50.0.6-2) of 32-bit binutils installed
      20120604_091744: Info: Correct version (3.2.3-61) of 32-bit compat-libstdc++-33 installed
      20120604_091744: Info: Higher version (0.137-3) as required (0.125-3) of 32-bit elfutils-libelf installed
      20120604_091744: Info: Higher version (2.5-34) as required (2.5-12) of 32-bit glibc installed
      20120604_091744: Info: Higher version (2.5-34) as required (2.5-12) of 32-bit glibc-common installed
      20120604_091744: Info: Correct version (0.3.106-3.2) of 32-bit libaio installed
      20120604_091744: Info: Higher version (4.1.2-44) as required (4.1.1-52) of 32-bit libgcc installed
      20120604_091744: Info: Higher version (4.1.2-44) as required (4.1.1-52) of 32-bit libstdc++ installed
      20120604_091744: Info: Higher version (3.81-3) as required (3.81-1.1) of 32-bit make installed
      20120604_091744: Info: Higher version (0.137-3) as required (0.125-3) of 32-bit elfutils-libelf-devel-static installed
      20120604_091745: Info: Higher version (0.137-3) as required (0.125-3) of 32-bit elfutils-libelf-devel installed
      20120604_091745: Info: Higher version (2.6.18-128) as required (2.6.18-8) of 32-bit kernel-headers installed
      20120604_091745: Info: Higher version (2.5-34) as required (2.5-12) of 32-bit glibc-headers installed
      20120604_091745: Info: Higher version (2.5-34) as required (2.5-12) of 32-bit glibc-devel installed
      20120604_091745: Info: Higher version (4.3.2-7) as required (4.1.1-52) of 32-bit libgomp installed
      20120604_091745: Info: Higher version (4.1.2-44) as required (4.1.1-52) of 32-bit libstdc++-devel installed
      20120604_091745: Info: Higher version (4.1.2-44) as required (4.1.1-52) of 32-bit gcc installed
      20120604_091745: Info: Higher version (4.1.2-44) as required (4.1.1-52) of 32-bit gcc-c++ installed
      20120604_091745: Info: Correct version (0.3.106-3.2) of 32-bit libaio-devel installed
      20120604_091745: Info: Higher version (7.0.2-3) as required (7.0.0-3) of 32-bit sysstat installed
      20120604_091745: Info: Correct version (2.0.8-46.1) of 32-bit libtermcap-devel installed
      20120604_091746: Info: Correct version (5.1-1.1) of 32-bit readline-devel installed
      20120604_091746: Info: Correct version (2.2.11-7.1) of 32-bit unixODBC installed
      20120604_091746: Info: Correct version (2.2.11-7.1) of 32-bit unixODBC-devel installed
      ----------------------------------------------------------------------------------------------------
      20120604_091746: Info: Executing libmiscellaneous.getFooter function
      20120604_091746: Info: Terminating installManager execution
      20120604_091746: Info: Summary log file: /var/opt/oracle/otk/1.0/log-old/installManager/../installManager.log
      20120604_091746: Info: Detailed log file: /var/opt/oracle/otk/1.0/log-old/installManager/swreqcheck-20120604_091742.log
      20120604_091746: Info: Action swReqCheck of installManager ended successfully

    6.  If you have a virgin system you may get some warnings. Add the missing packages and rerun swReqCheck action until no warnings are shown.
    7. Configuring Name Resolution

      When you run Oracle Universal Installer, an error may occur if name resolution is not set up. To avoid this error, before you begin installation, you must ensure that host names are resolved only through the /etc/hosts file.

      To ensure that host names are resolved only through the /etc/hosts file:

      1. Verify that the /etc/hosts file is used for name resolution. You can do this by checking the hosts file entry in the nsswitch.conf file as follows:

        [root@rhel oracle]# cat /etc/nsswitch.conf | grep hosts
        #hosts: db files nisplus nis dns
        hosts: files dns

        The output of this command should contain an entry for files.

      2. Verify that the host name has been set by using the hostname command as follows:

        [root@rhel oracle]# hostname
        rhel

        The output of this command should be similar to the following:

        myhost.mycomputer.com
        
        
      3. Verify that the domain name has not been set dynamically by using the domainname command as follows:

        [root@rhel oracle]# domainname
        (none)

        This command should not return any results.

      4. Verify that the hosts file contains the fully qualified host name by using the following command:

        [root@rhel oracle]# cat /etc/hosts | grep `eval hostname`
        192.168.1.111 rhel
        [root@rhel oracle]# cd /
        [root@rhel /]# ls
        backup01 data01 dev installManager.log media net root srv tmp
        bin data02 etc lib misc opt sbin sys usr
        boot dbs home lost+found mnt proc selinux tftpboot var
        [root@rhel /]# cd etc
        [root@rhel etc]# ls
        acpi gpm-root.conf multipath.conf rwtab
        adjtime gre.d Muttrc rwtab.d
        alchemist group Muttrc.local samba
        aliases group- netplug sane.d
        aliases.db grub.conf netplug.d sasl2
        alsa gshadow NetworkManager scim
        alternatives gshadow- nscd.conf screenrc
        anacrontab gssapi_mech.conf nsswitch.conf scrollkeeper.conf
        asound.state gtk-2.0 ntp scsi_id.config
        at.deny hal ntp.conf securetty
        audisp host odbc.ini security
        audit host.conf odbcinst.ini selinux
        autofs_ldap_auth.conf hosts openldap services
        auto.master hosts.allow opt sestatus.conf
        auto.misc hosts.deny oracle setroubleshoot
        auto.net httpd oraInst.loc setuptool.d
        auto.smb idmapd.conf oratab sgml
        avahi init.d pam.d shadow
        bashrc initlog.conf pam_pkcs11 shadow-
        blkid inittab pam_smb.conf shells
        bluetooth inputrc pango skel
        bonobo-activation iproute2 passwd slrn.rc
        cdrecord.conf issue passwd- smartd.conf
        cipe issue.net pcmcia smrsh
        conman.conf java pinforc sound
        cron.d jvm pki ssh
        cron.daily jvm-commmon pm stunnel
        cron.deny jwhois.conf ppp subversion
        cron.hourly kdump.conf prelink.cache sudoers
        cron.monthly krb5.conf prelink.conf sysconfig
        crontab ldap.conf prelink.conf.d sysctl.conf
        cron.weekly ld.so.cache printcap sysctl.conf.20120531_152935
        csh.cshrc ld.so.conf profile sysctl.conf.20120531_153536
        csh.login ld.so.conf.d profile.20120531_152935 sysctl.conf.20120531_161847
        cups lftp.conf profile.d syslog.conf
        dbus-1 libaudit.conf protocols termcap
        default libuser.conf quotagrpadmins udev
        depmod.d localtime quotatab updatedb.conf
        desktop-profiles login.defs racoon vimrc
        dev.d logrotate.conf rc virc
        dhcp6c.conf logrotate.d rc0.d vsftpd
        DIR_COLORS logwatch rc1.d warnquota.conf
        DIR_COLORS.xterm lsb-release.d rc2.d wgetrc
        dnsmasq.conf ltrace.conf rc3.d wpa_supplicant
        dnsmasq.d lvm rc4.d wvdial.conf
        dumpdates mail rc5.d X11
        environment mailcap rc6.d xdg
        esd.conf mail.rc rc.d xinetd.conf
        exports makedev.d rc.local xinetd.d
        fb.modes man.config rc.sysinit xml
        filesystems maven readahead.d yp.conf
        firmware mgetty+sendfax reader.conf yum
        fonts mime.types reader.conf.d yum.conf
        foomatic mke2fs.conf redhat-lsb yum.repos.d
        fstab modprobe.conf redhat-release zlogin
        gconf modprobe.conf~ resolv.conf zlogout
        gdm modprobe.d rhgb zprofile
        ghostscript motd rmt zshenv
        gnome-vfs-2.0 mtab rpc zshrc
        gnome-vfs-mime-magic mtools.conf rpm
        [root@rhel etc]# cat hosts
        # Do not remove the following line, or various programs
        # that require network functionality will fail.
        192.168.1.111 rhel
        127.0.0.1 localhost.localdomain localhost
        ::1 localhost6.localdomain6 localhost6

        The output of this command should contain an entry for the fully qualified host name and for localhost.

        For example:

        192.168.100.16    myhost.us.mycompany.com   myhost
        127.0.0.1         localhost                 localhost.localdomain
        
        

        If the hosts file does not contain the fully qualified host name, then open the file and make the required changes in it(/etc/hosts).

    8. Creating the Oracle Inventory Group

      You must create the Oracle Inventory group if it does not already exist. The following subsections describe how to determine the Oracle Inventory group name, if it exists, and how to create it if necessary.

      Determining Whether the Oracle Inventory Group Exists

      When you install Oracle software on the system for the first time, Oracle Universal Installer creates the oraInst.loc file. This file identifies the name of the Oracle Inventory group and the path of the Oracle Inventory directory.

      To determine whether the Oracle Inventory group exists, enter the following command:

      [root@rhel ~]# more /etc/oraInst.loc
      # Name: /etc/oraInst.loc
      # Created: 20120531_152935
      # By: installManager
      inst_group=oinstall
      inventory_loc=/opt/oracle/oraInventory

      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/oracle/oraInventory
      inst_group=oinstall
      
      

      The inst_group parameter shows the name of the Oracle Inventory group, oinstall.

      If the oraInst.loc file does not exist, then create the Oracle Inventory group by entering the following command:

      # /usr/sbin/groupadd oinstall

      You must create an OSDBA group in the following circumstances:

      • An OSDBA group does not exist, for example, if this is the first installation of Oracle Database software on the system

      • An OSDBA group exists, but you want to give a different group of operating system users database administrative privileges in a new Oracle installation

      If the OSDBA group does not exist or if you require a new OSDBA group, then create it as follows. In the following command, use the group name dba unless a group with that name already exists.

      # /usr/sbin/groupadd dba

      (Optional)Create an OSOPER group only if you want to identify a group of operating system users with a limited set of database administrative privileges (SYSOPER operator privileges). For most installations, it is sufficient to create only the OSDBA group. If you want to use an OSOPER group, then you must create it in the following circumstances:

      • If an OSOPER group does not exist, for example, if this is the first installation of Oracle Database software on the system

      • If an OSOPER group exists, but you want to give a different group of operating system users database operator privileges in a new Oracle installation

      If you require a new OSOPER group, then create it as follows. In the following command, use the group name oper unless a group with that name already exists.

      # /usr/sbin/groupadd oper

      9. Creating the Oracle Software Owner User

        1.You must create an Oracle software owner user in the following circumstances:

          If an Oracle software owner user does not exist, for example, if this is the first installation of Oracle software on the system

          If an Oracle software owner user exists, but you want to use a different operating system user, with different group membership, to give           database administrative privileges to those groups in a new Oracle Database installation

        

        2.Determining Whether an Oracle Software Owner User Exists

         To determine whether an Oracle software owner user named oracle exists, enter the following command: 

          [root@rhel ~]# id oracle
          uid=1521(oracle) gid=1521(oinstall) groups=1521(oinstall),1522(dba),1523(oper)

         If the oracle user exists, then the output from this command is similar to the following:

          uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper)

         If the user exists, then determine whether you want to use the existing user or create another oracle user. If you want to use the existing          user, then ensure that the user's primary group is the Oracle Inventory group and that it is a member of the appropriate OSDBA and            OSOPER groups.      

         If the Oracle software owner user does not exist or if you require a new Oracle software owner user, then create it as follows. In the             following procedure, use the user name oracle unless a user with that name already exists.

          To create the oracle user, enter a command similar to the following:

            # /usr/sbin/useradd -g oinstall -G [dba,oper] oracle         

                            In this command:

            The -g option specifies the primary group, which must be the Oracle Inventory group, for example oinstall

            The -G option specifies the secondary groups, which must include the OSDBA group and if required, the OSOPER group. For                example, dba or dba,oper

          Set the password of the oracle user:      

             # passwd oracle

      10. Verifying that the User nobody Exists       

        Before installing the software, perform the following procedure to verify that the nobody user exists on the system:

        To determine whether the user exists, enter the following command:      

          # id nobody

        If this command displays information about the nobody user, then you do not have to create that user.

        If the nobody user does not exist, then enter the following command to create it:   

          # /usr/sbin/useradd nobody
  3. Configuring Kernel Parameters 

Verify that the kernel parameters shown in the following table are set to values greater than or equal to the recommended value shown. The procedure following the table describes how to verify and set the values.

ParameterValueFile
semmsl

semmns

semopm

semmni

250

32000

100

128

/proc/sys/kernel/sem
shmall 2097152 /proc/sys/kernel/shmall
shmmax Half the size of physical memory (in bytes) /proc/sys/kernel/shmmax
shmmni 4096 /proc/sys/kernel/shmmni
file-max 65536 /proc/sys/fs/file-max
ip_local_port_range Minimum:1024

Maximum: 65000

/proc/sys/net/ipv4/ip_local_port_range
rmem_default 1048576 /proc/sys/net/core/rmem_default
rmem_max 1048576 /proc/sys/net/core/rmem_max
wmem_default 262144 /proc/sys/net/core/wmem_default
wmem_max 262144 /proc/sys/net/core/wmem_max

Note:

If the current value for any parameter is higher than the value listed in this table, then do not change the value of that parameter.

If the value of any kernel parameter is different from the recommended value, then complete the following procedure:

Using any text editor, create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following:

Note:

Include lines only for the kernel parameter values that you want to change. For the semaphore parameters (kernel.sem), you must specify all four values. However, if any of the current values are larger than the recommended value, then specify the larger value.
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

By specifying the values in the /etc/sysctl.conf file, they persist when you restart the system.

  4. Setting Shell Limits for the oracle User

  To improve the performance of the software on Linux systems, you must increase the following shell limits for the oracle user: 

  To increase the shell limits:   

    1、Add the following lines to the /etc/security/limits.conf file:

    oracle soft nproc 2047     

    oracle hard nproc 16384     

    oracle soft nofile 1024     

    oracle hard nofile 65536

      2、Add or edit the following line in the /etc/pam.d/login file, if it does not already exist:

    session    required     /lib/security/pam_limits.so
    session    required     pam_limits.so

  5. If an Oracle base directory does not exist on the system or if you want to create an Oracle base directory, then Creating an Oracle Base Directory:

Before you create an Oracle base directory, you must identify an appropriate file system with sufficient free disk space, as follows:

RequirementFree Disk Space
The Oracle base directory will contain only software files. Up to 3 GB, depending on the platform
The Oracle base directory will contain both software and database files (not recommended for production databases). Up to 4 GB, depending on the platform

To identify an appropriate file system:

  1. Use the df -h command to determine the free disk space on each mounted file system.

    [root@rhel ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 996M 331M 614M 35% /
    /dev/sda8 7.8G 841M 6.6G 12% /home
    /dev/sda6 2.0G 94M 1.8G 5% /var
    /dev/sda5 3.9G 2.4G 1.4G 64% /usr
    /dev/sda3 3.9G 73M 3.7G 2% /usr/local
    /dev/sda1 99M 12M 83M 12% /boot
    tmpfs 438M 0 438M 0% /dev/shm

  2. Note the name of the mount point directory for the file system that you identified.
  3. To create the Oracle base directory and specify the correct owner, group, and permissions for it:
    1. Enter commands similar to the following to create the recommended subdirectories in the mount point directory that you identified and set the appropriate owner, group, and permissions on them:

      [root@rhel local]# cd app
      [root@rhel app]# ls
      [root@rhel app]# mkdir -p /usr/local/app/oracle
      [root@rhel app]# ls
      oracle
      [root@rhel app]# chown -R oracle:oinstall /usr/local/app/oracle
      [root@rhel app]# chmod -R 775 /usr/local/app/oracle
      [root@rhel app]#

      For example, if the mount point you identify is /u01 and oracle is the user name of the Oracle software owner, then the recommended Oracle base directory path is as follows:

      /u01/app/oracle
      
      
    2. When you configure the oracle user's environment later in this chapter, set the ORACLE_BASE environment variable to specify the Oracle base directory that you have created.

 6. Configuring the oracle User's Environment

  [root@rhel ~]#su - oracle

[oracle@rhel ~]$vi /home/oracle/.bash_profile

 

E325: ATTENTION
Found a swap file by the name "/home/oracle/.bash_profile.swp"
owned by: oracle dated: Thu May 31 23:30:24 2012
file name: /home/oracle/.bash_profile
modified: YES
user name: oracle host name: localhost.localdomain
process ID: 3937
While opening file "/home/oracle/.bash_profile"
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
# Oracle Settings 红色为oracle环境变量
umask 022
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
export ORACLE_BASE=/usr/local/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

  7、dbca 安装oracle数据库软件或直接安装数据库

    [oracle@rhel bin]$pwd

    /usr/local/app/oracle/product/10.2.0/db_1/bin
    [oracle@rhel bin]$dbca

  8、dbca安装数据库软件及数据库不说了,本文选择只安装软件,之后手动创建数据库

  9、oracle软件安装成功之后,开始手动创建数据库

10、[oracle@rhel bin]$cd $ORACLE_HOME/dbs/

[oracle@rhel dbs]$pwd
/usr/local/app/oracle/product/10.2.0/db_1/dbs

[oracle@rhel dbs]$cp init.ora initSID.ora  这里数据库SID为ezt

[oracle@rhel dbs]$vi initezt.ora

 

db_name = ezt
# first, specify the name of the databasedb_name=ezt
#for an ASM instance, use instance_type=ASM. Following is the default
instance_type=RDBMS
# you can set the db_name to your organization name as well
db_domain=world
# following two parameters set the max number of open files and processes
db_files=1000
processes=150
# following is the default block size
db_block_size=8192
# following is the default value for the statistics_level parameter
statistics_level=typical
# following is the default audit_trail value
audit_trail=none
# following three lines set the dump directory destinations
audit_file_dest='/usr/local/app/oracle/admin/ezt/adump/'
background_dump_dest='/usr/local/app/oracle/admin/ezt/bdump/'
user_dump_dest='/usr/local/app/oracle/admin/ezt/udump/'
core_dump_dest='/usr/local/app/oracle/admin/ezt/cdump/'
# following parameter sets the database compatibility level
compatible=10.2.0.1
# two control files are specified below
control_files = (/usr/local/app/oracle/ezt/control.001.dbf,
/usr/local/app/oracle/ezt/control.002.dbf,
/usr/local/app/oracle/ezt/control.003.dbf)
# cursor sharing is set to force, to make the database use bind variables
cursor_sharing=force
# following two parameters set the SGA and the PGA targets.
sga_target=140M
pga_aggregate_target=24M
# the multiblock read count is 16
db_file_multiblock_read_count=16
# the following will ensure that flashback logs
# are retained for 2 hours
db_flashback_retention_target=7200
# Following two parameters configure the optional flash recovery area
db_recovery_file_dest='/usr/local/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=1000M
# Following two parameters control the archiving of the redo
# log files. For now, I am not archiving the logs, but these two parameters
# enable me to turn it on later.
log_archive_dest_1='LOCATION=/usr/local/app/oracle/arch/'
log_archive_format='log%t_%s_%r.arc'
# following is the default optimizer mode
optimizer_mode=all_rows
# the following line makes it necessary to use a password file to connect as SYSDBA
remote_login_passwordfile=EXCLUSIVE
#Following parameter allows certain operations to resume after a suspension
#resumbable_timeout=1800
# the following two parameters pertain to automatic undo management
undo_management=auto
undo_retention=7200
# The following is optional, since I'm using only a single undo tablespace
undo_tablespace=undotbs_01
job_queue_processes=10
open_cursors=300

11、创建相关文件夹

[oracle@rhel oracle]$pwd
/usr/local/app/oracle
[oracle@rhel oracle]$mkdir admin arch ezt oradata

[oracle@rhel oracle]$ls
admin arch ezt flash_recovery_area oradata oraInventory product

[oracle@rhel admin]$pwd
/usr/local/app/oracle/admin
[oracle@rhel admin]$mkdir ezt

[oracle@rhel ezt]$pwd
/usr/local/app/oracle/admin/ezt

[oracle@rhel ezt]$mkdir adump bdump cdump udump

[oracle@rhel oradata]$pwd
/usr/local/app/oracle/oradata
[oracle@rhel oradata]$mkdir ezt

12、以sys身份登录oracle创建spfile文件并创建数据库

[oracle@rhel oradata]$sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 7 21:37:21 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> conn /as sysdba
Connected.

SQL> create spfile from pfile; 从initezt.ora文件创建spfile文件,此命令将在initezt.ora文件目录下创建spfileezt.ora文件

 

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 146800640 bytes
Fixed Size 1218172 bytes
Variable Size 96471428 bytes
Database Buffers 41943040 bytes
Redo Buffers 7168000 bytes
SQL> @/home/oracle/Scripts/ezt.sql   此文件在本站点名为“Redhat Linux 5.3 下安装ORACLE软件之后手动安装数据库脚本记录”的文章中有内容记录

SQL> alter database mount;

Database altered.

SQL> alter database open;  打开数据库

Database altered.

SQL> @/home/oracle/Scripts/tablespace.sql 此文件内容如下,创建相应表空间 

#create a user tablespace to be assigned as the default tablespace for users
CREATE TABLESPACE users LOGGING
DATAFILE '/usr/local/app/oracle/oradata/ezt/users01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
#create a tablespace for indexes, separate from user tablespace
CREATE TABLESPACE indx LOGGING
DATAFILE '/usr/local/app/oracle/oradata/ezt/indx01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;

SQL>@/usr/local/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql  作用:Creates the views of the data dictionary tables, the dynamic performance                                   views, and public synonyms for many of the views. Grants PUBLICaccess to the synonyms.
SQL>@/usr/local/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql  作用:Runs all scripts required for or used with PL/SQL.

OK。数据库创建完成,现在默认表空间是SYSTEM,之后可以使用命令ALTER DATABASE DEFAULT TABLESPACE ezt;改变到相应的表空间上去。

 

 



posted @ 2012-09-08 23:25  totozlj  阅读(1316)  评论(0编辑  收藏  举报