sh crdb.sh vaibhav
Note: It will create database vaibhav
===============
#!/bin/bash
if [ $# -ne 1 ]; then
echo "You must enter the name of the database"
exit
fi
db=$1
rm -rf /u01/app/oracle/admin/$db
mkdir /u01/app/oracle/admin/$db/
mkdir /u01/app/oracle/admin/$db/bdump
mkdir /u01/app/oracle/admin/$db/cdump
mkdir /u01/app/oracle/admin/$db/udump
mkdir /u01/app/oracle/admin/$db/pfile
chmod -R 1770 /u01/app/oracle/admin/$db/
mkdir /u01/app/oracle/oradata/$db/
chmod -R 1770 /u01/app/oracle/oradata/$db/
rm -f /u01/app/oracle/oradata/$db/*
echo "db_name=$db
compatible=10.2.0
instance_type=rdbms
instance_name=$db
sga_target=250m
sga_max_size=300m
background_dump_dest='/u01/app/oracle/admin/$db/bdump'
user_dump_dest='/u01/app/oracle/admin/$db/udump'
core_dump_dest='/u01/app/oracle/admin/$db/cdump'
undo_management=auto
undo_tablespace=undotbs
db_recovery_file_dest='/u01/app/oracle/oradata/$db_flash_recovery'
db_recovery_file_dest_size=3G
log_archive_format=%t_%s_%r.arc
control_files='/u01/app/oracle/oradata/$db/control01.ctl','/u01/app/oracle/oradata/$db/control02.ctl'" > /u01/app/oracle/admin/$db/pfile/init$db.ora
export ORACLE_SID=$db
sqlplus "/ as sysdba" <
startup nomount pfile='/u01/app/oracle/admin/$db/pfile/init$db.ora';
create database $db
controlfile reuse
Maxinstances 1
Maxloghistory 1
Maxlogfiles 10
Maxlogmembers 4
Maxdatafiles 100
Datafile '/u01/app/oracle/oradata/$db/system01.dbf' size 250M
sysaux datafile '/u01/app/oracle/oradata/$db/sysaux01.dbf' size 100M
character set WE8MSWIN1252
noarchivelog
logfile
group 1 ('/u01/app/oracle/oradata/$db/redo_01.log') size 10M,
group 2 ('/u01/app/oracle/oradata/$db/redo_02.log') size 10M
undo tablespace UNDOTBS datafile
'/u01/app/oracle/oradata/$db/undotbs_01.dbf' size 20M
default temporary tablespace TEMP
tempfile '/u01/app/oracle/oradata/$db/temp_01.dbf' size 20M;
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
EOF
===============
No comments:
Post a Comment