Install Oracle 11G Single-instance database on Linux under VM virtual machine

Source: Internet
Author: User
Tags gpg file permissions iptables ssh secure shell sqlplus

Install Oracle 11G Single-instance database on Linux under VM virtual machine

1. Environment and pre-installation planning: virtual machines and OS as follows

Environment: VMware wordstation Ace Edition 6.0.2

Operating system: Oraclelinux-r5-u8-server-i386-dvd 3.2G

To install the operating system, it is important to note that there is enough disk space to reserve.

My plan is to:

The virtual machine allocates 1024M of memory, of course, if the host memory is sufficient, the memory setting at the time of installation 2048M can be faster.

The virtual machine allocates a piece of disk, 30G of disk space.

/boot 100M ext3

/20G ext3

Swap 2048M

The remaining nearly 8G space is reserved for ASM use.

At the same time it is best to install the system when the graphics mode installation, direct installation of graphic mode, more convenient.

Configuration of 2.OS:

After the operating system is installed, you need to configure the following temporarily.

Fixed IP and Dns/etc/sysconfig/network-scripts/ifcfg-eth0

Host name/etc/sysconfig/network

Modify Boot RunLevel/etc/inittab

Close Selinux/boot/grub/menu.lst

Modify the Sshd_config to resolve the SSH timeout auto-disconnect issue

Login As:root

[email protected] ' s password:

Last login:wed June 5 09:11:26 2013

[Email protected] ~]# hostname

Oel-01

[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0

# advanced Micro Devices [AMD] 79c970[pcnet32 LANCE]

Device=eth0

Bootproto=none

Hwaddr=00:0c:29:99:8b:c9

Onboot=yes

netmask=255.255.255.128

ipaddr=192.168.1.212

gateway=192.168.1.254

Type=ethernet

Userctl=no

Ipv6init=no

Peerdns=yes

[Email protected] ~]# cat/etc/resolv.conf

NameServer 222.88.88.88

[Email protected] ~]# cat/etc/sysconfig/network

Networking=yes

Networking_ipv6=yes

Hostname=oel-01

[Email protected] ~]# Vi/etc/inittab

Id:3:initdefault:

[Email protected] ~]# Vi/boot/grub/menu.lst

Add selinux=0 to close selinux at the end of the kernel line. You can also turn it off in the graphical configuration interface when you are finished installing the system.

[Email protected] ~]# cd/etc/ssh/

[[email protected] ssh]# grep "clientalive" Sshd_config

#ClientAliveInterval 0

#ClientAliveCountMax 3

[email protected] ssh]# CP Sshd_configsshd_config.bak

[Email protected] ssh]# sed-i "s/#ClientAliveInterval 0/clientaliveinterval 60/g" Sshd_config

[[email protected] ssh]# grep "clientalive" Sshd_config

Clientaliveinterval 60

#ClientAliveCountMax 3

[Email protected] ssh]# sed-i "s/#ClientAliveCountMax 3/clientalivecountmax 10/g" Sshd_config

[[email protected] ssh]# grep "clientalive" Sshd_config

Clientaliveinterval 60

Clientalivecountmax 10

[[Email protected] ssh]# service sshd restart

stopping sshd: [OK]

Starting sshd: [OK]

You should restart the system to verify that the above configurations are in effect. As effective, shut down, take snapshots in VMware

3. Create a user group to install Oracle

[Email protected] ~]# groupadd-g Oinstall

[[email protected] ~]# groupadd-g 1031 dba

[Email protected] ~]# groupadd-g 1032 oper

[Email protected] ~]# Useradd Oracle

[Email protected] ~]# passwd Oracle

Changing password for user Oracle.

New UNIX Password:

Bad Password:it are based on a Dictionaryword

Retype new UNIX Password:

Passwd:all Authentication tokens updatedsuccessfully.

[Email protected] ~]# usermod-g oinstall-gdba,oper Oracle

[Email protected] ~]# mkdir-p/u01/app/oracle/product/11.2.0/dbhome_1

[Email protected] ~]# chown-r oracle:oinstall/u01/

[Email protected] ~]# chmod 775/u01/

[Email protected] app]# pwd

/u01/app

[Email protected] app]# Ls-al

Total 16

Drwxrwxr-x 4 Oracle Oinstall 4096 June 5 10:56.

Drwxrwxr-x 3 Oracle Oinstall 4096 June 5 10:55..

Drwxrwxr-x 2 Oracle oinstall 4096 June 5 10:55 Oracle

4. Mount the disc and install the software

[Email protected] ~]# cd/etc/yum.repos.d/

