Linux Network Management note (28) how to install Oracle and command not found

Source: Internet
Author: User
Install Oracle 10 Gb in RedHat Linux

When installing redhat5, the disk should be allocated to swap independently. The size of the space should be the memory size * 2. It is best to use a machine with memory> 1 GB.

System check command:

# Grep memtotal/proc/meminfo-check the memory size

# Grep swaptotal/proc/meminfo-check swap partition size swap

# DF-k/tmp-Requirement:/tmp 400 mb

# Grep "model name"/proc/cpuinfo-CPU check

# Cat/etc/issue-operating system check

# Uname-r-system kernel check

Currently, the root Super User performs the following operations:
1. Because orcale10 does not support RedHat As5, You need to modify/etc/RedHat-Realtime

Change Hat Enterprise Linux Server Release 5 (tikanga) to Red Hat Enterprise

Linux Server Release 4 (tikanga). After installation, modify it back.

2. Modify the/etc/hosts file to change 127.0.0.1 to the local IP address. Otherwise, the network check will fail.

3. Check the required software package for installation. If a dependency error is prompted, install the required software package as prompted before continuing.

Setarch-2 *

Make-3 *
Glibc-2 *
Libaio-0 *
Compat-libstdc ++-33-3 *
Compat-gcc-34-3 *
Compat-gcc-34-c + +-3 *
Gcc-4 *
LibXp-1 *
Openmotif-2 *
Compat-db-4 *

4. Modify the/etc/sysctl. conf Kernel configuration file and add/modify the following items.

Kernel. Shmall = 2097152 # total available shared memory.
Kernel. shmmax = 2147483648 # maximum size of shared memory segments.
Kernel. shmmni = 4096 # maximum number of shared memory segments of the entire system.
Kernel. SEM = 250 32000 100 128 # maximum number of signal objects in each signal object set; Maximum number of signal objects in the system range; Maximum number of operations supported by each signal object; the maximum number of signal objects in the system range.
FS. File-max = 65536 # maximum number of file handles allowed in the system.
Net. ipv4.ip _ local_port_range = 1024 65000 # IPv4 port range available for applications.
Net. Core. rmem_default = 1048576 # default value of the socket receiving buffer size
Net. Core. rmem_max = 1048576 # maximum size of the socket receiving buffer
Net. Core. wmem_default = 262144 # default value of the socket sending buffer size
Net. Core. wmem_max = 262144 # maximum size of the socket sending Buffer

Run the following command to make the kernel parameters take effect:

/Sbin/sysctl-P

Note: The kernel parameters do not have to be modified. They can be modified based on your actual situation.

5. Add the following content to the/etc/security/limits. conf file:

Soft nproc 2047
Hard nproc 16384
Soft nofile 1024
Hard nofile 65536

6. Add the following content to the file/etc/PAM. d/login:

Session required/lib/security/pam_limits.so
Session required pam_limits.so

7. Because SELinux has an impact on Oracle, setting Secure Linux as invalid. edit the file/etc/SELinux/config:

SELinux = disabled

Of course, you can also use the tool (system> Management> Security Level and firewall) in the graphic interface. Select the SELinux page and set it to invalid.

8. Add groups and users:

Groupadd oinstall
Groupadd DBA
Useradd-m-g oinstall-g dba Oracle
Passwd Oracle self-SET Password

9. Create an Oracle installation directory and grant the permissions to oracle users:

Example:

Mkdir-P/u01/APP/Oracle/product/10.2.0/db_1
Chown-r oracle. oinstall/u01

10. Configure the environment variable (/etc/profile or. bash_profile) and add the following content:

# Oracle settings

Oracle_base =/u01/APP/Oracle; export oracle_base
ORACLE_HOME = $ oracle_base/product/10.2.0/db_1; export ORACLE_HOME
Oracle_sid = orcl; export oracle_sid
Path = $ path: $ ORACLE_HOME/bin; export path
Use the source/etc/profile or. bash_profile command to make the configuration take effect.

11. Set the installation Language

Login to oracle users

The installation of export lc_all = en_us is set to be installed in English due to garbled characters in Chinese.

12. Start Installation

Go to the Oracle installation directory and run./runinstaller

If the prompt is ...... /. If the Oui permission is insufficient, go to the install directory and execute

Chmod U + X. Oui

Chmod U + x unzip

Then run./runinstaller. The installation page will appear.

Select advanced installation during installation, select the Chinese character set for the database language, and select the simple Chinese 16gbk --- GBK serial set. GBK numbers cannot be identified in Linux. After query, Chinese characters are garbled.

When the installation is completed, a prompt is displayed, and two scripts must be executed as root.

13. After installation is complete

After the database is created, modify VI/etc/oratab and change the last n of the line orcl:/opt/Oracle/product/10g: n to y,

Add the following to/etc/rc. d/rc. Local: (Note: The quotation marks cannot be missing; otherwise, the system cannot start)
Su-Oracle-C "LSNRCTL start"
Su-Oracle-C "dbstart"

If an error occurs after installation, uninstall it and reinstall it. The uninstall command is as follows:

