Installing Oracle9i on Redhat Linux

xiaoxiao2021-03-06  39

. IntroductionThis version of Oracle is easier to install than many of the previous ones However there are still some traps and issues to get around if you just need a database with transaction support, get Postgresql (www.postgresql.org) -. It is very Easy to install.

! Before You Get OracleThis release recommends 512 Mb of RAM, 1 GB of swap and 3 GB of disk You can get away with 320 MB, 750 Mb and 2.5 Gb respectively - provided you do not attempt to create a database at install time (wait Until Later!)

Do not attempt to install at all if you have less than 200 Mb of RAM as the installer will crash at link time! (If you are an Oracle install pro then you can link manually to complete the process, but its a bit of a pest ).

This Release Requires A 2.4.4 Kernel and Glibc 2.2.2. However You can install with 2.4.2 (Redhat 7.1) OR 2.4.3 (Mandrake 8.0) Kernels.

There is an undocumented dependency on Binutils. The version that comes with Redhat 7.1 causes Oracle to be unlinkable. The solution is to use the version that comes with Redhat 7.0 (binutils-2.10.0.18) or Mandrake 8.0 (binutils-2.10.1.0. 2).

The Tested Combinations WERE:

Redhat 7.0 with binutils-2.10.0.18 mandrake 8.0 with binutils-2.10.1.0.2.

Getting oraclevisit www.racle.com and click on "Oracle Technology Network". The Current Url for Downloads IS

Here. SELECT "9i Database" and the pick the "linux" entry. You must the agree to the license before the actual download page Appears.

There Are Three Big Files:

Linux9i_Disk1.cpio.gz (400Mb) Linux9i_Disk2.cpio.gz (620 Mb) Linux9i_Disk3.cpio.gz (80 Mb) They are actually cpio archives (not gzipped cpio archives!). You need fast internet access ... or a friend WITH FAST Internet Access.

Once Downloaded THEN Expand The Archives Somewhere Where You Have 2 GB of Space:

# Cd / var / bigspace

# Cpio -idmv linux9i_disk1.cpio.gz

# Cpio -idmv linux9i_disk2.cpio.gz

# Cpio -idmv linux9i_disk3.cpio.gzthese expanded archives can be burned to Three CDS to Provide a Convenient and Professional Looking Installation.

PreparationDecide Where You Want Oracle To Be Installed and Create A Directory for IT (i Use / usr / Oracle / [Version] But ITS Up to you):

# GroupAdd DBA

# UserAdd Oracle

# MKDIR / USR / ORACLE

# MKDIR /USR/OrCle/9.0

# Chown -r oracle: DBA / USR / ORACleMeMber You NEED 3 GB OR SO!

In Additional I Usually Create The File / etc / ORATAB USED to Record Databases:

# Touch / etc / oracab

# Chown oracle:. Dba / etc / oratabThere is some folklore about setting a plethora of environment variables and a thing called "Optimal Flexible Architecture" This business is best summed up by saying: The procedure is neither optimal, flexible nor an architecture .. ...................

Ensure That You have installed x on your machine, as there is no longer a character mode installer.

Oracle, Like Most Databases, Needs to Use IPC to create Shared Memory. Typically The Default Amount Configured on Most Linux Distributions Is Minimal. To Sort this Out: (as root here)

# sysctl -w kernel.shmmax = 100000000

# echo "kernel.shmmax = 100000000" >> /etc/sysctl.confthis enables a shared memory segment to be 100 MB (probably enough to start you off ...)

InstallationLogin As Oracle and Proceed To Install:

$ CD / VAR / BIGSPACE

$ CD Disk1

$ Export oracle_home = / usr / oracle / 9.0

$ ./RunInstallerThe Java Gui installer will start and guide you through the process.This part is now fairly easy - just pick "9i Database", then either of "Enterprise" or "Standard Edition" depending whether you want all the fancy bits or NOT (Bitmap Indexes, Partitions, Transportable TableSpaces etc Require Enterprise Edition).

The Next Step asks about what database you want, i usually say "Software Only" and do the database later.

You Will Be Asked Where JDK IS ... IF you don't have a JDK It Don't do Matter (UnsS you wish to do java development of course).

Then Click on Install and Wait for a while.

