Manual Database Creation
Manual Database Creation
Manual Database Creation - DBA's are still using this approach for creating databases. The reason
is, you need not any GUI access like DBCA to create a database. In process of creating database
manually Database Administrator has to execute few commands and database is ready to use. Though
DBCA is an easy option to make database but mostly GUI of production environments not accessible.
So, DBA has to rely on scripts for creating database manually.
In this post, I will explain How I create a script for manual database creations and this can also works
for you. Below are the main steps:
In this post, I will use Unix as Operating system and Oracle 11g as database version for creating
database manually, using All these options I am going to make a single instance database.
1. Specify an Instance Identifier (SID): SID is the name of the database, which we
are going to make on database server. ORACLE_SID is used to distinguish this instance from other
instances that you may create later and run concurrently on the same host computer. Below is how to
set SID in unix env.
Here, We are making a database by name "newdb". So, we have set ORACLE_SID as newdb.
4.Create Initialization Parameter File: Each time when database starts, it read
initialization parameter file for database parameter values. This file could be text file called as pfile or
binary file called as spfile. Here, We will start with creating pfile and will create database with this file
and later on. There are few mendatory parameters to start database which we will provided in this file.
Before making pfile make sure you have required directories like /etc/oracle/admin/newdb/adump,
/etc/oracle/fast_recovery_area/newdb and /etc/oracle/oradata/newdb.
db_name='newdb'
memory_target=1G
processes = 150
audit_file_dest='/etc/oracle/admin/newdb/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/etc/oracle/fast_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/etc/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = ('/etc/oracle/oradata/newdb/newdb_control1.ctl',
'/etc/oracle/oradata/newdb/newdb_control2.ctl')
compatible ='11.2.0'
DBA has to change this file values according to their requirements like db_name, memory_target,
audit_file_dest control_files location and compatible parameter etc. Make a new pfile by name
'initnewdb.ora' at $ORACLE_HOME/dbs and copy all these values in this file.
5. Connect to the Instance and Create Server Parameter File: Next step
in configuring manual database is starting database idle instance. Database admin has to start the idle
instance for creating spfile from pfile.
[oracle@database dbs]$ sqlplus /nolog
Since, Database Administrator has created spfile then he need not to specify parameter file name
during database instance startup. Database will by default use spfile for strtup. See more operations on
spfiles.
6. Start the Instance: Now DBA has to start database instance in nomount mode. Nomount
mode is used for database creation or maintenance operations.
In next step, we will create the database using create database script.
Database created.
When I execute this command I face below error and database creation was aborted.
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file '?/rdbms/admin/dtxnspc.bsq' near line 5
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Process ID: 8309
Session ID: 1 Serial number: 5
This is because of undo tablespaces name is different in create database statement and initnewdb.ora
file. Make sure undo tablesapces name is same in parameter file and create database command.
About script has created mandatory tablespaces for database creation, but to work on database DBA
has to make some additional tablespaces.
8. Create Additional Tablespaces: You may create additional tablespaces as per your
requirement. Below is the command for tablespace creation.
Tablespace created.
9. Run Scripts to Build Data Dictionary Views: Run below necessary scripts to
build data dictionary views, synonyms, and PL/SQL packages, and to support proper functioning of
SQL*Plus.
SQL> @?/rdbms/admin/catalog.sql
-------------------------------
-------------------------------
Grant succeeded.
PL/SQL procedure successfully completed.
SQL> @?/rdbms/admin/catproc.sql
-------------------------------
------------------------------
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP CATALOG 2013-07-25 23:19:56
SQL> @?/sqlplus/admin/pupbld.sql
Here, Manually Created database is ready to use, I would suggest to Restart the
database and check alert log for any error messages and act accordingly. Once DBA has
created Database Next step is to configure Tnsnames.ora and Listener.ora for database
connection. Please see Quick Steps to Configure Tnsnames.ora and Listener.ora file.