$./Runinstaller-silent-deinstall-removeallfiles-removeallpatches "remove_homes ={$ ORACLE_HOME}"-responsefile

Create auto-start service for Oracle in Linux

At the same time, Oracle is automatically started and added to my machine. The process is as follows:
1. Use the root user to modify the/etc/oratab file:
$ VI/etc/oratab

Orcl:/Oracle/APP/product/10.2.0/db_1: N

Changed:

Orcl:/Oracle/APP/product/10.2.0/db_1: Y

That is, change the last n to y.

2. Use the Oracle user to modify the $ ORACLE_HOME/bin/dbstart file:

# Su-Oracle

$ CD $ ORACLE_HOME/bin

$ VI dbstart

Locate oracle_home_listner =... and change it

Oracle_home_listner =/u01/APP/Oracle/product/10.1.0/db_1

Or directly modify it:

Oracle_home_listner = $ ORACLE_HOME

Iii. Test and run dbshut. Check whether dbstart can start the Oracle service and listener service:

1. modify the permissions of dbstart and dbshut log files:

$ Su-Root

# Cd $ ORACLE_HOME

# Chown ORACLE: oinstall startup. Log

# Chown ORACLE: oinstall shutdown. Log

Note: startup. log and shutdown. log may not exist. They are automatically created only after you run./dbstart and./dbshut.

2. Execute the corresponding script for testing

# Su-Oracle

$ CD $ ORACLE_HOME/bin

$./Dbstart (./dbshut)

$ PS-EFW | grep ora _

$ LSNRCTL status

$ PS-EFW | grep listen | grep-V grep

4. Create a service

$ Su-Root

# Cd/etc/rc. d/init. d/

# Vi oradbstart

Copy the following Script 1 or script 2 to the oradbstart file:

Note:

(1) # The number of rows to start cannot be small. Otherwise, the following chkconfig command will return an error: the oradbstart service does not support chkconfig.

(2) modify the environment variable configuration section based on your environment (in blue)

(3) copy the following script content saved under Windows to Linux through ISO, and then copy the script to the oradbstart file.

In the terminal, run the VI oradbstart command. Some lines may be followed by characters similar to ^ m and deleted. Otherwise

After the chkconfig command, the s99oradbstart file generated under the/etc/rc. d/rcN. d directory (N is run level) is empty.

Use VI to view the s99oradbstart file. The content should be the same as that in the/etc/rc. d/init. d/oradbstart file.

(The third case is that I use the Virtual Machine VMware to install Linux in XP, save the following script as a text file, and then create it as an ISO

File, and then copy the content of the file in ISO to oradbstart. In this case, some lines are followed by characters similar to ^ m,

It cannot be seen with gredit, and can only be seen with VI)

-- Script 1 (Database, listener, dbconsole, sqlplus)

#! /Bin/bash
# Chkconfig: 345 99 10
# Description: STARTUP script for Oracle databases
#/Etc/rc. d/init. d/dbstart
Export oracle_base =/u01/APP/Oracle/
Export ORACLE_HOME =/u01/APP/Oracle/product/10.2.0/db_1
Export oracle_sid = orcl
Export Path = $ path: $ ORACLE_HOME/bin
Ora_ownr = "oracle"
# If the executables do not exist -- Display Error
If [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi
# Depending on Parameter -- startup, shutdown, restart
# Of the instance and listener or usage display
Case "$1" in
Start)
# Oracle listener and instance startup
Echo-n "Starting ORACLE :"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/dbstart"
Touch/var/lock/Oracle
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/emctl start dbconsole"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/isqlplusctl start"
Echo "OK"
;;
Stop)
# Oracle listener and instance Shutdown
Echo-n "shutdown ORACLE :"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/emctl stop dbconsole"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/isqlplusctl stop"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/dbshut"
Su-$ ora_ownr-c "$ ORACLE_HOME/bin/LSNRCTL stop"
Rm-F/var/lock/Oracle
Echo "OK"
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo "Usage: 'basename $ 0' START | stop | restart | reload"
Exit 1
Esac
Exit 0

-- Script 2 (only start the database and listen)

#! /Bin/bash
# Chkconfig: 345 99 10
# Description: STARTUP script for Oracle databases
#/Etc/rc. d/init. d/oradbstart
Export oracle_base =/u01/APP/Oracle/
Export ORACLE_HOME =/u01/APP/Oracle/product/10.2.0/db_1
Export oracle_sid = orcl
Export Path = $ path: $ ORACLE_HOME/bin
Case "$1" in
Start)
Su Oracle-C $ ORACLE_HOME/bin/dbstart
Touch/var/lock/Oracle
Echo "OK"
;;
Stop)
Echo-n "shutdown ORACLE :"
Su Oracle-C $ ORACLE_HOME/bin/dbshut
Rm-F/var/lock/Oracle
Echo "OK"
;;
*)
Echo "Usage: 'basename $ 0' START | stop"
Exit 1
Esac
Exit 0

Save and exit.

Open the terminal and execute:

$ Su-Root

# Chown oracle. oinstall/etc/rc. d/init. d/oradbstart

# Chmod 775/etc/rc. d/init. d/oradbstart