[[email protected] yum.repos.d]# ls

[Email protected] yum.repos.d]# Vioel_cdrom.repo

[Email protected] yum.repos.d]# Catoel_cdrom.repo

[OEL5.8]

Name=oracle Linux

Baseurl=file:///mnt/cdrom/server

Enabled=1

Gpgcheck=0

[Email protected] yum.repos.d]# cd/mnt/

[Email protected] mnt]# mkdir CDROM

[Email protected] mnt]# Mount/dev/cdrom/mnt/cdrom

Mount:block Device/dev/cdrom iswrite-protected, mounting read-only

[[email protected] mnt]# ls

CDRom

[Email protected] mnt]# CD cdrom/

[[email protected] cdrom]# ls

Blafdoc.css eula.py readme-en.html Server

Cluster GPL Release-notes-en Supportinfo

Clusterstorage images release-notes-en.html TRANS. TBL

EULA Isolinux Rpm-gpg-key VT

Eula.en_us Readme-en rpm-gpg-key-oracle

[[email protected] server]# pwd

/mnt/cdrom/server

[Email protected] server]# ls/etc/pki/rpm-gpg/

Rpm-gpg-key Rpm-gpg-key-fedora rpm-gpg-key-oracle

Rpm-gpg-key-el4 Rpm-gpg-key-fedora-test

[Email protected] server]# rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-oracle

Start installing the Software

Method One:

[Email protected] server]# yum-y installoracleasm-support-2.1.7-1.el5.i386.rpm

[Email protected] server]# yum-y installreadline-devel-5.1-3.el5.i386.rpm

[Email protected] server]# yum-y INSTALLUNIXODBC

[Email protected] server]# yum-y install make* gcc* glibc* compat-db* compat-gcc*compat-gcc* compat-libstdc++* compat-l ibstdc* openmotif* setarch*

[Email protected] server]# yum-y installelfutils-libelf-devel-* libaio-devel-0.3.106-5.i386.rpm sysstat-7.0.2-11.el5.i386.rpm unixodbc-devel-2.2.11-10.el5.i386.rpm

Install rlwrap-0.37.tar.gz, here I also upload up, this software can find on the Internet.

[[email protected] ~]# ls

Anaconda-ks.cfg Install.log rlwrap-0.37

Desktop Install.log.syslog rlwrap-0.37.tar.gz

[Email protected] ~]# tar-zxvfrlwrap-0.37.tar.gz

[Email protected] rlwrap-0.37]# pwd

/root/rlwrap-0.37

[Email protected] rlwrap-0.37]#./configure

[[email protected] rlwrap-0.37]# make

[[email protected] rlwrap-0.37]# make install

Method Two: Batch Installation

When the disc is mounted

[[email protected] mnt] #mkdir cdrom

[Email protected] mnt]# mount/dev/cdrom/mnt/cdrom/

Mount:block Device/dev/cdrom is write-protected, mounting read-only

[Email protected] mnt]# cd/etc/yum.repos.d/

[Email protected] yum.repos.d]# VI Public-yum-el5.repo

[Oel5]

Name = Enterprise Linux 5.7 DVD

baseurl=file:///mnt/cdrom/server/

Gpgcheck=0

Enabled=1

[email protected] yum.repos.d]# Yum installoracle-validated

If it's Oel5:yum install oracle-validated

If it's Oel6:yum install Oracle-rdbms-server-11gr2-preinstall

5. Modifying environment variables in Linux

To modify the. Bash_profile for Oracle, the example is as follows: Oracle_sid and so on plan ahead.

[Email protected] oracle]# pwd

/home/oracle

[email protected] oracle]# cat. Bash_profile

If [-f ~/.BASHRC]; Then

. ~/.bashrc

Fi

Path= $PATH: $HOME/bin

#after is the add by admin.

#

oracle_sid=bys001

Oracle_base=/u01/app/oracle

Oracle_home=/u01/app/oracle/product/11.2.0/dbhome_1

Path= $ORACLE _home/bin: $PATH:/user/sbin

Export Oracle_base Oracle_sid Oracle_homepath

Ld_library_path= $ORACLE _home/lib:/lib:/usr/lib:/usr/local/lib:/usr/x11r6/lib/

Exportclasspath= $ORACLE _home/jre: $ORACLE _home/jlib: $ORACLE _home/rdbms/jlib

Alias sqlplus= ' Rlwrap sqlplus '

Alias rman= ' Rlwrap Rman '

Using Oracle user authentication

[[email protected] ~]$ source. bash_profile

[Email protected] ~]$ Sqlplus

