在可视化的环境中通过dbca生成,重点注意修改参数 Java_JIT_ENABLED 为false
本例生成模板文件内容如下:
[root@srv5 oracle_data]# cat orcl.dbc
<?xml version = '1.0'?>
<DatabaseTemplate description="" version="11.2.0.0.0">
<CommonAttributes>
<option value="false"/>
<option value="true"/>
<option value="true"/>
<option value="true"/>
<option value="true">
<tablespace/>
</option>
<option value="true">
<tablespace/>
</option>
<option value="false"/>
<option value="true">
<tablespace/>
</option>
<option value="true">
<tablespace/>
</option>
<option value="true"/>
<option value="true"/>
<option value="false"/>
</CommonAttributes>
<Variables/>
<CustomScripts Execute="false"/>
<InitParamAttributes>
<InitParams>
<initParam value="orcl"/>
<initParam value=""/>
<initParam value="(PROTOCOL=TCP) (SERVICE={SID}XDB)"/>
<initParam value="{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump"/>
<initParam value="11.2.0.4.0"/>
<initParam value="EXCLUSIVE"/>
<initParam value="150"/>
<initParam value="UNDOTBS1"/>
<initParam value="("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl")"/>
<initParam value="{ORACLE_BASE}"/>
<initParam value="{ORACLE_BASE}/fast_recovery_area"/>
<initParam value="db"/>
<initParam value="731" unit="MB"/>
<initParam value="8" unit="KB"/>
<initParam value="300"/>
<initParam value="4182" unit="MB"/>
</InitParams>
<MiscParams>
<databaseType>MULTIPURPOSE</databaseType>
<maxUserConn>20</maxUserConn>
<percentageMemTOSGA>40</percentageMemTOSGA>
<customSGA>false</customSGA>
<archiveLogMode>false</archiveLogMode>
<initParamFileName>{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora</initParamFileName>
</MiscParams>
<SPfile useSPFile="true">{ORACLE_HOME}/dbs/spfile{SID}.ora</SPfile>
</InitParamAttributes>
<StorageAttributes>
<DataFiles>
<Location>{ORACLE_HOME}/assistants/dbca/templates/Seed_Database.dfb</Location>
<SourceDBName>seeddata</SourceDBName>
<Name Tablespace="SYSTEM" Contents="PERMANENT" Size="740" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf</Name>
<Name Tablespace="SYSAUX" Contents="PERMANENT" Size="470" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf</Name>
<Name Tablespace="UNDOTBS1" Contents="UNDO" Size="25" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf</Name>
<Name Tablespace="USERS" Contents="PERMANENT" Size="5" autoextend="true" blocksize="8192">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf</Name>
</DataFiles>
<TempFiles>
<Name Tablespace="TEMP" Contents="TEMPORARY" Size="20">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf</Name>
</TempFiles>
<ControlfileAttributes>
<maxDatafiles>100</maxDatafiles>
<maxLogfiles>16</maxLogfiles>
<maxLogMembers>3</maxLogMembers>
<maxLogHistory>1</maxLogHistory>
<maxInstances>8</maxInstances>
<image filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
<image filepath="{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/"/>
</ControlfileAttributes>
<RedoLogGroupAttributes>
<reuse>false</reuse>
<fileSize unit="KB">51200</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo01.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
<RedoLogGroupAttributes>
<reuse>false</reuse>
<fileSize unit="KB">51200</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo02.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
<RedoLogGroupAttributes>
<reuse>false</reuse>
<fileSize unit="KB">51200</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo03.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
</StorageAttributes>
</DatabaseTemplate>
4.静默安装oracle软件
./runInstaller -ignoreSysPrereqs -ignorePrereq -silent -responseFile /home/oracle/db_install.rsp
5.静默创建数据库
dbca -silent -createDatabase -templateName /home/oracle/orcl.dbc -gdbName orcl -sid orcl -responseFile NO_VALUE -characterSet ZHS16GBK
屏幕上输入两次密码后脚本开始运行
6.至此,数据库成功安装,可以自行测试一番。亦可保存次容器为镜像供后续使用。
--------------------------------------------------------------------------------
PS: 如没有执行第3步中修改JAVA_JIT_ENABLED为false,则会遇到如下问题:
建库脚本执行到76%后挂起,查看日志会发现如下错误:
[root@2c9aedc92450 orcl]# cat postDBCreation.log
BEGIN
*
ERROR at line 1:
ORA-29516: Aurora assertion failure: Assertion failure at joez.c:3422
Bulk load of method java/lang/Object.<init> failed; insufficient shm-object space
ORA-06512: at line 3
IF CatbundleCreateDir(:catbundleLogDir) = 0 THEN
*
ERROR at line 71:
ORA-06550: line 71, column 14:
PLS-00201: identifier 'CATBUNDLECREATEDIR' must be declared
ORA-06550: line 71, column 11:
PL/SQL: Statement ignored
网上查得该问题的解决办法: