Ellhniko Oracle Database HOWTO

Paul Haigh, paul@nailed.demon.co.uk v1.0, 10 Martioy 1998

Enas odhgos gia thn egkatastash kai ru8mish toy Oracle Database Server se ena susthma Linux

Contents

1 Eisagwgh 2 1.1 Istoria Ana8ewrhsewn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Pneymatika Dikaiwmata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 Skopos aytou toy HOWTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.5 Apaithseis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.6 Mellontikes Beltiwseis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Egkatastash toy logismikou ths Oracle 4

2.1 Proetoimasia toy Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.1 Dhmioyrgia enos xrhsth Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Egkatastash apo CDROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 Ergasies meta thn Egkatastash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3.1 Ergasies gia ton Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.2 Ergasies gia ton Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.3 Pragmata poy mporeite na apomakrunete: . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Dhmioyrgia mias Bashs Dedomenwn 6 3.1 Dhmioyrgia toy Arxeioy Arxikopoihshs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3.2 Dhmioyrghste to Script Egkatastashs Bashs Dedomenwn . . . . . . . . . . . . . . . . . . . . . 6 3.3 Ektelesh toy Script Egkatastashs Bashs Dedomenwn . . . . . . . . . . . . . . . . . . . . . . . 7 3.4 Ekkinhsh ths Bashs Dedomenwn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.5 Stamatwntas thn Bash Dedomenwn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6 Dhmioyrgia enos Proka8orismenoy Xrhsth (Default User) . . . . . . . . . . . . . . . . . . . . 8

4 Ry8miste to SQL*Net toy Server 9 4.1 tnsnames.ora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.2 listener.ora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3 sqlnet.ora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.4 Ekkinhsh kai Termatismos twn Listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5 Ry8miseis Pelath (Client) 12

5.1 Pelates Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.2 Pelates Unix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6 Aytomato Anebasma (Startup) kai Katebasma (Shutdown) 13 6.1 dbstart & dbstop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.2 init.d & rc.d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

7 Alla pragmatakia 15 7.1 Intelligent Agent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

8 Eyxaristies / Anagnwriseis 15

9 Peri ths Ellhnikhs Metafrashs 15

1 Eisagwgh

1.1 Istoria Ana8ewrhsewn

   • v0.1 - 21 Febroyarioy 1998 - Paul Haigh - Arxikh Ekdosh
   • v0.2 - 01 Martioy 1998 - Paul Haigh - Proste8hkan sxolia gia ta Proofreaders
   • v1.0 - 10 Martioy 1998 - Paul Haigh - Dhmosieysh toy sto LDP

1.2 Pneymatika Dikaiwmata

Oracle Database HOWTO copyright (c) 1998, Paul Haigh. Opws ola ta keimena Linux HOWTO, mporei na epanaparax8ei kai dianemh8ei oloklhro h meros toy, se ka8e meso, fysiko h hlektroniko, oso ayth h shmeiwsh peri pneymatikhs idiokthsias diathreitai se ola ta antigrafa. H emporikh anadianomh epitrepetai kai en8arrunetai. Parola ayta, o syggrafeas 8a h8ele na eidopoih8ei gia tetoies dianomes. Mporeite na metafrasete ayto to HOWTO se ka8e glwssa, me thn proupo8esh pws afhnete ayth th dhlwsh peri pneymatikhs idiokthsias akeraih kai pws 8a pros8esete mia shmeiwsh poy na dhlwnei ton metafrasth toy keimenoy.

1.3 Disclaimer

Enw prospa8hsa na symperilabw thn pio swsth kai prosfath plhroforia poy htan dia8esimh se mena, den mporw na eggyh8w pws h xrhsh twn plhroforiwn aytou toy keimenoy, den 8a katalhjei se apwleia dedomenwn h ejoplismou. DEN PAREXW KAMIA EGGYHSH gia tis plhrofories toy HOWTO kai den mporw na 8ewrh8w nomika ypeu8ynos gia o,ti synepeies aporreoyn apo thn xrhsh twn plhroforias se ayto to HOWTO.

1.4 Skopos aytou toy HOWTO

Se ayto to HOWTO 8a epixeirhsw na kalucw ta 8emata ths egkatastashs kai ths basikhs diaxeirishs mias Bashs Dedomenwn Oracle poy trexei se mia mhxanh Linux. Sygkekrimena, 8a kalucw thn egkatastash toy Oracle server, th ru8mish toy SQL*Net kai toy client.

Ayto to keimeno den apotelei ena eis ba8os egxeiridio ths xrhshs kai diaxeirishs mias B.D. Oracle, kai an ayto caxnete yparxoyn yperoxa biblia gia ayta ta 8emata poy exoyn ekdo8ei apo thn O’Reilly kai alloys.

Den prokeitai na kalucw thn anaptyjh programmatwn se Oracle katw apo UNIX. An ayto einai apolutws anagkaio gia esas, 8a sas proteina na agorasete to SCO Developement System ths SCO (me ton OpenServer 5.x), poy moy eipan pws mporei na apokth8ei sthn polu logikh timh twn US $19, apo thn www.sco.com.

1.5 Apaithseis

Ypo8etw pws exete kapoia stoixeia poy 8a xreiasteite gia na akoloy8hsete ayto to HOWTO.

• Oracle Server CD gia ton SCO Openserver (Version 7.3.3.0.0.) Prepei na einai mia nomimh kopia. Na 8ymaste pws h Oracle einai mia kerdoskopikh epixeirhsh kai xrewnei gia ta proionta ths. An 8elete mia dwrean SQL symbath bash dedomenwn xrhsimopoihste thn PostgresSQL h kapoia paromoia. Einai epishs dynaton na egkatasthsete thn oracle, xrhsimopoiwntas mia adeia dokimastikhs xrhshs / ajiologhshs 60 hmerwn, apo arxeio poy mporeite na katebasete apo to tar web site ths Oracle. Proswpika den to exw dokimasei kai einai plhrws anepikurwto.

• Ena Linux Server Den 8a to diabazate ayto, ean den eixate. Swsta;

• Pyrhna 2.0.30+ Den mporw na eggyh8w pws aytes oi odhgies 8a einai akribeis gia opoiondhpote allo pyrhna. (oxi oti eggywmai kai gia ton 2.0.30 ...).

• iBCS Einai polu shmantiko na to exete egkatasthsei kai na doyleuete me thn teleytaia dynath ekdosh toy gia thn platforma sas. (Xrhsimopoiw to iBCS-2.0-10.i386.rpm gia Redhat Linux).

• Megalo xwro sto disko 600 Mb+ einai ena logiko poso. Einai dynato na egkatasthsete kai me ligotero alla 8a xreiastei na kanete kapoies 8ysies, kai den moy aresei pote na arxizw etsi. Parola ayta, 8a prospa8hsw na ypodeijw ta shmeia ekeina sta opoia mporei na eley8erw8ei xwros.

• 32Mb+ Ram 3erw pws akougetai mallon polu, eidikotera gia ta metra toy Linux, alla na 8ymaste pws h Oracle einai ena sun8eto kommati logismikou. Den 8a eixate tis idies epifylajeis ean eixate SCO! Den isxyrizomai pws h Oracle den doyleuei me ligotero, apla lew pws ean einai ligotero apo oti h Oracle synista kai den 8a to proteina.

• adeies apo thn Oracle 3erw pws to exw hdh anaferei, alla 8elw na eimai jeka8aros pws ayto to 8ema einai shmantiko. Xrhsh logismikou ths Oracle xwris adeia einai paranomh.

1.6 Mellontikes Beltiwseis

Aytoi einai oi tomeis toy Oracle server poy den kaluptontai se ayto to HOWTO. Parola ayta, an o xronos to epitrecei, 8a epixeirhsw na toys balw se epomenes ekdoseis toy HOWTO.

• Anaptyjh programmatwn Oracle Pro* xrhsimopoiwntas biblio8hkes ths Oracle.

• Egkatastash diaforetikwn ekdosewn toy Oracle server.

• Egkatastash toy Oracle Web Server.

• Pws na kanete relink ton Pyrhna ths Oracle.

2 Egkatastash toy logismikou ths Oracle

2.1 Proetoimasia toy Server

2.1.1 Dhmioyrgia enos xrhsth Oracle