Rlwrap:cannot Execute sqlplus:no suchfile or directory

[[email protected] ~]$ Rman

Rlwrap:cannot execute rman:no such fileor directory

Note: Other kernel parameters, such as can not be modified, at the time of installation to check the system environment can be used by Oracle to modify the script, I use this method.

6. Upload and unzip Oracle database software

I'm using the SSH Secure Shell here. The file-transfer function in this software

Note to upload and unzip files with Oracle users to avoid file permissions issues.

[[email protected] u01]$ ls

App Linux_11gr2_database_2of2.zip

Linux_11gr2_database_1of2.zip

[Email protected] u01]$ du-sh/u01/linux*

1.2g/u01/linux_11gr2_database_1of2.zip

951m/u01/linux_11gr2_database_2of2.zip

[Email protected] u01]$ Unziplinux_11gr2_database_1of2.zip

[Email protected] u01]$ Unziplinux_11gr2_database_2of2.zip

Save disk space by deleting original compressed files after decompression

[Email protected] u01]$ Du-sh database/

2.3G database/

[Email protected] u01]$ RM-RF linux_11gr2_*

[[email protected] u01]$ ls

App Database

[Email protected] u01]$

To this, shut down and do a snapshot. Preparation is completed before installation.

7. Install using the Oui graphical interface

[[Email protected] ~]# Init 5

Installation of Oracle Software

Go to the graphical interface, log in with Oracle user, and open a command-line terminal window in the desktop context menu

[Email protected] ~]$ cd/u01/database/

[[email protected] database]$ ls

Doc Install response rpm Runinstaller Sshsetup stage welcome.html

[Email protected] database]$./runinstaller

Precautions for installation:

During the installation process, to see if the oracle_base/home is correct.

In the installation to check the installation environment, there will be some kernel parameter tuning, missing packages (if the package is missing, according to my instructions on the environment and software if all installed is not missing package) and other prompts.

Oracle can automatically fix the Yes parameter according to the fixable in the prompt box.

Select the Fix&check AGAIN above.

When you open a terminal, note that you want to use the root user. Depending on the dialog box prompt, open a terminal entry below:

[Email protected] ~]# sh/tmp/cvu_11.2.0.1.0_oracle/runfixup.sh

Response file being used is:/tmp/cvu_11.2.0.1.0_oracle/fixup.response

Enable file being used is:/tmp/cvu_11.2.0.1.0_oracle/fixup.enable

Log file Location:/tmp/cvu_11.2.0.1.0_oracle/orarun.log

Setting Kernel Parameters ...

Kernel.sem = 250 32000 100 128

Fs.file-max = 6815744

Net.ipv4.ip_local_port_range = 9000 65500

Net.core.rmem_default = 262144

Net.core.wmem_default = 262144

Net.core.rmem_max = 4194304

Net.core.wmem_max = 1048576

FS.AIO-MAX-NR = 1048576

uid=501 (Oracle) gid=1000 (oinstall) groups=1000 (Oinstall), 1031 (DBA), 1021 (ASMDBA)

[Email protected] ~]#

Then click the OK option in the dialog box.

Recheck now and find that these parameters are automatically fixed.

If there are no packages installed, then install and re-examine the environment.

At this time to check again, found that the swap size did not pass, this can be directly selected Ignore-all.

Then check the configuration correctly at the next step and click Next to install.

#######################################################

Install to boot NETCA error, cannot start, need to hit a patch

In fact, I hit a patch or not, after the installation is completed manually modified the following Listner.ora file

[INS-20802] Oracle Net Configurationassistant failed

Cause-the plug-in failed in its Performmethod

Solution:

A patch called P8670579_112010_linux.zip is required.

When this error occurs, do not close the Setup program first:

Upload and decompress files and actions using Oracle Users

Unzip P8670579_112010_linux.zip

CD 8670579

/u01/app/oracle/product/11.2.0/dbhome_1/opatch/opatchapply-invptrloc/u01/app/oracle/product/11.2.0/dbhome_1/ Orainst.loc

Where/apps/oracle/product/11.2.0/db_1/is Oracle_home, $oracle_home can be used instead

After the patch has been hit, click on the retry of the installer to continue the installation.

View patches installed in the system

[Email protected] 8670579]$/u01/app/oracle/opatch/opatch lsinventory

#########################################################

After the installation is complete, run the following two scripts as prompted.

[Email protected] server]# sh/u01/app/orainventory/orainstroot.sh

changing permissions of/u01/app/orainventory.

Adding read,write permissions for group.

Removing Read,write,execute permissions Forworld.

