Вы находитесь на странице: 1из 5

creating datbase

------------------ instance is nothing but SGA +BG


1.Manual method
2.Uisng DBCA (Database configuration assistant)

1.creating the DB with manual method

step:1. set environmental variables

ORACLE_SID(Oracle system identifier)

what ever the db name is there that should be same as instacne

when ever we need to create DB 1st we need to create intance that means we need to
create memory and
allocate memory start the BG process then go and start DB files then we can DB is
compeltely DB is open.

just choose the

ORACLE_SID=ORCL

export ORACLE_SID=ORCL

ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1 (installation path i have


created)

export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1

PATH is nothing but where exactly the binaries are located or installed like
suppose i want to enter into the db and gving the queries .so we are giving the
queries at sqlplus prompt so we are using sql language for commnicating with the
database.

so for entering into sqlplus prompt either we can go with sqlplus prompt or sql
developer .

sqlplus is command line utility thorugth which we can execute sql comamnds.

sql developer is a graphical utility

here we are using sqlplus commad line utilty ,so sqlplus actually present under in
oracle home.so sqlplus we call it as kind of binary.so for that sqlplus path we
have to set PATH variabl

PATH=$ORACLE_HOME/bin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

so these are variables we need to set as the environment variables but where do i
need to set these variables.

so i need to open a file name called .bash_proile .this file is hidden file (when
ever we give "." before
the fiile that we can treat as a hidden file in linux)

hidden files are not visible using ls command ,for that we have use ls -la

open the bash profile set env variables and run this file.

to run the bash profile say . .bash_proflile

to cross check bash profile correctly loaded or not ,in linux we use echo command
Eg: echo $ORACLE_SID

step :2

create a parameter file (pfile)

belowa are parameter's

db_name='devdb'
#shared_pool_size=100
db_block_size=8192
diagnostic_dest='/u01/oradata/orcl'
control_files=(/u01/oradata/orcl/control01.ctl)
open_cursors=300
undo_tablespace='UNDOTBS1'
compatible='11.2.0'
SGA_target=400M

why do we need a parameter file -- in oracle any thign that you want to assign a
value that we can say or regarded as a parameter files in oracle DB.

suppose just i want to give database name then we can use parameter that is
db_name=orcl

control_file='/u01...'

diagnostic_files= which means we are tring to diagnose or find the problem and the
recorded it in the file.

two types of daignosing files are available in the oracle DB

1.alter log file


2.trace file

1.alert log:
------------
what does the alert log file contains -- the name it self saying when ever we hvae
problem alerts are being generated and that will be recorded in the log(log means
recirding) file

so alert log file records alerts or issues or errors of the database.

what will name of the alert logile -- the name of the alert log file will be always
alert_sid.log --- alert_orcl.log

alert log file is compeltely text file we can read the errors

alert files is very big file -- it will be recodirng everything like start up of
database shut down of the DB,how many users logged in,what commands they are
firing.

one very important question -- what happens if the alert file gets deleted. ? wil
it effect the DB -- answer is no

time to time we have delete the alert log file ,bcoz alert log will be increased
and become very big.

when ever we just satrt DB a new laert file will be created ,basically 1 alert log
file will be created

trace file:
----------

trace file -- tracing is some thing means finding problem,it also do the same
thing.trace files also used to find the problem.

why do we need 2 types of files alert log file and trace file --- in alert log
we can open,read and resolve the errors but in oracle there are some issues which
we cant resolve the
issues as a DBA bcoz there are lot of bugs in DB software and we have to depend on
oracle support in that case .

when we join in the company what they will do ,they give oracle support account.if
we unable to solve the issue we can raise SR to oracle support.inorder to find and
resolve the issue
by oracle support or team we have to provide some particulat file/s that files we
can call it as trace files .

which file we need to provide to oracle support team --- last trace or trace file
near to the problem

trace file is a semy binary file,its not in a readable formart -- we have tools in
oracel we can convert it into text format and we can find and resolve the issue.

- next parameter
shared_pool_size=100m

from 11g on wards automatic memory management -- no need to define the size for
memory components

open_curosrs= 300 which means 300 parallel queries can execute

-- db_block_size=8192 -- when ever we create datafiles data will be available in


tables

hard disk space divided in the form of blocks ,like this space in datafiles
divided as blocks so you can have block sizes ranging from 2k,4k,8k,16k,32k.

oracle by default recommended to use 8k blocks.suppose if you forget to mention


the block_size parameter then oracle will create by default block size as 8k.

before creating the DB you have to mention the block size but after creating the
DB we cant change then block size. bcoz when you create the DB oracle use that size
and store the data
in the datafiles.
just ref pasting all the parameters that we need to use in manual method in DB
creation

db_name='orcl'
#shared_pool_size=100
db_block_size=8192
diagnostic_dest='/u01/oradata/orcl'
control_files='/u01/oracle/oradata/orcl/control01.ctl'
open_cursors=300
undo_tablespace='UNDOTBS'
compatible='11.2.0'
SGA_target=300M

compatible -- it means this pfile is compatible with which version, we are going to
create this pfile on which version of the oracle software.
The Oracle Database enables you to control the compatibility of your
database with the COMPATIBLE initialization parameter.

-- what should be the parameter file name and the location


-- how we can connect to the DB

create database orcl


datafile �/u01/oracle/oradata/orcl/system01.dbf� size 50M reuse autoextend on
sysaux datafile �/u01/oracle/oradata/orcl/sysaux01.dbf� size 50m reuse
autoextend on
undo tablespace undotbs1
datafile �/u01/oracle/oradata/orcl/undo.dbf� size 10m reuse
default temporary tablespace temp
tempfile �/u01/oracle/oradata/orcl/tmp.dbf� size 20m reuse
logfile
group 1 �/u01/oracle/oradata/orcl/redolog1.log� size 5m,
group 2 �/u01/oracle/oradata/orcl/reedolog2.log� size 5m;

post Database creation steps:

vi postdb.sql

spool postdb1.log
@$ORACLE_HOME/rdbms/admin/catalog.sql

@$ORACLE_HOME/rdbms/admin/catproc.sql

spool off

connect system/oracle

spool postdb2.log

@$ORACLE_HOME/sqlplus/admin/pupbld.sql

spool off
catalog.sql creates all the data dictionary views,

catproc.sql creates system specified stored procedures

pupbld.sql creates the default roles and profiles.

Вам также может понравиться