Creating 11g Database Manually in SunSolarius


Steps:

  1. Create pfile , password file for new database
  2. Create necessary directories
  3. Create inistance and start the database in nomunt mode
  4. Use create database to create new database
  5. Run necessary scripts file to create data dictionary tables
  6. Testing newly created database and registered to listener

Creating pfile

For creating pfile for new database you can copy from running database or you can modify sample pfile located in dbs directory. In my case I am using sample pfile.

Now open the file and make necessary changes.

bash-3.2$ cd /u01/app/oracle/product/11.2.0.2/db_1/dbs

bash-3.2$ cp init.ora initnewdb.ora

bash-3.2$ vi initnewdb

db_name=’ORCL’         àChange new db_name=’NEWDB’    (change orcl to newdb)

memory_target=1G

processes = 150

audit_file_dest='<ORACLE_BASE>/admin/orcl/adump’

audit_trail =’db’

db_block_size=8192

db_domain=”

db_recovery_file_dest='<ORACLE_BASE>/flash_recovery_area’

db_recovery_file_dest_size=2G

diagnostic_dest='<ORACLE_BASE>’

dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)’

open_cursors=300

remote_login_passwordfile=’EXCLUSIVE’

undo_tablespace=’UNDOTBS1′

# You may want to ensure that control files are created on separate physical

# devices

control_files = (ora_control1, ora_control2)   (ora_control1 change to /u01/app/oracle/oradata/newdb/control01.ctl,

ora_control2 change to /u01/app/oracle/oradata/newdb/control02.ctl   )

compatible =’11.2.0′

:1,$ s#<ORACLE_BASE># /u01/app/oracle#g

:wq!

bash-3.2$ cat initnewdb

bash-3.2$ mkdir –p /u01/app/oracle/admin/newdb/adump

bash-3.2$ mkdir –p to /u01/app/oracle/oradata/newdb/

bash-3.2$ . oraenv

ORACLE_SID = {OCM} ? newdb

The Oracle base for ORACLE_HOME =/u01/app/oracle/product/11.2.0.2/db_1 is /u01/app/oracle

 

Create a password file for newdb

bash-3.2$cd /u01/app/oracle/product/11.2.0.2/db_1/dbs

 

bash-3.2$orapwd file =orapwnewdb password=PasswOrd

 

Make an entry of new instance  in vi /var/opt/oracle

bash-3.2$  vi /var/opt/oracle

 

# This file is used by ORACLE utilities.  It is created by root.sh

# and updated by the Database Configuration Assistant when creating

# a database.

 

# A colon, ‘:’, is used as the field terminator.  A new line terminates

# the entry.  Lines beginning with a pound sign, ‘#’, are comments.

#

# Entries are of the form:

#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:

#

# The first and second fields are the system identifier and home

# directory of the database respectively.  The third filed indicates

# to the dbstart utility that the database should , “Y”, or should not,

# “N”, be brought up at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

OCM:/u01/app/oracle/product/11.2.0.2/db_1:N

NEWDB:/u01/app/oracle/product/11.2.0.2/db_1:N

:wq!

Now , setup variables and startup database using pfile in nomunt stage

 

bash-3.2$ . oraenv

ORACLE_SID = {OCM} ? newdb

bash-3.2$ sqlplus “/ as sysdba”;

SQL> startup nomunt pfile=’/u01/app/oracle/product/11.2.0.2/db_1/dbs/initnewdb.ora’

ORA-00845: MEMORY_TARGET not supported on this system

SQL> exit

bash-3.2$cd /u01/app/oracle/product/11.2.0.2/db_1/dbs

bash-3.2$vi initnewdb.ora

And change memory_target=1G       to  sga_target=1G

bash-3.2$ sqlplus “/ as sysdba”;

SQL> startup nomunt pfile=’/u01/app/oracle/product/11.2.0.2/db_1/dbs/initnewdb.ora’

SQL> create spfile from pfile;

File created

SQl>

SQL> Shut immediate;

SQL> startup nomunt

bash-3.2$cd /u01/app/oracle/product/11.2.0.2/db_1/dbs

bash-3.2$vi newdb.sql

CREATE DATABASE newdb

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 1024

MAXINSTANCES 8

MAXLOGHISTORY 1

CHARACTER SET AL32UTF8

DATAFILE ‘/u01/app/oracle/oradata/newdb/system01.dbf’ size 500M REUSE

SYSAUX DATAFILE   ‘/u01/app/oracle/oradata/newdb/sysaux01.dbf’  size 1000M

default temporary tablespace temp tempfile ‘/u01/app/oracle/oradata/newdb/temp01.dbf’ size 1000M extent management local uniform size 1M

undo tablespace “undotbs1” datafile ‘/u01/app/oracle/oradata/newdb/undotbs01.dbf’ size 1000M

LOGFILE

GROUP 1 ‘/u01/app/oracle/oradata/newdb/online_redo01.log’  SIZE 50M,

GROUP 2 ‘/u01/app/oracle/oradata/newdb/ online_redo02.log’  SIZE 50M ,

GROUP 3 ‘/u01/app/oracle/oradata/newdb/ online_redo03.log’  SIZE 50M

/

 

User sys identified by PasswOrd

User system identified by PasswOrd

 

Run necasry  sql file

 

Catalog.sql          –    Create datadictionary and dynamic performance views tables

Catproc.sql          –     Creates function,procedure and packages

Pupld.sql             –     Create user profiles

 

Sql>@/u01/app/oracle/product/11.2.0.2/db_1/rdbms/admin/catalog.sql

Sql>@/u01/app/oracle/product/11.2.0.2/db_1/rdbms/admin/catproc.sql

Sql>@/u01/app/oracle/product/11.2.0.2/db_1/rdbms/admin/pupbld.sql

 

If you connection DB please chek finish status:

$sqlplus “/ as sysdba”;

 

SQL>select count(*) from all_tables;

SQL>exit

bash-3.2$ pwd

/u01/app/oracle/oradata/newdb

bash-3.2$ ls

control01.ctl  control02.ctl  redo01.log     redo02.log     redo03.log     sysaux01.dbf   system01.dbf   temp01.dbf     undotbs01.dbf

bash-3.2$ ls -li

total 5501216

1048448 -rw-r—–   1 oracle   oinstall 17514496 Apr  1 14:21 control01.ctl

1048449 -rw-r—–   1 oracle   oinstall 17514496 Apr  1 14:21 control02.ctl

1048452 -rw-r—–   1 oracle   oinstall 52429312 Mar 31 22:58 redo01.log

1048453 -rw-r—–   1 oracle   oinstall 52429312 Apr  1 09:00 redo02.log

1048454 -rw-r—–   1 oracle   oinstall 52429312 Apr  1 14:20 redo03.log

1048456 -rw-r—–   1 oracle   oinstall 1048584192 Apr  1 14:13 sysaux01.dbf

1048455 -rw-r—–   1 oracle   oinstall 524296192 Apr  1 14:13 system01.dbf

1048458 -rw-r—–   1 oracle   oinstall 1048584192 Mar 31 23:58 temp01.dbf

1048457 -rw-r—–   1 oracle   oinstall 1048584192 Apr  1 14:13 undotbs01.dbf

 

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: