Sunday, April 17, 2016

Creating database manually

Creating database manually step by step by Pushpjeet Cholkar 

Download the text file from her Download

1)
Create required directories at OS level as oracle user

/u01/app/oracle/oradata/info
/u01/app/oracle/oradata/info/log
/u01/app/oracle/oradata/info/data
/u01/app/oracle/oradata/info/control

2)
Compose a parameter file with name initinfo.ora at database default location   $ORACLE_HOME/dbs

db_name=info

instance_name=info

db_block_size=8192

control_files=(/u01/app/oracle/oradata/info/control/control1.ctl,/u01/app/oracle/oradata/info/control/control2.ctl)

sga_max_size=400m

shared_pool_size=300m

undo_management=auto

undo_tablespace=undotbs1

remote_login_passwordfile=exclusive

compatible=11.2.0

3)  
Create a database script file with name db.txt    at database default location    -- Create sql script file or normal text file anywhere at os level or even just write the below command to create database.

create database info

logfile  group 1 '/u01/app/oracle/oradata/info/log/redo1a.log' size 50m,

         group 2 '/u01/app/oracle/oradata/info/log/redo2a.log' size 50m,

         group 3 '/u01/app/oracle/oradata/info/log/redo3a.log' size 50m,

         group 4 '/u01/app/oracle/oradata/info/log/redo4a.log' size 50m

datafile '/u01/app/oracle/oradata/info/data/system01.dbf' size 200m autoextend on maxsize unlimited

sysaux datafile '/u01/app/oracle/oradata/info/data/sysaux01.dbf' size 200m autoextend on maxsize unlimited

default temporary tablespace info_temp tempfile '/u01/app/oracle/oradata/info/data/temp1.dbf' size 200m autoextend on maxsize unlimited

undo tablespace undotbs1 datafile '/u01/app/oracle/oradata/info/data/undo1.dbf' size 200m autoextend on maxsize unlimited;


4)
Create password file by the following command

orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwinfo password=admin entries=10



5)
Make entry in /etc/oratab file

info:/u01/app/oracle/product/11.2.0/dbhome_1:N

6)
  Set the enviornment to start the instance

[oracle@oracle ~]$ . oraenv
ORACLE_SID = [orcl] ? info
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle
[oracle@oracle ~]$

Check it is set or not

[oracle@oracle ~]$ env | grep ORACLE
ORACLE_UNQNAME=info
ORACLE_SID=info
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=oracle.localdomain
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@oracle ~]$


7)
Startup database in nomount state to run the 3 important script to create data dictionary view,procedure,function,package and other object automatically.

[oracle@oracle ~]$ sqlplus / as sysdba

SQL> startup nomount
SQL> @'/u01/app/oracle/product/11.2.0/dbhome_1/dbs/db.txt'
SQL> create spfile from pfile;
SQL> @'/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql'
SQL> @'/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql'

* For the 3rd script pupbld.sql login as system the default password will be manager

SQL> conn system/manager
SQL> '/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql'

*Again login as sys

SQL> connect sys/admin as sysdba

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area  418484224 bytes
Fixed Size                  1336932 bytes
Variable Size             360712604 bytes
Database Buffers           50331648 bytes
Redo Buffers                6103040 bytes
Database mounted.
Database opened.

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
INFO      READ WRITE

Congratulation your database is created and now in open mode!!!!!!
Thanks Pushpjeet Cholkar.

No comments:

Post a Comment