Sunday, 27 July 2014

Database creation using script


#su - oracle




$. db.env
$ cd $ORACLE_HOME

db_1]$ pwd
/u01/app/oracle/product/11.1.0.6/db_1
db_1]$ cd dbs

dbs]$ dir
hc_prod.dat  initdw.ora  init.ora  initprod.ora  lkPROD


dbs]$ vi initprod.ora

db_name=prod
compatible=11.1.0.6
sga_target=300m
control_files= '/u01/oradata/control01.ctl', '/u01/oradata/control02.ctl'
log_buffer=2000
undo_tablespace='undots'
undo_management='auto'
diagnostic_dest='/u01/trace'

:wq


dbs]$ cat createdb.sql
create database prod
datafile '/u01/oradata/system.dbf' size 300m
sysaux 
datafile '/u01/oradata/sysaux.dbf' size 200m
undo tablespace undots 
datafile '/u01/oradata/undots.dbf' size 50m
default temporary tablespace temp1 
tempfile '/u01/oradata/temp1.dbf' size 10m
logfile
group 1 '/u01/oradata/redo1.log' size 8m,
group 2 '/u01/oradata/redo2.log' size 8m,
group 3 '/u01/oradata/redo3.log' size 8m
character set UTF8
;
:wq


#export ORACLE_SID=prod
#echo  $ORACLE_SID


#sqlplus / as sysdba

sql>startup nomount


To create Database
@/u01/oradata/createdb.sql

Database created.


To create views
@?/rdbms/admin/catalog.sql

To create procedures
@?/rdbms/admin/catproc.sql


conn system/manager

@?/sqlplus/admin/pupbld.sql






No comments:

Post a Comment

Optimizer Access Paths using Indexes

Introduction In this tutorial you will use the Optimizer Access Paths for the following cases (scenarios): Case 1: With and Without Index Ca...