Friday, July 2, 2021

Database Creation on Oracle 11g

Database Creation:-

 

We will learn how to create the database 

[oracle@linux ~]$ cd /

 [oracle@linux /]$ ls

[oracle@linux /]$ cd disk1 

[oracle@linux /]$ mkdir prod 

[oracle@linux /]$ mkdir data redo control log arch diag fra

 [oracle@linux /]$ cd $ORACLE_HOME/dbs

[oracle@linux dbs /]$ ls -lrt


[oracle@linux dbs ]$ vi initprod.ora

 

db_name=prod

memory_target=500m

control_files= '/disk1/prod/control/control02.ctl'

diagnostic_dest= '/disk1/prod/diag'

compatible=11.2.0


Save it.

Now let’s create a SQL script.


[oracle@linux dbs]$ vi dbcreation.sql


create database prod

datafile '/disk1/prod/data/system.dbf' size 300m autoextend on

sysaux datafile '/disk1/prod/data/sysaux.dbf' size 300m autoextend on

default tablespace user_data datafile '/disk1/prod/data/user01.dbf' size 500m

undo tablespace undotbs datafile '/disk1/prod/data/undotbs.dbf' size 100m

logfile group 1 '/disk1/prod/redo/redo1.rdo' size 100m,

        group 2 '/disk1/prod/redo/redo2.rdo' size 100m;


Save and come out...


[oracle@linux dbs ]$ sqlplus / as sysdba


 



SQL> startup nomount

ORACLE instance started.


### You can see here total system global area ###


SQL> @/ /u01/app/oracle/product/11.2.0/dbs/dbcreation.sql


Database created.


Now let’s create other database like procedure function and other objects.

SQL>@$ORACLE_HOME/rdbms/admin/catalog.sql 

SQL>@$ORACLE_HOME/rdbms/admin/catproc.sql

 SQL> @$ORACLE_HOME/sqlplus/admin/pubbld.sql

SQL> shut immediate

[oracle@linux dbs]$ sqlplus / as sysdba

SQL> startup 


Now database has connected...


No comments:

Post a Comment