At some point you will be asked about the "other locations" for the remaining software archives .. its fairly straightforward what to be there (if you have cut CDs, ensure your terminal window is not still cd'ed into the cdrom mount directory. ..)

Post InstallationNow Comes Creating A Database. There IS A REASONABLE GUI TOOL for this:

$ export path = $ PATH: $ oracle_home / bin

$ export ld_library_path = $ ld_library_path: $ Oracle_Home / LIB

$ DBCA & Additionally There IS A NetWork Configuration Tool with a Similar UI:

$ NETCA & HOWEVER I WILL DETAIL A Command Line Creation and Configuration of a Database So That Some Undering of What Is Happensening Can Be Gained:

Set Up Configuration for A Database Called DB1:

$ cat "db1: /usr/racle/9.0: y >> / etc / oracab"

$ CD $ ORACLE_HOME / DBS

$ catinitdw.ora | SED S / "# db_name = my_db_name" / "db_name = db1" / | sed s / # control_files / control_files /> initdb1.oralAstart and create database:

$ export path = $ PATH: $ oracle_home / bin

$ export ld_library_path = $ ld_library_path: $ ORACLE_HOME / LIB $ EXPORT ORACLE_SID = DB1

$ SQLPLUS / NOLOG <

Connect / as sysdba

Startup Nomount

CREATE DATABASE DB1;

! This Creates A Default Database with Files in $ Oracle_Home / DBS

Now add the database meta data to actually make it it usful:

$ SQLPLUS / NOLOG <

Connect / as sysdba

@? / rdbms / admin / catalog

@? / rdbms / admin / catproc

! NOW CREATE A User and Give It Wide Ranging Permissions:

$ SQLPLUS / NOLOG <

Connect / as sysdba

Create User myuser identified by password;

Grant Create Session, Create Any Table To Myuser;

Grant Unlimited TableSpace to myuser;

! NOW The Usual Sort of Database Stuff Can Be Done:

$ SQLPLUS MyUser / Password <

Create Table MyTable (ID Integer, Val Varchar2 (100));

INSERT INTO MyTables Values ​​(1, 'XXXXX');

Select * from mytable;

! You Can Shut Down The Database with:

$ SQLPLUS / NOLOG <

Connect / as sysdba

Shutdown

And Start It Again with:

$ SQLPLUS / NOLOG <

Connect / as sysdba

Startup

! Simple Command Line Versions of these Are Provided:

$ dbshut

$ DbstartThe thing that is unusual about Oracle is that there is a one to one correspondence between database server (ORACLE_SID) and database (db_name in init $ ORACLE_SID.ora) - ie:. One server manages one and only one database Compare this to Mysql or Postgresql where one server manages many databases. If you want another database, then you must go through the above steps again with ORACLE_SID set differently and a new initialization file with a new db_name in it.

Networkingit is nice if remote clients can see your database: So Here is The Story:

$ echo "listener = (address_list = (pecol = tcp) (host = localhost) (address = (Protocol = IPC))"> $ oracle_home / network / admin /Listener.ora! LNSRCTL START

$ Echo "DB1 = (deScription = (address_list = (pecol = TCP) (host = )))) (" service_name = db1))) "> $ oracle_home / network /Admin/tnsnames.orathese Two Commands Tell The Network Listener WHERE to SEND Connection Requests to. THIS Can Be Tested By:

$ TNSPING DB1 1THIS SHOULD RETURN (OK) [Number]

Housekeepingit Is Easy to make Oracle Start Automatic or. Create a script called oracle in /etc/init.d That Is Like: (you need to be root here)

#! / bin / sh

#

# Oracle this shell script takes Care of Starting and Stopping

# The Oracle Services.

#

# chkconfig: 345 90 10

# Description: Oracle Server

#

# probe: True

# Source Function Library.

. /etc/rc.d/init.d/functions

# Source NetWorking Configuration.

IF [! -f / etc / sysconfig / network]; then

EXIT 0

Fi

# Check for echo -n vs ECHO / C

IF Echo '/ C' | GREP -S C> / Dev / Null 2> & 1; THEN

Echo_n = "echo -n"

Echo_c = ""

Else

Echo_n = "echo"

Echo_c = '/ c'

Fi

# See how wee wee caled.

Case "$ 1" in

START)

# Start Server.

$ Echo_n "Starting Oracle:" $ echo_c

Su -l oracle -c sqlplus / nolog> / dev / null <

Connect / as sysdba

Startup

!

Su -l oracle -c "lsnrctl start> / dev / null"

;

STOP)

# Stop server.

$ Echo_n "stopping oracle:" $ echo_c

Su -l oracle -c sqlplus / nolog> / dev / null <

Shutdown Abort

!

Su -l oracle -c "lsnrctl stop> / dev / null"

;

*)

Echo $ "Usage: $ 0 {start | stop}"

EXIT 1

;

ESAC

EXIT 0THEN Tell The System To Run IT: (as root again)

# Chkconfig --Add Oracleit is nice to set up the oracle .bash_profile to get oracle_sid and path working by default:

# .BASH_PROFILE

# Get the aliases and functions

IF [-f ~ / .bashrc]; then

. ~ / .bashrc

Fi

Export Bash_ENV = $ HOME / .BASHRC

Export Oracarv_ask = NO

Export Oracle_sid = DB1

IF [-f / usr / local / bin / oraenv]; then

. / usr / local / bin / oraenv

Fi

ORAENV_ASK = YES

Export ld_library_path = $ ld_library_path: $ ORACLE_HOME / LIBFINALLY A More Sophistated Script To Create A Database In / Var / ORADATA (for Example): (AS ORACLE)

#! / bin / bash

# ------------------------------------------------- ----------------------------

# File: createdb1.sql

# ------------------------------------------------- ----------------------------

DB = DB1

Dbpath = / var / oradata

Oracle_sid = $ db

mkinit ()

{

Export oracle_sid = $ db

Export Oracarv_ask = NO

. / usr / local / bin / oraenv

CP init $ db.ora $ oracle_home / dbs

}

MKDB ()

{

SQLPLUS / NOLOG <

Connect / as sysdba

Startup Nomount

Create Database $ DB

DataFile '$ dbpath / $ db / sys.dat' size 200m

AutoExtend ON

Next 10m

Logfile Group 1 '$ dbpath / $ db / log01.dat' size 50m,

Group 2 '$ dbpath / $ db / log02.dat' size 50m

;

!

}

SCDB ()

{

SQLPLUS / NOLOG <

Connect / as sysdba

@? / rdbms / admin / catalog

@? / rdbms / admin / catproc

!

}

Mktb ()

{

SQLPLUS / NOLOG <

Connect / as sysdba

Create TableSpace Rollback

DataFile '$ dbpath / $ db / rollback.dat' size 100mautoextend ON

Next 100M

Default Storage (Initial 10M Next 10m Pctincrease 0)

;

Create TableSpace Temp

DataFile '$ dbpath / $ db / temp.dat' size 100m

AutoExtend ON

Next 100M

Default Storage (Initial 10M Next 10m Pctincrease 0)

Temporary

;

Create TableSpace Data

DataFile '$ dbpath / $ db / data.dat' size 200m

AutoExtend ON

Next 100M

Extent Management Local

Segment Space Management Auto

;

!

}

Mkoj ()

{

SQLPLUS / NOLOG <

Connect / as sysdba

Create rollback segment t0;

Alter rollback segment t0 online;

SET Transaction Use Rollback Segment T0;

Create Rollback Segment R0 TableSpace Rollback;

Create Rollback Segment R1 TableSpace Rollback;

Alter rollback segment t0 offline;

Drop rollback segment t0;

!

Echo "ROLLBACK_SEGMENTS = (R0, R1)" >> $ oracle_home / dbs / init $ db.ora

}

Resp = N

echo -n "create initial files?"

Read Resp

Case $ RESP IN

y) Echo "Creating Initialization Files"

Mkinit

;

ESAC

Resp = N

echo -n "create database?"

Read Resp

Case $ RESP IN

y) Echo "CREATING $ DB"

MKDB

;

ESAC

Resp = N

echo -n "Run Database Scripts?"

Read Resp

Case $ RESP IN

Y) Echo "Running Scripts for $ db"

SCDB

;

ESAC

Resp = N

echo -n "crete TableSpaces?"

Read Resp

Case $ RESP IN

y) Echo "CREANG TABLESPACES for $ db"

Mktb

;

ESAC

Resp = N

echo -n "crete objects?"

Read Resp

Case $ RESP IN

y) Echo "CREANG SOME Objects for $ db"

mkoj

;

ESAC

转载请注明原文地址:https://www.9cbs.com/read-54498.html

New Post(0)