Oracle서버를 설치한 지금부터 설치를 시험할 데이터베이스를 설치할 필요가 있다. 만약 Oracle 7.2.x나 이전 버전을 사용한다면, 아래부분에 있는 문제해결지침을 읽기바란다.
$ORACLE_HOME/dbs/init.ora를 $ORACLE_HOME/dbs/initorcl.ora로 복사한다.
$ cd $ORACLE_HOME/dbs
$ cp init.ora initorcl.ora
db_name = orcl
COMPATIBLE=7.3.3.0.0
$ORACLE_HOME/dbs디렉토리에 makedb.sql의 이름으로 파일을 생성한다.
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 temp
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
svrmgrl명령을 수행한 후 스크립트를 실행한다.
$ 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
<loads of messages>
SVRMGR> exit
Server Manager complete.
우선은 수동으로(이후에는 자동으로 구동될 것이다.)데이터베이스를 구동시킬필요가 있다. Oracle 데이터베이스를 시작하기위해서는 "connect internal"을 한후에 "startup"이라는 command를 실행해야 한다.
$ 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.
Oracle데이터베이스를 중지시키기않고 Linux서버를 재실행시키는 것은 데이터베이스를 파괴시킬 수 있는 큰 위험이 있다는 것을 명심해야 한다. 그러므로,Linux shutdown명령을 사용하기전에 데이터베이스를 중지시키는 것이 바람직한것이다.
$ 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.
데이터베이스가 생성되면서 자동적으로 두 개의 특별한 사용자계정이 생성된다. 다음에 그 부분을 명시한다.
Username Password
SYSTEM MANAGER
SYS change_on_install
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
$ 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
$ sqlplus <user>/<password>