Sie sind auf Seite 1von 3

Database Creation

Database creation prepares many operating system files so that they work together as an
oracle database. A database needs to be created once, regardless of how many datafiles it has or how
many instances access it.
Prerequistites for creating a database :
Sufficient primary memory should be available to start the oracle instance.
Sufficient disk space must be available on the computer.
Steps to create a database :
$ vi .bash_profile
export ORACLE_SID= IFOCUS (or any name)
export ORACLE_HOME=/oraeng/app/oracle/product/10.2.0
export PATH=$ORACLE_HOME/bin:$PATH:.
:wq
(save & exit)
$ . .bash_profile
(run .bash_profile )
Create initialization parameter file by copying from the sample init.ora to init<oracle_sid>.ora. The
name of the file can be anything but the name has to be specified explicitly at the time of database
startup.
$ cd $ORACLE_HOME/dbs
$ cp init.ora initIFOCUS.ora (as your ORACLE_SID=IFOCUS)
Make the necessary changes in your init<ORACLE_SID>.ora file
$ vi initIFOCUS.ora
db_name=IFOCUS
instance_name =IFOCUS
db_cache_size=16m
control_files=(/do1/oradata/IFOCUS/contrl1.ctl,
/d02/oradata/IFOCUS/contrl2.ctl)
Background_dump_dest=/d01/oradata/IFOCUS/bdump
(upto 10g feature it is not in 11g)
User_dump_dest=/d01/oradata/IFOCUS/udump
(upto 10g feature it is not in 11g)
Core_dump_dest=/d01/oradata/IFOCUS/cdump
(upto 10g feature it is not in 11g)
adump=/d01/oradata/IFOCUS/adump
(11g feature)
# parameter to be passed for automatic undo management
(optional)
undo_management=auto
undo_tablespace=undotbs1
undo_retention=900
(it is in seconds)
:wq
(save & exit)
Create the necessary directories to place database files, redolog files, control files and the dump files
directories.
$ cd /d01/oradata
$ mkdir IFOCUS
$ cd IFOCUS
$ mkdir bdump cdump udump (as specified in init<ORACLE_SID>.ora for 10g)
$ mkdir adump
(for 11g feature)
$ cd /d02/oradata
$ mkdir IFOCUS
$ cd
Execute the create database command which is defined in the following line script as a file createdb.sql,
using vi editor.
$ vi createdb.sql
CREATE DATABASE ifocus
DATAFILE /d01/oradata/IFOCUS/system01.dbf SIZE 200M
SYSAUX DATAFILE /d01/oradata/IFOCUS/sysaux01.dbf SIZE 60M
UNDO TABLESPACE undotbs1
DATAFILE /d01/oradata/IFOCUS/undotbs01.dbf SIZE 20M
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE /d01/oradata/IFOCUS/temp01.dbf SIZE 10M
DEFAULT TABLESPACE user_data
DATAFILE /d01/oradata/IFOCUS/user_data01.dbf SIZE 20M

www.ifocussolutions.com

ph.no: 040- 64640033

Page 1

LOGFILE

GROUP 1 (/d01/oradata/IFOCUS/redolog1a.log,
/d02/oradata/IFOCUS/redolog1b.log) SIZE 4M,
GROUP 2 (/d01/oradata/IFOCUS/redolog2a.log,
/d02/oradata/IFOCUS/redolog2b.log) SIZE 4M
CONTROLFILE REUSE;
:wq
Note : if already controlfile is created so we use the existing controlfile by the above command i.e
REUSE.
$ sqlplus /as sysdba
SQL> STARTUP NOMOUNT
SQL> @createdb.sql
The above script @createdb.sql performs the following operations:
Creates the controlfiles for the database
Creates the redolog files for the database
Creates the SYSTEM tablespace and the system rollback segment
Creates the SYSAUX tablespace
Creates default permanent tablespace USER_DATA
Creates UNDO tablespace and default temporary tablespace TEMP
Creates the data dictionary
Creates user SYS and SYSTEM
Mounts and opens the database for use.
After the above script processed, the CATPROC and CATALOG scripts are to be executed, as user
SYS, which are present in $ORACLE_HOME/rdbms/admin/ directory.
SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql
Then, connect as system/manager and execute PUPBLD.SQL . which is present in
$ORACLE_HOME/sqlplus/admin/pupbld.sql
SQL> @$ORACLE_HOME/sqlplus/admin/pupbld.sql
Different modes of startup:
STARTUP NOMOUNT

STARTUP MOUNT

STARTUP

STARTUP MOUNT EXCLUSIVE

Different modes of shutdown:


SHUTDOWN

mount the instance. (to create controlfile or to create a


Database).
mounts the instance and mounts the database. (To
perform Media recovery or to STOP or START
archivelog).
Mounts the instance, mounts the database and opens
the Database.
Mounts the database in exclusive mode ( oracle parallel
server).

Shuts down normally. (it waits for all users to


disconnect)
SHUTDOWN TRANSACTIONAL
:
Shuts down when all the users active.
SHUTDOWN IMMEDIATE
:
Rolls back any uncommitted transactions and shutdown.
In the industry normal shutdown never work you have
To use immediate will ensure redo-log entries
(committed ones ) are written to database files.
SHUTDOWN ABORT
:
Abruptly shuts down the database which demands a
Crash recovery when the instance coming up next time
(SMON). Usually we should never go for abort unless
immediate also doesnt work.
For more information you can query these views:

V$SGA
DBA_FREE_SPACE

V$INSTANCE
DBA_ROLLBACK_SEGS

V$DATABASE

V$PROCESS

V$SYSAUX_OCCUPANTS

V$CONTROLFILE

V$PARAMETER

V$DATAFILE

www.ifocussolutions.com

ph.no: 040- 64640033

Page 2

DBA_DATA_FILES

www.ifocussolutions.com

ph.no: 040- 64640033

Page 3

Das könnte Ihnen auch gefallen