Wednesday, December 10, 2008

Database Creation Script

This is a sample script to create a database in Oracle 10g. Before you use this script, make sure you have the initialization parameter file (init.ora) or server parameter file (spfile)

SQL> startup nomount pfile= #if using pfile

(or) SQL> startup nomount #if using spfile

SQL> create database test
logfile group 1 ('/optware/oradata7/suresh/files/redofiles/redo01.log') size 10M,
group 2 ('/optware/oradata7/suresh/files/redofiles/redo02.log') size 10M,
group 3 ('/optware/oradata7/suresh/files/redofiles/redo03.log') size 10M
character set WE8ISO8859P1
national character set utf8
datafile '/optware/oradata7/test/files/system.dbf'
size 200M
autoextend on
next 10M maxsize unlimited
extent management local
sysaux datafile '/optware/oradata7/test/files/sysaux.dbf'
size 200M
autoextend on
next 10M
maxsize unlimited
undo tablespace undo
datafile '/optware/oradata7/test/files/undo.dbf'
size 200M
default temporary tablespace temp
tempfile '/optware/oradata7/test/files/temp.dbf'
size 200M;

SQL> @?/rdbms/admin/catalog.sql # '?' represents ORACLE_HOME
SQL> @?/rdbms/admin/catproc.sql

catalog.sql creates the data dictionary. catproc.sql creates all structures required for PL/SQL.

The user system might also want to run ?/sqlplus/admin/pupbld.sql. pupbld.sql creates a table that allows to block someone from using sql plus.

SQL> connect system/manager
SQL> @?/sqlplus/admin/pupbld

No comments:

Post a Comment