create database。
#!/bin/sh
OLD_UMASK=`umask`
umask 0027
mkdir -p aaa/admin/adump
mkdir -p aaa/admin/bdump
mkdir -p aaa/admin/cdump
mkdir -p aaa/admin/dpdump
mkdir -p aaa/admin/pfile
mkdir -p aaa/admin/udump
mkdir -p /aaa/cfgtoollogs/dbca/mydb
umask ${OLD_UMASK}
ORACLE_SID=mydb; export ORACLE_SID
echo You should Add this entry in the /etc/oratab: mydb:/aaa:Y
/aaa/home/bin/sqlplus /nolog @/aaa/scripts/createdb.sql
set verify off
PROMPT specify a password for sys as parameter 1;
DEFINE sysPassword = &1
PROMPT specify a password for system as parameter 2;
DEFINE systemPassword = &2
host /aaa/bin/orapwd file=/aaa/dbs/orapwmydb password=&&sysPassword force=y
@/aaa/admin/mydb/scripts/CreateDB.sql
@/aaa/admin/mydb/scripts/CreateDBFiles.sql
@/aaa/admin/mydb/scripts/CreateDBCatalog.sql
@/aaa/admin/mydb/scripts/JServer.sql
host echo "SPFILE='+ASM/mydb/spfilemydb.ora'" > /aaa/dbs/initmydb.ora
@/aaa/admin/mydb/scripts/postDBCreation.sql
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /aaa/admin/mydb/scripts/CreateDB.log
startup nomount pfile="/aaa/admin/mydb/scripts/init.ora";
CREATE DATABASE "mydb"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 32
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE SIZE 2048M AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE SIZE 2048M AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE SIZE 5120M AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE SIZE 2048M AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 SIZE 51200K,
GROUP 2 SIZE 51200K,
GROUP 3 SIZE 51200K
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
set linesize 2048;
column ctl_files NEW_VALUE ctl_files;
select concat('control_files=''', concat(replace(value, ', ', ''','''), '''')) ctl_files from v$parameter where name ='control_files';
host echo &ctl_files >>/aaa/admin/mydb/scripts/init.ora;
spool off
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /aaa/admin/mydb/scripts/CreateDBFiles.log
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT
SPACE MANAGEMENT AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
spool off
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /aaa/admin/mydb/scripts/CreateDBCatalog.log
@/aaa29/ot10g/rdbms/admin/catalog.sql;
@/aaa29/ot10g/rdbms/admin/catblock.sql;
@/aaa29/ot10g/rdbms/admin/catproc.sql;
@/aaa29/ot10g/rdbms/admin/catoctk.sql;
@/aaa29/ot10g/rdbms/admin/owminst.plb;
connect "SYSTEM"/"&&systemPassword"
@/aaa29/ot10g/sqlplus/admin/pupbld.sql;
connect "SYSTEM"/"&&systemPassword"
set echo on
spool /aaa/admin/mydb/scripts/sqlPlusHelp.log
@/aaa29/ot10g/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off
spool off
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /aaa/admin/mydb/scripts/JServer.log
@/aaa29/ot10g/javavm/install/initjvm.sql;
@/aaa29/ot10g/xdk/admin/initxml.sql;
@/aaa29/ot10g/xdk/admin/xmlja.sql;
@/aaa29/ot10g/rdbms/admin/catjava.sql;
@/aaa29/ot10g/rdbms/admin/catexf.sql;
spool off
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /aaa/admin/mydb/scripts/postDBCreation.log
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
create spfile='+ASM/mydb/spfilemydb.ora' FROM pfile='/aaa/admin/mydb/scripts/init.ora';
shutdown immediate;
connect "SYS"/"&&sysPassword" as SYSDBA
startup ;
select 'utl_recomp_begin: ' || to_char(sysdate, 'HH:MI:SS') from dual;
execute utl_recomp.recomp_serial();
select 'utl_recomp_end: ' || to_char(sysdate, 'HH:MI:SS') from dual;
spool /aaa/admin/mydb/scripts/postDBCreation.log