Manual Create Database OFA

The detail referencing the online library of oracle.

#!/bin/sh
echo_red(){
    echo -e "\033[31;5;1m${1}\033[0m"
}

sub_pfile(){
mkdir -p /u01/app/oracle/oradata/orcl
mkdir -p /u01/app/oracle/admin
mkdir -p /u01/app/oracle/flash_recovery_area
export v_dbs=/u01/app/oracle/product/10.2.0/db_1/dbs
export v_orcl=/u01/app/oracle/oradata/orcl
export v_base=/u01/app/oracle
export v_admin=/u01/app/oracle/admin/orcl
export v_flash=/u01/app/oracle/flash_recovery_area
cat > initorcl.ora <<EOF
db_recovery_file_dest      = "$v_flash"
db_recovery_file_dest_size = 2147483648
undo_management            = "AUTO"

control_files              = "$v_orcl/controlfile/control01.ctl","$v_orcl/controlfile/control02.ctl","$v_orcl/controlfile/control03.ctl"
audit_file_dest            = "$v_admin/adump"
background_dump_dest       = "$v_admin/bdump"
user_dump_dest             = "$v_admin/udump"
core_dump_dest             = "$v_admin/cdump"
db_name                    = "orcl"

__shared_pool_size       = 163577856
__large_pool_size        = 4194304
__java_pool_size         = 4194304
__streams_pool_size      = 0
__db_cache_size          = 436207616
remote_login_passwordfile= "EXCLUSIVE"
db_domain                = ""
dispatchers              = "(PROTOCOL=TCP) (SERVICE=orclXDB)"

processes                = 150
sga_target               = 612368384
db_block_size            = 8192
compatible               = "10.2.0.1.0"
db_file_multiblock_read_count= 16
job_queue_processes      = 10
open_cursors             = 300
pga_aggregate_target     = 203423744
EOF
mv initorcl.ora $v_dbs/
chown oracle:oinstall $v_dbs/*

mkdir -p $v_admin/adump
mkdir -p $v_admin/bdump
mkdir -p $v_admin/udump
mkdir -p $v_admin/cdump
mkdir -p $v_flash/ORCL
mkdir -p $v_orcl/controlfile
mkdir -p $v_orcl/datafile
mkdir -p $v_orcl/onlinelog
chown -R oracle:oinstall $v_base/*

su - oracle <<EOF
cd $v_dbs
rm -rf orapwdorcl
/u01/app/oracle/product/10.2.0/db_1/bin/orapwd file=orapwdorcl password=oracle entries=4
EOF
}

sub_create_db(){
cat > /home/oracle/create_OFA.sql<<EOF
CREATE DATABASE orcl
USER sys IDENTIFIED BY oracle
USER system IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/onlinelog/redo01.log') SIZE 100M,
GROUP 2 ('/u01/app/oracle/oradata/orcl/onlinelog/redo02.log') SIZE 100M,
GROUP 3 ('/u01/app/oracle/oradata/orcl/onlinelog/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/app/oracle/oradata/orcl/datafile/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/datafile/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users datafile '/u01/app/oracle/oradata/orcl/datafile/users01.dbf' size 50M REUSE
DEFAULT TEMPORARY TABLESPACE temp1
TEMPFILE '/u01/app/oracle/oradata/orcl/datafile/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/orcl/datafile/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
EOF
su - oracle -c "sqlplus /nolog"<<EOF
conn / as sysdba;
shutdown abort;
startup nomount;
create spfile from pfile;
@/home/oracle/create_OFA.sql
quit
EOF
}

sub_complie(){
su - oracle -c "sqlplus /nolog"<<EOF
conn / as sysdba;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
quit
EOF
}

case $1 in
1) sub_pfile
;;
2) sub_create_db
;;
3) sub_complie
;;
*) echo_red "please input {1|2|3} !"
   echo_red "1: pfile"
   echo_red "2: create_db_OMF"
   echo_red "3: complie"
;;
esac
 

你可能感兴趣的:(text,mode,manual,OFA)