changing groupname Of/u01/app/orainventoryto Oinstall.

The execution of the script is complete.

[Email protected] server]# sh/u01/app/oracle/product/11.2.0/dbhome_1/root.sh

Running Oracle 11g root.sh script ...

The following environment variables is SETAs:

Oracle_owner= Oracle

Oracle_home=/u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bindirectory: [/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'll be added to the/etc/oratabfile as needed by

Database Configuration Assistant when Adatabase is created

Finished running generic part of Root.shscript.

Now product-specific root actions would beperformed.

Finished product-specific root actions.

8. Follow up the installation process

1. Firewall Open 1521 Port

[[email protected] ~]# iptables-i INPUT 1-p tcp--dport 1521-j ACCEPT

[Email protected] ~]#/etc/rc.d/init.d/iptablessave

Saving firewall rules to/etc/sysconfig/iptables: [OK]

[Email protected] ~]# Services iptables restart

-bash:services:command not found

[[Email protected] ~]# service Iptablesrestart

Flushing firewall rules: [OK]

Setting chains to Policy Accept:filter [OK]

Unloading iptables modules: [OK]

Applying iptables firewall rules: [OK]

Loading additional iptables Modules:ip_conntrack_netbios_ns

2. Configure the listener---such as the installation process has been normal configuration can not be done.

When the installation is complete, start listener

[[email protected] admin]$ lsnrctl start

The last two sentences of the output:

The listener supports no services

The command completed successfully

This causes the remote connection to be error-enabled:

Oracle Ora-12514:tns:listener does notcurrently know of service requested in Connect descriptor

Cause: The DB instance is not registered to listener

The following is added to the Listener.ora:--configured for static monitoring.

Sid_list_listener =

(Sid_list =

(Sid_desc =

(Global_dbname = ORCL)

(Sid_name = ORCL)

)

)

Note: The ORCL inside is based on the name of the database instance you installed, and I solved this error with this method.

Solution Two: This online look, I did not use, the use of the first to solve.

This should be to solve the problem of non-dynamic registration, to manually register the instance to listener

Log in to the database:

$sqlplus/as SYSDBA

Show Service Name:

Sql>show parameter Service_names

Mandatory Registration Service:

Sql>alter system Register;

To view the listening status:

$lsnrctl status

9. Configure the database to boot from

After the Oracle database is installed: Execute Dbstart and Dbshut prompts:

[Email protected] ~]$ Dbstart

Oracle_home_listner is not SET, unable toauto-start Oracle Net Listener

Usage:/u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart Oracle_home

The error is caused by a problem with the Oracle_home_listner settings in the Dbstart and Dbshut script files,

Open two files, respectively. Found: Oracle_home_listner=$1, (at the beginning of the file, more easy to find) modified to

oracle_home_listner= $ORACLE _home

After the modification save exits, the problem has been resolved;

Test:

1.SQLPLUS can start, if not, check. Bash_profile environment variable Oracle_home path etc, do it my way.

2. Using the Sqlplus login test

Sqlplus/as SYSDBA

You need to unlock the Scott user and configure the/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

[email protected] admin]$ cat Tnsnames.ora

# Tnsnames.ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

BYS001 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.212) (PORT = 1521))

(Connect_data =

(SERVER = dedicated)

(service_name = bys001)

)

)

Sqlplus Scott/[email protected]

Sqlplusscott/[email protected]:1521/bys001

3. Under normal circumstances the database instance does not start, at this time with SYS login, start the database, see if the database can start

4. Enable Oracle Auto-start monitoring and instance

The first step: Modify the/etc/oratab file with the following command:

The format is as follows:

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

SID:ORACLE_HOME:AUTO

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

[Email protected] ~]$ Vi/etc/oratab

Add or modify the phrase (the default appears to be N):

Bys001:/u01/app/oracle/product/11.2.0/dbhome_1/:y

[Email protected] ~]# Cat/etc/oratab

Bys001:/u01/app/oracle/product/11.2.0/dbhome_1:y

Step Two: Add Lsnrctl start and Dbstart to the rc.local file with the following command:

[Email protected] ~]$ vi/etc/rc.d/rc.local

Add the following content:

Su oracle-lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"

Su oracle-lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"

[Email protected] ~]# cat/etc/rc.d/rc.local

#!/bin/sh

#

# This script is executed *after* allthe other init scripts.

# can put your own initialization stuffin here if you don ' t

# want to does the full Sys V style initstuff.

Touch/var/lock/subsys/local

Su oracle-lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"

Su oracle-lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"

The third step, after restarting directly with Sqlplus login test database is open.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.