Manual Database Creation Steps


Step 1  :
Create Necessary Directory Structure.

$ ls
app Desktop oraInventory
$ mkdir prod
$ ls
app Desktop oraInventory prod
$ cd prod
$ ls
$ mkdir diag
$ ls
Diag
$ pwd
/u01/slm/prod


Step 2

Create the Parameter File.

Location of parameter file= /u01/slm/oracle/product/11.2.0/db_1/dbs/

vi initprod.ora (Parameter File)

db_name=prod                                                                          * defines database name
Instance_name=prod                                                                * defines instance name
Control_files=/u01/slm/prod/control01.ctrl                             * name and location of controlfile
Db_block_size = 8192                                                              * to set db block size in bytes (8k)
Uundo_management='auto'                                                      * undo segment management values                                                                                                                        manual or auto
Undo_tablespace=undotbs1                                                     * undo tablespace name
Undo_retention=900                                                                 *  undo database retention periold
Compatible=11.2.0  oracle software version
memory_max_target=400m                                                     * to set upper limit of sga
memory_target=300m                                                              * to set actual size of sga component
                                                                                                   + PGA Aggregate (except log buffers)
Log_buffer = 100                                                                      * to set log buffer size
Workarea_size_policy = auto                       *  auto sizing of the pga within aggregate pga
diagnostic_dest='/u01/slm/prod/diag             *  location of alert log and trace files



Step 3:


Export The Database & Startup in NOMOUNT stage.

$ export ORACLE_SID=prod
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu July 09 21:55:46 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1345352 bytes
Variable Size 138414264 bytes
Database Buffers 272629760 bytes
Redo Buffers 6094848 bytes

SQL> exit


Step 4:


Create the Database ..

$vi dbcreate_script.sql
CREATE DATABASE prod
USER SYS IDENTIFIED BY manager
USER SYSTEM IDENTIFIED BY manager
LOGFILE GROUP 1 ('/u01/slm/prod/redo01.log') SIZE 50M,
GROUP 2 ('/u01/slm/prod/redo02.log') SIZE 50M,
GROUP 3 ('/u01/slm/prod/redo03.log') SIZE 50M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 50
MAXDATAFILES 100
MAXINSTANCES 1
DATAFILE '/u01/slm/prod/system01.dbf' SIZE 100M autoextend on
SYSAUX DATAFILE '/u01/slm/prod/sysaux01.dbf' SIZE 100M autoextend on
DEFAULT TABLESPACE users datafile /u01/slm/prod/users.dbf' size 100m
autoextend on DEFAULT TEMPORARY TABLESPACE temp TEMPFILE
/u01/slm/prod/temp01.dbf' SIZE 50m

UNDO TABLESPACE undotbs1 DATAFILE '/u01/slm/prod/undotbs01.dbf' SIZE 200M;


Step 5:

Run the db create script from sqlplus prompt

$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu july 09 21:58:29 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @dbcreate_script.sql;
database created.

SQL> exit



Step 6:

Create post script

vi postscript.sql

@$ORACLE_HOME/rdbms/admin/catalog.sql                 * script to create data
Dictionary tables, sy…

@$ORACLE_HOME/rdbms/admin/catproc.sql                *script to create procedure
And packages

Connect system/manager

@$ORACLE_HOME/sqlplus/admin/pupbld.sql                * script to create usersProfile


Listed scripts are minimal scripts for creating database.



Step 7 :

Run the post script at database level
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu july 09 21:58:29 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @postscript.sql
(it will take 20 to 30 minutes)

SQL> select name from v$database;
NAME
PROD
SQL> select status from v$instance;
STATUS
OPEN

No comments:

Post a Comment