Opws einai logiko xreiazomaste enan xrhsth na krataei thn bash dedomenwn ths Oracle. Mia poy den epi8ymoume na kanoyme relink ton pyrhna ths Oracle (perissotera gia ayto argotera) 8a prepei na apodextoume tis proka8orismenes parametroys ths Oracle gia to onoma toy xrhsth kai to onoma toy group. Aytes symperilambanoyn ton xrhsth ORACLE kai to group DBA.

1. Synde8eite ws Root

2. Dhmioyrgeiste to xrhsth oracle kai to group dba.

          $ groupadd dba
          $ useradd  oracle

3. Bebaiw8eite pws ena home directory dhmioyrgeitai gia ton xrhsth oracle.

          $ mkdir /home/oracle
          $ mkdir /home/oracle/7.3.3.0.0 (Version of Oracle)
          $ chown -R oracle.dba /home/oracle

2.2 Egkatastash apo CDROM

Dystyxws o Oracle Installer apo to diskaki toy SCO den 8a doylecei. Mporei na antimetwpisete plh8wra problhmatwn, apo core dumps mexri kremasma. San apotelesma, xreiazetai na antigracoyme ta arxeia apo to CDROM xeirwnaktika kai na ta aposympiesoyme:

(Bebaiw8eite pws to CDROM einai prosarthmeno (mounted) sto susthma).

1. Synde8eite san Oracle

  2. Allajte directory se /home/oracle/7.3.3.0.0.