Then execute:

Chkconfig -- add oradbstart

Chkconfig -- list oradbstart

Chkconfig -- list oradbstart running result:

Oradbstart 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Or run the following command:
Chkconfig -- level 345 oradbstart on

5. check:

Based on the above running results, when the corresponding running level is on (for example, 5: On), in the corresponding/etc/rc. d/rcN. D (for example: and

5: On corresponds to:/etc/rc. d/rc5.d) the following file will be generated: s99oradbstart, open with VI s99oradbstart

The content of this file is the same as that of/etc/rc. d/init. d/oradbstart, indicating that the configuration is successful.

S99oradbstart is a link to/etc/rc. d/init. d/oradbstart. We can use the file command to view it:

$ File/etc/rc. d/rc5.d/s99oradbstart

S99oradbstart: symbolic link to '../init. d/oradbstart

$ PS-Ef | grep Oracle check whether Oracle-related processes are started

6. One Note:

In the script file: # chkconfig: 345 99 10

It is pointed out that Level 3, 4, 5 starts this service, and 99 is in the corresponding/etc/rc. d/rcN. D (n is the level specified above, here is 345) directory.

The serial number (startup priority) of the generated link file s99oradbstart, 10 is corresponding

The serial number of the link file generated by the/etc/rc. d/rcN. D (N is a level other than 345) Directory (priority of service stop)

K10oradbstart.

Command description:
PS: monitor background processes
-E: displays all processes.
-F full format.
-H does not display the title.
-L long format.
-W width output.
Grep: A Command Used in Linux to search for the content contained in the output content.
For example, if you want to search for a string of characters "BBB" in aaa.txt, you can use
Cat aaa.txt | grep bbb
2. I want to search for files containing BB in the current directory. You can use
Ls | grep bb
Example: PS-EFW | grep listen | grep-V grep: View listeners with listen, except for those with grep.
Chkconfig: Function Description: Check and set various services of the system.
Syntax: chkconfig [-- add] [-- del] [-- list] [System Service] Or chkconfig [-- level <level code>] [System

Unified Service] [ON/OFF/Reset]

Note: This is a program developed by Red Hat following the GPL rules. It can be used to query the execution level of the operating system.

System services, including all types of resident services.

Parameters:

-- Add: adds the specified system service, enables the chkconfig command to manage it, and adds it to the description file started by the system.

Add relevant data.

-- DEL: deletes the specified system service. It is no longer managed by the chkconfig command and is also deleted in the description file started by the system.

Related data.

-- List lists the specified system services.

-- Level <level code> specifies the execution level of the read system service.

Note: runlevel can be regarded as the system status and image. You can think that runlevel is a bit like Microsoft's Windows operating system.

And command prompt only. To access each runlevel, you must start or close a series of servers.

Services. These services are stored in the directory/etc/rc. d/RC?. By using initialization scripts ?. D/or/etc/rc ?. D

Below (? Indicates the serial number of runlevel ).

In most Linux releases, there are usually eight runlevels

Runlevel system state
0 halt the system
1 single user mode
2 Basic Multi User Mode
3 Multi User Mode
5 Multi User Mode with GUI
6 reboot the system
S, s single user mode

In most Desktop Linux systems, the default runlevel is 5, and the GUI is used when users log on;

In most server versions, the default runlevel of Linux is 3, and the character interface is used for user login;

Runlevel 1 and 2 are rarely used except debugging;

Runlevel S and S are not directly used by users, but used to prepare for single user mode.

A solution to an error

The environment variable has been configured, but an error is still reported:

[Oracle @ DG1 ~] $ VI. 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

Export path
Unset Username

Export editor = vi
Export oracle_sid = DG1
Export oracle_base =/u01/APP/Oracle
Export ORACLE_HOME = $ oracle_base/product/10.2.0/db_1
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
Export Path =/u01/APP/Oracle/product/10.2.0/db_1/bin:/usr/sbin:/usr/local/bin: /usr/x11r6/bin
Export Path = $ ORACLE_HOME/bin: $ path
Umask 022

Solution:

[Oracle @ DG1 ~] $ Sqlplus/nolog
Bash: sqlplus: Command not found
[Oracle @ DG1 ~] $ Ln-S $ ORACLE_HOME/bin/sqlplus/usr/bin
LN: Creating symbolic link '/usr/bin/sqlplus' to '/bin/sqlplus': Permission Deni ed
[Oracle @ DG1 ~] $ Su-Root
Password:
[Root @ DG1 ~] # Ln-S $ ORACLE_HOME/bin/sqlplus/usr/bin
[Root @ DG1 ~] # Su-Oracle
[Oracle @ DG1 ~] $ Sqlplus/nolog

SQL * Plus: Release 10.2.0.1.0-production on Mon May 11 12:51:24 2009

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> Conn/As sysdba
Connected to an idle instance.
SQL> startup
Oracle instance started.

Total system global area 167772160 bytes
Fixed size 1218316 bytes
Variable Size 79694068 bytes
Database buffers 83886080 bytes
Redo buffers 2973696 bytes
Database mounted.
Database opened.
SQL>

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.