Next Previous Contents

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.


Next Previous Contents