About Me

Sunday, 23 October 2011

Manual Oracle 11g r2 Database creation on Linux


Follow the following Steps for Manual Oracle 11g r2 Database creation on Linux :

  1. Set environment variable by editing ‘.bash_profile' file.
  2. Create parameter file in $ORACLE_HOME/dbs locatrion
  3. Create necessary directory structure.
  4. Create database creation script and run at SQL prompt.

After creation of the database build the data dictionary views,users,roles and plsql packages by
creating and runing script 'postdbcreate.sql' at SQL prompt.

Prerequisites for creating database:

Step 1: setting environment variable with '.bash_profile'

]$ vi .bash_profile
# User specific environment and startup programs
export PATH=$PATH:$HOME/bin
export ORACLE_SID=orcl
export ORACLE_HOME=/u1/app/oracle/product/11.1.0
export PATH=$ORACLE_HOME/bin:$PATH:.

Step 2: create parameter file (pfile)

[oracle11g@testdba dbs]$ cd /u1/app/oracle/product/11.1.0/dbs/
[oracle11g@testdba dbs]$ cp init.ora init$ORACLE_SID.ora
[oracle11g@testdba dbs]$ vi init$ORACLE_SID.ora
db_name=orcl
shared_pool_size = 100Mb
control_files =/disk1/oradata/orcldir/control.ctl
diagnostic_dest=/disk1/oradata/orcldir
undo_tablespace=undotbs
undo_management=auto
compatible = 11.2.0

Step 3: create directory structure

]$ mkdir /disk1/oradata/orcldir
  
Step 4: create database creation script and run at SQL prompt .

SYS>>startup nomount

SYS>>ed createdb

create database orcl
datafile '/disk1/oradata/orcldir/system.dbf' size 200m
sysaux datafile '/disk1/oradata/orcldir/sysaux.dbf' size 100m
undo tablespace undotbs
datafile '/disk1/oradata/orcldir/undotbs.dbf' size 50m
default tablespace userdata
datafile '/disk1/oradata/orcldir/userdata.dbf' size 100m
default temporary tablespace temp
tempfile '/disk1/oradata/orcldir/temp.dbf' size 60m
logfile
group 1('/disk1/oradata/orcldir/redo1a.log') size 4m,
group 2('/disk1/oradata/orcldir/redo2a.log') size 4m
controlfile reuse;

SYS>>@createdb

Database created.

Step 5: Postdbcreat.sql

SQL>ed postdbcreate.sql
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
conn system/manager
@$ORACLE_HOME/sqlplus/admin/pupbld.sql

SQL> @postdbcreate.sql

 After running postdbcreate script database creation is complete.





2 comments:

  1. Hi, This Is very nice article. this is very use ful for oracle 11g dba leraners.
    thanks gor the given informtion about oracle 11g dba.

    ReplyDelete