3. Antigracte ola ta arxeia egkatastashs apo to CDROM

          $ cp -a /mnt/cdrom/* .

4. Aposympieste ola ta arxeia ths Oracle apo to CDROM.

          $ find . -name *_-exec ~/7.3.3.0.0/orainst/oiuncomp {} \;

2.3 Ergasies meta thn Egkatastash

2.3.1 Ergasies gia ton Root

Pros8este tis epomenes grammes sto /etc/profile h sto .profile gia ka8e xrhsth poy prokeitai na xrhsimopoihsei thn Oracle.

     # Oracle Specific
     ORACLE_HOME=/home/oracle/7.3.3.0.0
     ORACLE_SID=orcl
     ORACLE_TERM=vt100
     export ORACLE_HOME ORACLE_SID ORACLE_TERM
     # Alter path for Oracle
     PATH="$PATH:$ORACLE_HOME/bin"

Epishs xreiazetai na allajoyme ton idiokthth kai ta pronomia xrhshs ths boh8htikhs efarmoghs ths Oracle ulimit increase.

     $ chown root.root $ORACLE_HOME/bin/osh
     $ chmod u+s $ORACLE_HOME/bin/osh

2.3.2 Ergasies gia ton Oracle

Allajte ta pronomia xrhshs twn arxeiwn ths Oracle gia na ejasfalisete thn swsth leitoyrgia.

     $ chmod +x $ORACLE_HOME/bin/*
     $ chmod u+s $ORACLE_HOME/bin/oracle

Ta ergaleia ths Oracle apaitoun ta mhnumata na kratountai sto directory$ORACLE HOME/tool name/mesg. Etsi, metakinhste ta arxeia msb apo ta directories msg ship sta directories mesg .

     $ mv $ORACLE_HOME/plsql/mesg/mesg_ship/* $ORACLE_HOME/plsql/mesg/.
     $ mv $ORACLE_HOME/rdbms/mesg/mesg_ship/* $ORACLE_HOME/rdbms/mesg/.
     $ mv $ORACLE_HOME/svrmgr/mesg/mesg_ship/* $ORACLE_HOME/svrmgr/mesg/.

Dhmioyrgeiste ta akoloy8a directories an den yparxoyn:

     $ mkdir $ORACLE_HOME/rdbms/log
     $ mkdir $ORACLE_HOME/rdbms/audit
     $ mkdir $ORACLE_HOME/network/log

2.3.3 Pragmata poy mporeite na apomakrunete:

Ta parakatw directories mporoun na apomakryn8oun me asfaleia:

   • $ORACLE HOME/guicommon2/
   • $ORACLE HOME/ctx/
   • $ORACLE HOME/md/
   • $ORACLE HOME/mlx/
   • $ORACLE HOME/precomp/
   • $ORACLE HOME/slax/

3. Dhmioyrgia mias Bashs Dedomenwn 6

3 Dhmioyrgia mias Bashs Dedomenwn

Twra, o Oracle server einai egkatesthmenos kai xreiazetai na dhmioyrghsoyme mia bash dedomenwn gia na elegjoyme thn egkatastash.

3.1 Dhmioyrgia toy Arxeioy Arxikopoihshs

Antigracte to arxeio $ORACLE HOME/dbs/init.ora sto $ORACLE HOME/dbs/initorcl.ora:
$ cd $ORACLE_HOME/dbs
$ cp init.ora initorcl.ora

Tropopoihste to, pros8etontas tis akoloy8es grammes:

db_name = orcl
COMPATIBLE=7.3.3.0.0

3.2 Dhmioyrghste to Script Egkatastashs Bashs Dedomenwn

Dhmioyrghste ena arxeio script poy na legetai makedb.sql sto $ORACLE HOME/dbs directory:

connect internal
startup nomount
set echo on
spool makedb.log
create database orcl
        maxinstances 1
        maxlogfiles  8
        datafile '$ORACLE_HOME/dbs/orcl_syst_01.dbf' size 40M reuse
        logfile
                '$ORACLE_HOME/dbs/orcl_redo_01.dbf' size 1M reuse,
                '$ORACLE_HOME/dbs/orcl_redo_02.dbf' size 1M reuse,
                '$ORACLE_HOME/dbs/orcl_redo_03.dbf' size 1M reuse;
@$ORACLE_HOME/rdbms/admin/catalog.sql
create tablespace rollback
        datafile '$ORACLE_HOME/dbs/orcl_roll_01.dbf' size 8.5M reuse;
create tablespace temporary
        datafile '$ORACLE_HOME/dbs/orcl_temp_01.dbf' size 5M reuse
        temporary;
create tablespace users
        datafile '$ORACLE_HOME/dbs/orcl_user_01.dbf' size 10M reuse;
create rollback segment r1 tablespace rollback
        storage ( optimal 5M );
alter rollback segment r1 online;
connect system/manager
@$ORACLE_HOME/rdbms/admin/catdbsyn.sql
connect internal
@$ORACLE_HOME/rdbms/admin/catproc.sql
connect system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql
spool off
exit

3.3 Ektelesh toy Script Egkatastashs Bashs Dedomenwn

Arxiste to svrmgrl kai trejte to script:

$ cd $ORACLE_HOME/dbs
$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> startup nomount
ORACLE instance started.
Total System Global Area       4313312 bytes
Fixed Size                       41876 bytes
Variable Size                  4140364 bytes
Database Buffers                122880 bytes
Redo Buffers                      8192 bytes
SVRMGR> @makedb
<polla mhnumata>
SVRMGR> exit
Server Manager complete.

3.4 Ekkinhsh ths Bashs Dedomenwn

Arxika, xreiazetai na shkwsoyme thn bash dedomenwn me to xeri (8a to aytomatopoihsoyme sth synexeia). Gia na arxisoyme mia bash dedomenwn Oracle xreiazetai na dwsoyme thn entolh startup afou synde8oume mazi ths eswterika:

$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> startup
ORACLE instance started.
Total System Global Area       4313316 bytes
Fixed Size                       41876 bytes
Variable Size                  4140368 bytes
Database Buffers                122880 bytes
Redo Buffers                      8192 bytes
Database mounted.
Database opened.
SVRMGR> exit

Server Manager complete.

3.5 Stamatwntas thn Bash Dedomenwn

Ajizei na anafer8ei pws h epanekkinhsh enos Linux server xwris prwta to katebasma (shutting down) ths bashs dedomenwn ths Oracle, exei ena megalo kindyno na diabrwsei (corrupt) th bash dedomenwn.

Etsi, prin dwsoyme thn entolh toy Linux shutdown,einai syneto na katebasoyme th bash dedomenwn:

$ svrmgrl
Oracle Server Manager Release 2.3.3.0.0 - Production
Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
Oracle7 Server Release 7.3.3.0.0 - Production Release
PL/SQL Release 2.3.3.0.0 - Production
SVRMGR> connect internal
Connected.
SVRMGR> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> exit
Server Manager complete.

3.6 Dhmioyrgia enos Proka8orismenoy Xrhsth (Default User)

H bash dedomenwn, opws dhmioyrgh8hke, exei dyo eidikous xrhstes poy dhmioyrgountai aytomata. Aytoi einai:

Username                Password
SYSTEM                  MANAGER
SYS                     change_on_install

Aytoi oi xrhstes typika xrhsimopoiountai gia na kratan tis plhrofories toy data dictionary information gia th bash dedomenwn. Einai kalh idea na allajoyme ta passwords apo ta proka8orismena oso pio grhgora ginetai.

Ayto mporei na kator8w8ei me:

sqlplus system/manager
SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
Copyright (c) Oracle Corporation 1979, 1996.  All rights reserved.

Connected to:
Oracle7 Server Release 7.3.3.0.0 - Production Release
SQL> alter user system identified by <newpassword>;
User altered.

     SQL> alter user sys identified by <newpassword>;
     User altered.
     SQL> exit;
     Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
     PL/SQL Release 2.3.3.0.0 - Production

Mia poy o xrhsths system/manager einai paromoios me to na xrhsimopoieis root se mia mhxanh UNIX, xreiazetai na dhmioyrghsoyme ena xrhsth me ligoteres dynatothtes na blacei to susthma. (8ymh8eite na shkwsete thn bash dedomenwn prin epixeirhsete na dhmioyrghsete ena xrhsth) Synde8eite sto SQL*Plus kai dhmioyrghste ena xrhsth:

     $ sqlplus system/manager
     SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
     Copyright (c) Oracle Corporation 1979, 1996.  All rights reserved.
     Connected to:
     Oracle7 Server Release 7.3.3.0.0 - Production Release
     PL/SQL Release 2.3.3.0.0 - Production
     SQL> create user <user> identified by <psw>
       2  default tablespace users
       3  temporary tablespace temp;
     User created.
     SQL> grant connect, resource to <user>
     Grant succeeded.
     SQL> exit
     Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
     PL/SQL Release 2.3.3.0.0 - Production

Twra poy exete ena neo xrhsth sto susthma, mporeite na paijete me to neo susthma. Gia na synde8eite me thn bash dedomenwn ths Oracle:

     $ sqlplus <user>/<password>

Ean ayto oloklhrwnetai xwris mhnumata la8oys exete mia bash Oracle poy doyleuei. An den 8elete na syndeeste sth bash ayth apo poy8ena plhn aytou toy Server, tote h doyleia teleiwse, apolauste thn! An, parola ayta, opws kai oi perissoteroi an8rwpoi 8elete na ry8misete to logismiko diktuwshs, wste na mporeite na syndeeste kai apo alles mhxanes, synexiste to diabasma.

4 Ry8miste to SQL*Net toy Server

Ola ayta ta arxeia ry8mizoyn to logismiko diktuwshs ths Oracle (SQL*Net, twra Net8 for Oracle8). Ayta ta arxeia 8a prepei na exoyn hdh dhmioyrgh8ei sto server sto $ORACLE HOME/network/admin directory.

4.1 tnsnames.ora

To arxeio TNSNAMES.ORA anagnwrizei tis dia8esimes yphresies ths mhxanhs. Sto stigmiotypo (instance) mas 8a perigracoyme oles tis baseis dedomenwn poy o server exei proskollhmenes. Gia ka8e ena stigmiotypo ths Bashs Dedomenwn (database instance) toy server sas, pros8este ena tmhma san to parakatw:

     orcl.world =
       (DESCRIPTION =
         (ADDRESS_LIST =
             (ADDRESS =
               (COMMUNITY = tcp.world)
               (PROTOCOL = TCP)
               (Host = <INSERT HOST NAME OF SERVER HERE> )
               (Port = 1521)
             )
             (ADDRESS =
               (COMMUNITY = tcp.world)
               (PROTOCOL = TCP)
               (Host = <INSERT HOST NAME OF SERVER HERE> )
               (Port = 1526)
             )
         )
         (CONNECT_DATA = (SID = ORCL)
         )
       )
4.2 listener.ora

To arxeio listener.ora periexei tis perigrafes twn yphresiwn mas poy alles mhxanes epitrepetai na synde8oun me aytes, ka8ws kai opoiadhpote ru8mish poy apaiteitai apo ton listener toy server.

Periexei tmhma gia to onoma kai th dieu8ynsh toy listener, tis baseis dedomenwn poy ejyphretountai apo ton listener, ka8ws kai parametroys ru8mishs.

Na ena paradeigma:

     # Name of listener and addresses to listen on
     LISTENER =
             ( ADDRESS_LIST =
                     (ADDRESS =
                             (PROTOCOL=tcp)
                             (HOST=<INSERT HOST>)
                             (PORT=1521)
                             (COMMUNITY=UK_SUP_TCPIP)
                     )
                     (ADDRESS =
                             (PROTOCOL=ipc)
                             (KEY=700)
                             (COMMUNITY=UK_SUP_TCPIP)
                     )
             )
     # List of services served by this listener
     SID_LIST_LISTENER=
             (SID_LIST=
                     (SID_DESC=

                             (SID_NAME=orcl)
                             (ORACLE_HOME=/home/oracle/7.3.3.0.0)
                     )
             )
     # Start of configuration parameters.
     TRACE_LEVEL_LISTENER=OFF
     TRACE_FILE_LISTENER = "listener"
     LOG_FILE_LISTENER = "listener"
     CONNECT_TIMEOUT_LISTENER = 10
     STOP_LISTENER = YES
     DBA_GROUP = dba
4.3 sqlnet.ora

To arxeio sqlnet.ora periexei ry8miseis gia enan sygkekrimeno kombo toy diktuoy. Ayto einai anejarthto toy ari8mou twn basewn h toy ari8mou twn listeners. To pio shmantiko pragma sto arxeio ayto einai h

metablhth ry8misewn Dead Connection Timeout.

H Dead connection timeout elegxei ka8e eiserxomenh diergasia (process) pros ena stigmiotypo mias bashs dedomenwn kai bebaiwnei pws to meros toy pelath (client) antapokrinetai akoma. An o pelaths (anejarthtws tupoy) den antapokrinetai tote h Oracle server shadow process skotwnetai (kill).

Ayto einai polu xrhsimo Ean exete pollous pelates poy kanoyn prosbash sth bash dedomenwn, eidika se fash anaptyjhs opoy aytoi oi pelates einai pi8ano na apotygxanoyn na bgoyn omala (exit cleanly) apo thn B.D. ths Oracle.

Parakatw einai ena antigrafo toy arxeioy moy sqlnet.ora gia na xrhsimopoihsete:

     TRACE_LEVEL_CLIENT = OFF
     sqlnet.expire_time = 30         # The number of seconds between client checks.
     names.default_domain = world
     name.default_zone = world

4.4 Ekkinhsh kai Termatismos twn Listeners

Twra poy oi ry8miseis twn listeners kai toy SQL*Net oloklhrw8hkan, mporoume na epixeirhsoyme na synde8oume sth bash, xrhsimopoiwntas to logismiko diktuwshs. (Prin, syndeomastan me apey8eias sundesh sth bash, enw edw prosomoiwnoyme mia sundesh apo mia apomakrysmenh mhxanh pelath)

Gia na arxisoyme ton listener me tis parapanw ry8miseis:

     $ lsnrctl
     LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:38:25
     Copyright (c) Oracle Corporation 1994.  All rights reserved.
     Welcome to LSNRCTL, type "help" for information.
     LSNRCTL> start
     Starting /home/oracle/7.3.3.0.0/bin/tnslsnr: please wait...
     TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
     System parameter file is /home/oracle/7.3.3.0.0/network/admin/listener.ora
     Log messages written to /home/oracle/7.3.3.0.0/network/log/listener.log

     Listening on: (ADDRESS=(PROTOCOL=tcp)(DEV=6)(HOST=192.168.1.1)(PORT=1521))
     Listening on: (ADDRESS=(PROTOCOL=ipc)(DEV=10)(KEY=700))
     Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
     STATUS of the LISTENER
     ------------------------
     Alias                     LISTENER
     Version                   TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
     Start Date                23-FEB-98 20:38:50
     Uptime                    0 days 0 hr. 0 min. 0 sec
     Trace Level               off
     Security                  OFF
     SNMP                      ON
     Listener Parameter File   /home/oracle/7.3.3.0.0/network/admin/listener.ora
     Listener Log File         /home/oracle/7.3.3.0.0/network/log/listener.log
     Services Summary...
       orcl          has 1 service handler(s)
     The command completed successfully
     LSNRCTL> exit

Gia na termatisoyme toys listeners:

     $ lsnrctl
     LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:43:20
     Copyright (c) Oracle Corporation 1994.  All rights reserved.
     Welcome to LSNRCTL, type "help" for information.
     LSNRCTL> stop
     Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
     The command completed successfully
     LSNRCTL> exit

An exete mia sthsei ena DNS poy den epistrefei th dieu8ynsh IP gia to hostname poy dhlwsate, h enarjh kai o termatismos toy listener mporei na parei kapoia wra (2-3 lepta. ejartwmeno apo thn timh metablhths toy xronoy lhjhs toy DNS). An ayto symbainei, mhn anhsyxeite, exete ypomonh.

5 Ry8miseis Pelath (Client)

5.1 Pelates Windows

H ru8mish toy SQL*Net se PC xrhsimopoiwntas tis nees ekdoseis toy logismikou Oracle Client einai polu eukolh. O kaluteros (kai eykoloteros) tropos na epiteyx8ei mia plhrws leitoyrgikh egkatastash enos pelath, einai na xrhsimopoih8ei to ergaleio SQL*Net Easy Configuration poy parexetai apo thn Oracle.

To ergaleio ayto exei ena interface aytomatopoihmenoy programmatos (wizard) gia na sas perasei apo thn egkatastash twn arxeiwn tnsnames.ora kai sqlnet.ora.

Dialejte ”Add Database Alias” kai balte ena onoma gia to ceydwnymo (alias) ths bashs otan erwth8eite when prompted. Ayto to ceydwnymo einai to onoma me to opoio 8a anafereste sto stigmiotypo ths bashs, kai san tetoio 8a prepei na einai idio me to onoma toy stigmiotypoy (orcl sthn periptwsh mas).

Dwste to TCP/IP ws prwtokollo, kai otan erwth8eite, dwste to hostname ths mhxanhs poy filojenei th B.D. kai to onoma toy stigmiotypoy ths bashs dedomenwn.

Ayto htan.

Parola ayta, an den exete to ergaleio SQL*Net Easy Configuration mhn anhsyxeite. Mporeite apla na

dhmioyrghsete ta arxeia tnsnames.ora kai sqlnet.ora files sto $ORACLE HOME/network/admin directory

toy pelath, akribws opws einai sto server. Ayto 8a sas parexei ena ceydwnymo idio me to onoma ston server (poy etsi kai alliws apotelei panta mia kalh taktikh).

5.2 Pelates Unix

Oi pelates UNIX den einai polu diaforetikoi apo toys pelates windows. An exete to Network Manager ths Oracle tote xrhsimopoihste to me ton idio tropo opws parapanw. An oxi, pali mporeite na xrhsimopoihsete apla ta idia arxeia ry8misewn toy server sto $ORACLE HOME/network/admin directory.

6 Aytomato Anebasma (Startup) kai Katebasma (Shutdown)

6.1 dbstart & dbstop

To aytomato anebasma (Startup) kai katebasma (Shutdown) ths bashs dedomenwn Oracle mporei na epiteyx8ei (sthn 7.3.3.0.0) me ta arxeia dbstart kaidbshut, poy kai ta dyo parexontai apo thn Oracle. Ayta ta arxeia basizontai sthn uparjh toy arxeioy /etc/oratab gia na doylecoyn (an kai allazontas ta arxeia dbshut kai dbstart ayto mporei na metafer8ei).

To format toy arxeioy /etc/oratab einai ws akolou8ws:

     SID:ORACLE_HOME:AUTO

Ena paradeigma:

     orcl:/home/oracle/7.3.3.0.0:Y
     leaveup:/home/oracle/7.3.2.1.0:N
6.2 init.d & rc.d

Gia na ekkinhsete kai stamathsete th bash dedomenwn otan to mhxanhma anebainei kai katebainei mporeite na allajete tis roytines ekkinhshs ths Linux mhxanhs sas. Einai arketa eukolo, an kai 8a h8ela na shmeiwsw edw, pws mporei na diaferei analoga me thn ekdosh Linux (slackware, debian, redhat, etc). 8a deijw paradeigmata poy doyleuoyn gia to Redhat Linux 5.0. Gia na ta tropopoihsete analoga, gia th dikia sas ekdosh toy Linux, diabaste thn tekmhriwsh toy Linux sas. (Parolo poy 8a prepei na stekei gia ka8e UNIX tupoy Sys V).

Prwta, xreiazetai na dhmioyrghsoyme to script poy 8a trexei tis dbshut kai dbstart sto directory

/etc/rc.d/init.d. Dhmioyrghste to akoloy8o arxeio ws /etc/rc.d/init.d/oracle:
     #!/bin/sh
     #
     # /etc/rc.d/init.d/oracle
     # Description: Starts and stops the Oracle database and listeners
     # See how we were called.
     case "$1" in
       start)
             echo -n "Starting Oracle Databases: "
             echo "----------------------------------------------------" >> /var/log/oracle
             date +"! %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle
             echo "----------------------------------------------------" >> /var/log/oracle

6. Aytomato Anebasma (Startup) kai Katebasma (Shutdown) 14

su - oracle -c dbstart >> /var/log/oracle
echo "Done."
echo -n "Starting Oracle Listeners: "
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo -n "Shutting Down Oracle Listeners: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Shutting Down Oracle Databases as part of system down." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c "lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su - oracle -c dbshut >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
;;
restart)
echo -n "Restarting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Restarting Oracle Databases as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c dbstop >> /var/log/oracle
su - oracle -c dbstart >> /var/log/oracle
echo "Done."
echo -n "Restarting Oracle Listeners: "
su - oracle -c "lsnrctl stop" >> /var/log/oracle
su - oracle -c "lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
esac

Ajizei na elegx8ei pws to arxeio stamataei kai arxizei th bash pragmatika swsta, sto susthma sas. Koitajte to arxeio mhnymatwn (log file), /var/log/oracle gia mhnumata la8oys.

Afou to script ayto doyleuei, xreiazetai na dhmioyrghsoyme symbolikes enwseis (symbolic links) start kai kill sta antistoixa runlevel directories /etc/rc.d/rcX.d.

Oi epomenes entoles 8a ejasfalisoyn pws oi baseis dedomenwn 8a aneboyn sta runlevels 2,3 and 4:

     $ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle
     $ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle
     $ ln -s ../init.d/oracle /etc/rc.d/rc4.d/S99oracle

Gia na stamathsete tis baseis dedomenwn se epanekkinhsh 8a xreiastoume ta akoloy8a links:

     $ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle          # Halting
     $ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle          # Rebooting

7 Alla pragmatakia

7.1 Intelligent Agent

An exete anagkh gia ton Oracle Intelligent Agent, brhka pws mporeite na ton trejete xwris allages ry8misewn. Gia na arxisete ton IA dokimaste:

     $ lsnrctl dbsnmp_start

Gia na stamathsete ton IA dokimaste:

     $ lsnrctl dbsnmp_stop

Den fainetai na yparxoyn mhnumata poy na deixnoyn thn epityxhmenh h mh arxh h termatismo toy intelligent agent. Parola ayta, o IA apanthse ston Enterprise manager sthn pleyra toy client kai etsi mporw na ypo8esw pws doyleuei

8 Eyxaristies / Anagnwriseis

To keimeno basisthke se ena keimeno toy Bob Withers, bwit@pobox.com. Epipleon plhrofories par8hkan apo keimena poy grafthkan apo toys Georg Rehfeld, rehfeld@wmd.de kai David Mansfield,

david@claremont.com.

Diabasma kai elegxos toy keimenoy egine apo toys Bob Withers, Mark Watling,

mwatling@mjw-ltd.demon.co.uk, Peter Sodhi, petersodhi@unn.unisys.com kai Greg Hankins,
greg.hankins@cc.gatech.edu.

Oi eyxaristies moy sthn tromerh yposthrijh apo toys an8rwpoy poy anamix8hkan se ayto to keimeno kai sthn ereyna poy egine se ayto Eidikes eyxaristies ston Bob Withers kai ton Mark Watling gia ta epipleon sxolia kai boh8eia poy proseferan.

9 Peri ths Ellhnikhs Metafrashs

Gia sxolia, parathrhseis, dior8wseis, enhmerwseis peri ths Ellhnikhs metafrashs aytou toy HOWTO, steilte email sthn Boula Sanida : voulariba@hellug.gr h ston Eyripidh Papakwsta : evris@hellug.gr kai enal-

laktika : ep@rocketmail.com