SQL Script to Create the Database
Basic environment Information that I have
ORACLE_HOME==è/u01/app/oracle/product/11.2.0/db_1
ORACLE_SID=orcl ==èI will use
Database Name =è
orcl
Mount point name /u01/oradata
& /u02/oradata
1. Set ORACLE_SID
& ORACLE_HOME
export ORACLE_SID=orcl
export
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export
PATH=$PATH:$ORACLE_HOME/bin
2. Create a init.ora
file
Init.ora file location is
/u01/app/oracle/product/11.2.0/db_1/dbs so create the file here
cd
/u01/app/oracle/product/11.2.0/db_1/dbs
cat initorcl.ora
control_files =
(/u01/oradata/control1.ctl,/u01/oradata/control2.ctl,/u01/oradata/control3.ctl)
undo_management = AUTO
undo_tablespace = UNDOTBS1
db_name = orcl
db_block_size = 8192
sga_max_size = 1073741824 #one gig
sga_target = 1073741824 #one gig
#sga_max_size and sga_target is directly related to the RAM
size put the value suitable for your environment
3. Create a password file
$ORACLE_HOME/bin/orapwd
file=$ORACLE_HOME/dbs/pwdorcl.ora password=oracle entries=5
4. Start the instance
sqlplus / as sysdba
startup nomount
5. Create the
database
create database orcl
logfile group 1
('/u02/oradata/redo1.log') size 100M,
group 2 ('/u02/oradata/redo2.log')
size 100M,
group 3 ('/u02/oradata/redo3.log')
size 100M
character set WE8ISO8859P1
national character set utf8
datafile
'/u02/oradata/system.dbf' size 500M autoextend on next 10M maxsize unlimited
extent management local
sysaux datafile
'/u02/oradata/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
undo tablespace undotbs1
datafile '/u02/oradata/undotbs1.dbf' size 100M
default temporary tablespace
temp tempfile '/u02/oradata/temp01.dbf' size 100M;
Attention
#This is a very basic script
Note: there's some other things you can do here,eg. you can
set "ARCHIVELOG" "SET
TIME_ZONE =" and "USER SYS IDENTIFIED BY password" and
"USER SYSTEM IDENTIFIED BY password"
etc
# Make sure have proper permission on the mount points
(/u01/oradata & /u02/oradata in my case) and sufficient space to hold the
datafiles
6. After successfully
executing the above script Run catalog and catproc
SQL>
@?/rdbms/admin/catalog.sql
SQL>
@?/rdbms/admin/catproc.sql
==================================================================
Another create
database script sample having something more for you
CREATE CONTROLFILE REUSE DATABASE "orcl"
NORESETLOGS
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 ('/u02/oradata/log1a.dbf',
'/u02/oradata/log1b.dbf') SIZE 30M,
GROUP 2 ('/u02/oradata/log2a.dbf',
'/u02/oradata/log2b.dbf') SIZE 30M
DATAFILE
'/u01/oradata/system01.dbf',
'/u01/oradata/mydatabase.dbf'
;
======================================================================
Leave your comment .......
No comments:
Post a Comment