星期一, 7月 01, 2013

Oracle 11g creating db instance from command line...

以下檔案orcl.dbt dbca , 存完template時所產生的檔案,

根據此檔案, 可以用command line 建立資料庫(但不會建EM Web console repository)

 

====content of orcl.dbt=================================================

<DatabaseTemplate name="orcl" description=" " version="11.1.0.0.0">

   <CommonAttributes>

      <option name="OMS" value="false"/>

      <option name="JSERVER" value="true"/>

      <option name="SPATIAL" value="false"/>

      <option name="IMEDIA" value="true"/>

      <option name="XDB_PROTOCOLS" value="true">

         <tablespace id="SYSAUX"/>

      </option>

      <option name="ORACLE_TEXT" value="true">

         <tablespace id="SYSAUX"/>

      </option>

      <option name="SAMPLE_SCHEMA" value="false"/>

      <option name="CWMLITE" value="false">

         <tablespace id="SYSAUX"/>

      </option>

      <option name="EM_REPOSITORY" value="true">

         <tablespace id="SYSAUX"/>

      </option>

      <option name="APEX" value="true"/>

      <option name="OWB" value="false"/>

      <option name="DV" value="false"/>

   </CommonAttributes>

   <Variables/>

   <CustomScripts Execute="false"/>

   <InitParamAttributes>

      <InitParams>

         <initParam name="db_create_file_dest" value="/test/orcl/oradata"/>

         <initParam name="db_name" value="orcl"/>

         <initParam name="db_domain" value=""/>

         <initParam name="dispatchers" value="(PROTOCOL=TCP) (SERVICE={SID}XDB)"/>

         <initParam name="audit_file_dest" value="{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump"/>

         <initParam name="compatible" value="11.2.0.0.0"/>

         <initParam name="remote_login_passwordfile" value="EXCLUSIVE"/>

         <initParam name="db_create_online_log_dest_2" value="/test/orcl/oraidx"/>

         <initParam name="db_create_online_log_dest_1" value="/test/orcl/oradata"/>

         <initParam name="processes" value="512"/>

         <initParam name="undo_tablespace" value="UNDOTBS1"/>

         <initParam name="diagnostic_dest" value="{ORACLE_BASE}"/>

         <initParam name="db_recovery_file_dest" value="{ORACLE_BASE}/fast_recovery_area"/>

         <initParam name="audit_trail" value="db"/>

         <initParam name="log_archive_format" value="%t_%s_%r.dbf"/>

         <initParam name="memory_target" value="7009" unit="MB"/>

         <initParam name="sessions" value="568"/>

         <initParam name="db_block_size" value="8" unit="KB"/>

         <initParam name="open_cursors" value="300"/>

         <initParam name="db_recovery_file_dest_size" value="102400" unit="MB"/>

      </InitParams>

      <MiscParams>

         <databaseType>MULTIPURPOSE</databaseType>

         <maxUserConn>20</maxUserConn>

         <percentageMemTOSGA>11</percentageMemTOSGA>

         <customSGA>false</customSGA>

         <characterSet>WE8ISO8859P15</characterSet>

         <nationalCharacterSet>AL16UTF16</nationalCharacterSet>

         <archiveLogMode>true</archiveLogMode>

         <initParamFileName>{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora</initParamFileName>

      </MiscParams>

      <SPfile useSPFile="true">{ORACLE_HOME}/dbs/spfileorcl.ora</SPfile>

   </InitParamAttributes>

   <StorageAttributes>

      <ControlfileAttributes id="Controlfile">

         <maxDatafiles>1024</maxDatafiles>

         <maxLogfiles>16</maxLogfiles>

         <maxLogMembers>3</maxLogMembers>

         <maxLogHistory>1</maxLogHistory>

         <maxInstances>8</maxInstances>

         <image name="&lt;OMF_CONTROL_0>" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>

         <image name="&lt;OMF_CONTROL_1>" filepath="{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/"/>

      </ControlfileAttributes>

      <DatafileAttributes id="&lt;OMF_SYSAUX_DATAFILE_0>">

         <tablespace>SYSAUX</tablespace>

         <temporary>false</temporary>

         <online>true</online>

         <status>0</status>

         <size unit="MB">600</size>

         <reuse>true</reuse>

         <autoExtend>true</autoExtend>

         <increment unit="KB">10240</increment>

         <maxSize unit="MB">-1</maxSize>

      </DatafileAttributes>

      <DatafileAttributes id="&lt;OMF_SYSTEM_DATAFILE_0>">

         <tablespace>SYSTEM</tablespace>

         <temporary>false</temporary>

         <online>true</online>

         <status>0</status>

         <size unit="MB">700</size>

         <reuse>true</reuse>

         <autoExtend>true</autoExtend>

         <increment unit="KB">10240</increment>

         <maxSize unit="MB">-1</maxSize>

      </DatafileAttributes>

      <DatafileAttributes id="&lt;OMF_TEMP_DATAFILE_0>">

         <tablespace>TEMP</tablespace>

         <temporary>false</temporary>

         <online>true</online>

         <status>0</status>

         <size unit="MB">20</size>

         <reuse>true</reuse>

         <autoExtend>true</autoExtend>

         <increment unit="KB">640</increment>

         <maxSize unit="MB">-1</maxSize>

      </DatafileAttributes>

      <DatafileAttributes id="&lt;OMF_UNDOTBS1_DATAFILE_0>">

         <tablespace>UNDOTBS1</tablespace>

         <temporary>false</temporary>

         <online>true</online>

         <status>0</status>

         <size unit="MB">200</size>

         <reuse>true</reuse>

         <autoExtend>true</autoExtend>

         <increment unit="KB">5120</increment>

         <maxSize unit="MB">-1</maxSize>

      </DatafileAttributes>

      <DatafileAttributes id="&lt;OMF_USERS_DATAFILE_0>">

         <tablespace>USERS</tablespace>

         <temporary>false</temporary>

         <online>true</online>

         <status>0</status>

         <size unit="MB">5</size>

         <reuse>true</reuse>

         <autoExtend>true</autoExtend>

         <increment unit="KB">1280</increment>

         <maxSize unit="MB">-1</maxSize>

      </DatafileAttributes>

      <TablespaceAttributes id="SYSAUX">

         <online>true</online>

         <offlineMode>1</offlineMode>

         <readOnly>false</readOnly>

         <temporary>false</temporary>

         <defaultTemp>false</defaultTemp>

         <undo>false</undo>

         <local>true</local>

         <blockSize>-1</blockSize>

         <allocation>1</allocation>

         <uniAllocSize unit="KB">-1</uniAllocSize>

         <initSize unit="KB">64</initSize>

         <increment unit="KB">64</increment>

         <incrementPercent>50</incrementPercent>

         <minExtends>1</minExtends>

         <maxExtends>4096</maxExtends>

         <minExtendsSize unit="KB">64</minExtendsSize>

         <logging>true</logging>

         <recoverable>false</recoverable>

         <maxFreeSpace>0</maxFreeSpace>

         <autoSegmentMgmt>true</autoSegmentMgmt>

         <bigfile>false</bigfile>

         <datafilesList>

            <TablespaceDatafileAttributes id="&lt;OMF_SYSAUX_DATAFILE_0>">

               <id>-1</id>

            </TablespaceDatafileAttributes>

         </datafilesList>

      </TablespaceAttributes>

      <TablespaceAttributes id="SYSTEM">

         <online>true</online>

         <offlineMode>1</offlineMode>

         <readOnly>false</readOnly>

         <temporary>false</temporary>

         <defaultTemp>false</defaultTemp>

         <undo>false</undo>

         <local>true</local>

         <blockSize>-1</blockSize>

         <allocation>3</allocation>

         <uniAllocSize unit="KB">-1</uniAllocSize>

         <initSize unit="KB">64</initSize>

         <increment unit="KB">64</increment>

         <incrementPercent>50</incrementPercent>

         <minExtends>1</minExtends>

         <maxExtends>-1</maxExtends>

         <minExtendsSize unit="KB">64</minExtendsSize>

         <logging>true</logging>

         <recoverable>false</recoverable>

         <maxFreeSpace>0</maxFreeSpace>

         <autoSegmentMgmt>true</autoSegmentMgmt>

         <bigfile>false</bigfile>

         <datafilesList>

            <TablespaceDatafileAttributes id="&lt;OMF_SYSTEM_DATAFILE_0>">

               <id>-1</id>

            </TablespaceDatafileAttributes>

         </datafilesList>

      </TablespaceAttributes>

      <TablespaceAttributes id="TEMP">

         <online>true</online>

         <offlineMode>1</offlineMode>

         <readOnly>false</readOnly>

         <temporary>true</temporary>

         <defaultTemp>true</defaultTemp>

         <undo>false</undo>

         <local>true</local>

         <blockSize>-1</blockSize>

         <allocation>1</allocation>

         <uniAllocSize unit="KB">-1</uniAllocSize>

         <initSize unit="KB">64</initSize>

         <increment unit="KB">64</increment>

         <incrementPercent>0</incrementPercent>

         <minExtends>1</minExtends>

         <maxExtends>0</maxExtends>

         <minExtendsSize unit="KB">64</minExtendsSize>

         <logging>true</logging>

         <recoverable>false</recoverable>

         <maxFreeSpace>0</maxFreeSpace>

         <autoSegmentMgmt>true</autoSegmentMgmt>

         <bigfile>false</bigfile>

         <datafilesList>

            <TablespaceDatafileAttributes id="&lt;OMF_TEMP_DATAFILE_0>">

               <id>-1</id>

            </TablespaceDatafileAttributes>

         </datafilesList>

      </TablespaceAttributes>

      <TablespaceAttributes id="UNDOTBS1">

         <online>true</online>

         <offlineMode>1</offlineMode>

         <readOnly>false</readOnly>

         <temporary>false</temporary>

         <defaultTemp>false</defaultTemp>

         <undo>true</undo>

         <local>true</local>

         <blockSize>-1</blockSize>

         <allocation>1</allocation>

         <uniAllocSize unit="KB">-1</uniAllocSize>

         <initSize unit="KB">512</initSize>

         <increment unit="KB">512</increment>

         <incrementPercent>50</incrementPercent>

         <minExtends>8</minExtends>

         <maxExtends>4096</maxExtends>

         <minExtendsSize unit="KB">512</minExtendsSize>

         <logging>true</logging>

         <recoverable>false</recoverable>

         <maxFreeSpace>0</maxFreeSpace>

         <autoSegmentMgmt>true</autoSegmentMgmt>

         <bigfile>false</bigfile>

         <datafilesList>

            <TablespaceDatafileAttributes id="&lt;OMF_UNDOTBS1_DATAFILE_0>">

               <id>-1</id>

            </TablespaceDatafileAttributes>

         </datafilesList>

      </TablespaceAttributes>

      <TablespaceAttributes id="USERS">

         <online>true</online>

         <offlineMode>1</offlineMode>

         <readOnly>false</readOnly>

         <temporary>false</temporary>

         <defaultTemp>false</defaultTemp>

         <undo>false</undo>

         <local>true</local>

         <blockSize>-1</blockSize>

         <allocation>1</allocation>

         <uniAllocSize unit="KB">-1</uniAllocSize>

         <initSize unit="KB">128</initSize>

         <increment unit="KB">128</increment>

         <incrementPercent>0</incrementPercent>

         <minExtends>1</minExtends>

         <maxExtends>4096</maxExtends>

         <minExtendsSize unit="KB">128</minExtendsSize>

         <logging>true</logging>

         <recoverable>false</recoverable>

         <maxFreeSpace>0</maxFreeSpace>

         <autoSegmentMgmt>true</autoSegmentMgmt>

         <bigfile>false</bigfile>

         <datafilesList>

            <TablespaceDatafileAttributes id="&lt;OMF_USERS_DATAFILE_0>">

               <id>-1</id>

            </TablespaceDatafileAttributes>

         </datafilesList>

      </TablespaceAttributes>

      <RedoLogGroupAttributes id="1">

         <reuse>false</reuse>

         <fileSize unit="KB">51200</fileSize>

         <Thread>1</Thread>

         <member ordinal="0" memberName="OMF_1_REDOLOG_MEMBER_0" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>

      </RedoLogGroupAttributes>

      <RedoLogGroupAttributes id="2">

         <reuse>false</reuse>

         <fileSize unit="KB">51200</fileSize>

         <Thread>1</Thread>

         <member ordinal="0" memberName="OMF_2_REDOLOG_MEMBER_0" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>

      </RedoLogGroupAttributes>

      <RedoLogGroupAttributes id="3">

         <reuse>false</reuse>

         <fileSize unit="KB">51200</fileSize>

         <Thread>1</Thread>

         <member ordinal="0" memberName="OMF_3_REDOLOG_MEMBER_0" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>

      </RedoLogGroupAttributes>

   </StorageAttributes>

</DatabaseTemplate>

-bash-3.2$

======================================================================

 

-bash-3.2$ dbca -silent -generateScripts -templateName orcl.dbt -gdbName orcl -scriptDest /u01/app/oracle/admin/orcl/scripts

Database creation script generation

1% complete

4% complete

5% complete

9% complete

10% complete

11% complete

13% complete

15% complete

17% complete

18% complete

20% complete

22% complete

29% complete

36% complete

43% complete

45% complete

48% complete

50% complete

51% complete

56% complete

59% complete

60% complete

72% complete

73% complete

75% complete

77% complete

81% complete

86% complete

87% complete

91% complete

95% complete

100% complete

Look at the log file "/u01/app/oracle/db112/assistants/dbca/templates/orcl.log" for further details.

-bash-3.2$

 

cd /u01/app/oracle/admin/orcl/scripts

./orcl.sh

 

-bash-3.2$ ./orcl.sh

You should Add this entry in the /var/opt/oracle/oratab: orcl:/u01/app/oracle/db112:Y

 

SQL*Plus: Release 11.2.0.2.0 Production on Mon Jun 17 14:08:47 2013

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

Enter new password for SYS:oracle

Enter new password for SYSTEM:oracle

 

Enter password for SYS:oracle

 

Connected to an idle instance.

SQL> spool /u01/app/oracle/db112/assistants/dbca/templates/CreateDB.log append

SQL> startup nomount pfile="/u01/app/oracle/db112/assistants/dbca/templates/init.ora";

 

之後會先問SYSTEM密碼...接著就放著讓它跑完...

 

#最後As Oracle , 手工建立Oracle OEM web console

export ORACLE_HOSTNAME=your_host_name

export ORACLE_UNQNAME=orcl

emca -config dbcontrol db

 

 

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...