Create oracle database using linux shell script
In this script useful for how to create oracle database with archive mode using shell script in linux 7.3 and oracle 11gr2 version of softwre.
$ sh dbk1.sh
dbk1.sh mkdir k1 cd k1 mkdir admin oradata cd admin mkdir pfile diag create cd .. cd oradata mkdir control log archive data cd cp /home/oracle/pfk1 /home/oracle/k1/admin/pfile/initk1.ora cd export ORACLE_SID=k1 sqlplus / as sysdba <<EOF startup pfile='/home/oracle/k1/admin/pfile/initk1.ora' nomount; create database k1 datafile '/home/oracle/k1/oradata/data/system01.dbf' size 400m sysaux datafile '/home/oracle/k1/oradata/data/systemaux01.dbf' size 300m undo tablespace undo01 datafile '/home/oracle/k1/oradata/data/undo01.dbf' size 100m default temporary tablespace temp01 tempfile '/home/oracle/k1/oradata/data/temp01.dbf' size 100m logfile group 1 '/home/oracle/k1/oradata/log/log01.log' size 10m, group 2 '/home/oracle/k1/oradata/log/log02.log' size 10m; @?/rdbms/admin/catalog.sql; @?/rdbms/admin/catproc.sql; create table kf(id number(10)); create tablespace tbs datafile '/home/oracle/k1/oradata/data/tbs.dbf' size 500m; alter database close; alter database archivelog; shut immediate; ! export ORACLE_SID=k1 sqlplus / as sysdba <<EOF startup pfile='/home/oracle/k1/admin/pfile/initk1.ora'; create spfile from pfile='/home/oracle/k1/admin/pfile/initk1.ora'; EOF
vi pfk1 db_name=k1 sga_target=600m control_files='/home/oracle/k1/oradata/control/control01.ctl' diagnostic_dest='/home/oracle/k1/admin/diag' log_archive_dest_1='LOCATION=/home/oracle/k1/oradata/archive' log_archive_dest_state_1=enable log_archive_format=%%ORACLE_SID%%_%t_%s_%r.arcrun the dbk1.sh file like following your oracle databse will be create automatically.
$ sh dbk1.sh
Comments
Post a Comment