Install and configure Oracle in Linux

Source: Internet
Author: User
Tags stop script
1. Prepare the environment 1.1.linux RHAS4: RedHatEnterpriseLinuxAdvanceServer4.01.2. check the environment HardDiskSpace [ro

1. Environment preparation 1.1.linux system installation version RHAS4: RedHat Enterprise Linux Advance Server 4.0. Check the environment Hard Disk Space [ro

1. Prepare the 1.1.linux installation environment

Version

RHAS4: RedHat Enterprise Linux Advance Server 4.0

1. 2. Check the environment

Hard Disk Space

[Root @ localhost/] # df-h

(Target installation directory)> 2G + 1G (package source directory)

/Tmp> 400 M

Mem> 1G, swap> 1G

[Root @ localhost/] # cat/proc/meminfo | grep Total

Dependent Software Version

Query command with the lowest name VERSION

Kernel 2.6.9 # uname-a or uname-r

Glibc 2.3.2.95.27 # rpm-q glibc

Gcc 3.2 # rpm-q gcc

Make 3.79 # rpm-q make

Binutils 2.14 # rpm-q binutils

Libaio 0.3 # rpm-q libaio

Openmotif 2.2.2-16 # rpm-q openmotif

Setarch 1.3-1 # rpm-q setarch

1. 3. Check and configure Kernel Parameters

Check the current Parameter

/Sbin/sysctl-a | grep parameter name

Configure Kernel Parameters

1) Run [root @ localhost/] # vi/etc/sysctl. conf to add the following content:

Kernel. shmall = 2097152 # maximum number of pages with shared memory in the OS range. The unit is 4 K and the default value is 2097152.

Kernel. shmmax = 536870912 # maximum size of each shared memory segment in the OS range. Unit: Byte. The default value is 32 MB.

Kernel. shmmni = 4096 # maximum number of shared memory segments in the OS range. The default value is 4096.

Kernel. sem = 250 32000 100 128 # semaphore Parameters

Fs. file-max = 65536

Net. ipv4.ip _ local_port_range = 1024 65000

Net. core. rmem_default = 262144

Net. core. wmem_defaut = 262144

Net. core. rmem_max = 262144

Net. core. wmem_max = 262144

2) [root @ localhost/] #/sbin/sysctl-p

. Create an Oracle group and a user

Create user group oinstall, dba

User Group oinstall, dba

[Root @ localhost/] # groupadd oinstall

[Root @ localhost/] # groupadd dba

Create an oracle user

Create a user oracle and define the oinstamll and dba groups as the primary and secondary groups of oracle users.

[Root @ localhost/] # useradd-g oinstall-G dba oracle (set oracle users as members of the oinstall and dba user groups)

[Root @ localhost/] # passwd oracle (set the password of an oracle user)

Set shell limits (optional)

(We recommend that you set a limit on the number of processes that can be used and the number of opened files for each Linux Account)

1) Run [root @ localhost/] # vi/etc/security/limits. conf to add the following four lines

Oracle soft nofile 65536

Oracle hard nofile 65536

Oracle soft nproc 16384

Hard nproc 16384

2) modify the Security Restriction and run [root @ localhost/] # vi/etc/pam. d/login to add the following line:

Session required/lib/security/pam_limits.so

1. 5. Configure related directories

Create an Oracle installation directory and a directory for storing database files

[Root @ localhost/] # mkdir-p/oracle/product/10.2.0 (create a data directory)

[Root @ localhost/] # mkdir-p/oracle/oradata (create a data file directory)

[Root @ localhost/] # mkdir-p/oracle/flash_recovery_area (create a flashback directory)

[Root @ localhost/] # mkdir-p/oracle/arc_pstat (create an archive log directory)

[Root @ localhost/] # mkdir-p/home/oracle/install_temp (create a temporary directory for storing oracle installation files)

[Root @ localhost/] # chown-R oracle. oinstall/home/oracle/install_temp

[Root @ localhost/] # chown-R oracle. oinstall/oracle

[Root @ localhost/] # chmod-R 775/oracle (set the directory read and write permissions)

1. 6. Configure Environment Variables

Confirm ORACLE_SID

Make sure that oracle_sid = oracletest # The service names of the databases created after subsequent installation are consistent,

Log On As an oracle user, modify the. bash_profile file under the oracle user, restart or execute soure. bash_profile (. bash_profile) or re-log on to it to take effect.

[Oracle @ localhost ~] Add the following content to $ vi/home/oracle/. bash_profile:

Umask 022

ORACLE_BASE =/oracle; export ORACLE_BASE

ORACLE_HOME = $ ORACLE_BASE/product/10.2.0; export ORACLE_HOME

# Variables used for GUI Installation

ORACLE_TERM = xterm; export ORACLE_TERM

ORACLE_OWNER = oracle; export ORACLE_OWNER

PATH =/usr/sbin: $ PATH; export PATH

PATH = $ ORACLE_HOME/bin: $ PATH; export PATH

LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib; export LD_LIBRARY_PATH

TMP =/tmp; export TMP

TMPDIR = $ TMP; export TMPDIR

ORACLE_SID = oracletest

Export ORACLE_SID

View PATH source/home/oracle/. bash_profile after exiting

[Oracle @ localhost ~] $ Set | grep PATH

2. Prepare the Installation File of Oracle1.1.oracle

Version

Oracle10g01_10.2.0.1.0_database_linux32

File preparation

1)beioracle10g01_10.2.0.1.0_database_linux32.zip

To the/home/oracle/install_temp/directory

2) decompress:

Unzip oracle10g01_10.2.0.1.0_database_linux32.zip

1. 2. Installation

1.1 start

[Oracle @ localhost ~] $ Cd/home/oracle/install_temp/

[Oracle @ localhost ~] $ Cd database

[Oracle @ localhost ~] $./RunInstaller # Start installation and wait for a while

1.1 subsequent installation is basically the same as that on Windows (omitted)

The subsequent installation is basically the same as that on windows. After the installation is complete, the following figure is displayed: Switch the user to the root and execute the following two configuration scripts:

Run [root @ localhost/] #/oracle/oraInventory/orainRoot. sh

Run [root @ localhost/] #/oracle/product/10.2.0/root. sh as follows, and enter/oracle/product/10.2.0/bin/

3. Configure Oracle1.1. create a database oracletest

Run [oracle @ localhost ~] $ Dbca or graphic menu, pay attention to the following consistency (sys/oracletest)

1. 2. Configure the listener, TNS

[Oracle @ localhost ~] $ Netca or graphic menu

Finally, listener. ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = oracletest)

(ORACLE_HOME =/oracle/product/10.2.0 /)

(SID_NAME = oracletest)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

)

)

Tnsnames. ora

ORACLETEST =

(DESCRIPTION =

(ADDRESS_LIST =

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

)

(CONNECT_DATA =

(SERVICE_NAME = oracletest)

)

)

1.3.EM

[Oracle @ localhost ~] $ Emctl start | stop | status dbconsole

: 1158/em

1.4.isqlplus

[Oracle @ localhost ~] $ Isqlplusctl startstart | stop | status

: 5560/isqlplus

1. 5. Configure Automatic startup

Configure the database to be automatically started when the machine starts, and listen to and manage the EM platform.

The database is automatically stopped when it is stopped, and the monitoring and EM Management Platform

Modify the Oracle system configuration file/etc/oratab and set the AUTO domain from the default N to Y so that dbstart and dbshut of oracle can play a role.

[Root @ localhost/] # vi/etc/oratab

Create Startup Script

1) [oracle @ localhost ~] Vi $ ORACLE_HOME/bin/dbstart find 78th rows ORACLE_HOME_LISTNER =...

Changed to ORACLE_HOME_LISTNER = $ ORACLE_HOME,

[Oracle @ localhost ~] Cd $ ORACLE_HOME/bin/

Run [oracle @ localhost ~] manually ./Dbstart

[Oracle @ localhost ~] ./Dbshut

Test normal or not

(Log: $ ORACLE_HOME/startup. log and $ ORACLE_HOME/shutdown. log)

2) [root @ localhost/] # vi/etc/init. d/oracle10g

#! /Bin/sh

# Description: Oracle auto start-stop script.

# Chkconfig:-20 80

# Set ORA_HOME to be equivalent to the $ ORACLE_HOME

# From which you wish to execute dbstart and dbshut;

#

# Set ORA_OWNER to the user id of the owner of

# Oracle database in ORA_HOME.

ORA_HOME =/oracle/product/10.2.0/

ORA_OWNER = oracle

If [! -F $ ORA_HOME/bin/dbstart]

Then

Echo "Oracle startup: cannot start"

Exit

Fi

Case "$1" in

'Start ')

# Start the Oracle databases:

# The following command assumes that the oracle login

# Will not prompt the user for any values

Su-$ ORA_OWNER-c $ ORA_HOME/bin/dbstart

# Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl start"

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctl start dbconsole"

;;

'Stop ')

# Stop the Oracle databases:

# The following command assumes that the oracle login

# Will not prompt the user for any values

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctl stop dbconsole"

Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctl stop"

Su-$ ORA_OWNER-c $ ORA_HOME/bin/dbshut

;;

'Restart ')

$0 stop

$0 start

;;

Esac

3) [root @ localhost ~] # Chmod 750/etc/init. d/oracle10g

[Root @ localhost ~] # Ln-s/etc/init. d/oracle10g/etc/rc0.d/K10oracle10g

[Root @ localhost ~] # Ln-s/etc/init. d/oracle10g/etc/rc3.d/S99oracle10g

[Root @ localhost ~] # Chkconfig -- list oracle10g

[Root @ localhost ~] # Chkconfig -- level 345 oracle10g on

[Root @ localhost ~] # Chkconfig -- list oracle10g

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.