티스토리 뷰
DBCA(Database Configuration Assistant) 템플릿은 데이터베이스를 만드는 데 필요한 정보가 포함된 XML 파일이다. 템플릿은 DBCA에서 새 데이터베이스를 만들고 기존 데이터베이스를 복제하는 데 사용된다. 템플릿의 정보에는 데이터베이스 옵션, 초기화 매개변수 및 스토리지 속성(데이터 파일, 테이블스페이스, 제어 파일 및 온라인 리두 로그 파일용)이 포함된다. 아래는 ORACLE_HOME/assistances/dbca/templates 라는 디렉토리에 있는 General_Purpose.dbc 템플릿의 예이다.
<?xml version = '1.0'?>
<DatabaseTemplate name="General Purpose" description=" " version="19.0.0.0.0">
<CommonAttributes>
<option name="OMS" value="true" includeInPDBs="true"/>
<option name="JSERVER" value="true" includeInPDBs="true"/>
<option name="SPATIAL" value="true" includeInPDBs="true"/>
<option name="IMEDIA" value="true" includeInPDBs="true"/>
<option name="ORACLE_TEXT" value="true" includeInPDBs="true">
<tablespace id="SYSAUX"/>
</option>
<option name="SAMPLE_SCHEMA" value="false" includeInPDBs="false"/>
<option name="CWMLITE" value="true" includeInPDBs="true">
<tablespace id="SYSAUX"/>
</option>
<option name="APEX" value="false" includeInPDBs="false"/>
<option name="DV" value="true" includeInPDBs="true"/>
</CommonAttributes>
<Variables/>
<CustomScripts Execute="false"/>
<InitParamAttributes>
<InitParams>
<initParam name="db_name" 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="19.0.0"/>
<initParam name="remote_login_passwordfile" value="EXCLUSIVE"/>
<initParam name="undo_tablespace" value="UNDOTBS1"/>
<initParam name="control_files" value="("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl")"/>
<initParam name="diagnostic_dest" value="{ORACLE_BASE}"/>
<initParam name="audit_trail" value="db"/>
<initParam name="db_block_size" value="8" unit="KB"/>
<initParam name="open_cursors" value="300"/>
</InitParams>
<MiscParams>
<databaseType>MULTIPURPOSE</databaseType>
<maxUserConn>20</maxUserConn>
<percentageMemTOSGA>40</percentageMemTOSGA>
<customSGA>false</customSGA>
<dataVaultEnabled>false</dataVaultEnabled>
<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 cdb="true">seeddata</SourceDBName>
<Name id="3" Tablespace="SYSAUX" Contents="PERMANENT" Size="400" autoextend="true" blocksize="8192" con_id="1">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf</Name>
<Name id="1" Tablespace="SYSTEM" Contents="PERMANENT" Size="880" autoextend="true" blocksize="8192" con_id="1">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf</Name>
<Name id="4" Tablespace="UNDOTBS1" Contents="UNDO" Size="25" autoextend="true" blocksize="8192" con_id="1">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf</Name>
<Name id="7" Tablespace="USERS" Contents="PERMANENT" Size="5" autoextend="true" blocksize="8192" con_id="1">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf</Name>
</DataFiles>
<TempFiles>
<Name id="1" Tablespace="TEMP" Contents="TEMPORARY" Size="20" con_id="1">{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf</Name>
</TempFiles>
<ControlfileAttributes id="Controlfile">
<maxDatafiles>100</maxDatafiles>
<maxLogfiles>16</maxLogfiles>
<maxLogMembers>3</maxLogMembers>
<maxLogHistory>1</maxLogHistory>
<maxInstances>8</maxInstances>
<image name="control01.ctl" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
<image name="control02.ctl" filepath="{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/"/>
</ControlfileAttributes>
<RedoLogGroupAttributes id="1">
<reuse>false</reuse>
<fileSize unit="KB">204800</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo01.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
<RedoLogGroupAttributes id="2">
<reuse>false</reuse>
<fileSize unit="KB">204800</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo02.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
<RedoLogGroupAttributes id="3">
<reuse>false</reuse>
<fileSize unit="KB">204800</fileSize>
<Thread>1</Thread>
<member ordinal="0" memberName="redo03.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/>
</RedoLogGroupAttributes>
</StorageAttributes>
</DatabaseTemplate>
DBCA(Database Configuration Assistant) 템플릿을 사용하면 다음과 같은 이점이 있다.
시간 절약. 템플릿을 사용하는 경우 데이터베이스를 정의할 필요가 없다.
쉬운 복제. 데이터베이스 설정이 포함된 템플릿을 생성하면 매개변수를 두 번 지정하지 않고도 복제 데이터베이스를 쉽게 생성할 수 있다.
쉬운 편집. 템플릿 설정에서 데이터베이스 옵션을 빠르게 변경할 수 있다.
쉬운 공유. 템플릿은 한 컴퓨터에서 다른 컴퓨터로 복사할 수 있다.
다음 코드는 pdbseed.xml 이다.
<?xml version="1.0" encoding="UTF-8"?>
<PDB>
<xmlversion>1</xmlversion>
<pdbname>PDB$SEED</pdbname>
<cid>2</cid>
<byteorder>1</byteorder>
<vsn>318767104</vsn>
<vsns>
<vsnnum>19.0.0.0.0</vsnnum>
<cdbcompt>19.0.0.0.0</cdbcompt>
<pdbcompt>19.0.0.0.0</pdbcompt>
<vsnlibnum>0.0.0.0.24</vsnlibnum>
<vsnsql>24</vsnsql>
<vsnbsv>8.0.0.0.0</vsnbsv>
</vsns>
<dbid>3619743411</dbid>
<ncdb2pdb>0</ncdb2pdb>
<cdbid>39496799</cdbid>
<guid>86B637B62FE07A65E053F706E80A27CA</guid>
<uscnbas>1918383</uscnbas>
<uscnwrp>0</uscnwrp>
<undoscn>280</undoscn>
<rdba>4194824</rdba>
<tablespace>
<name>SYSTEM</name>
<type>0</type>
<tsn>0</tsn>
<status>1</status>
<issft>0</issft>
<isnft>0</isnft>
<encts>0</encts>
<flags>0</flags>
<bmunitsize>8</bmunitsize>
<file>
<path>/oradata/SEEDDATA/pdbseed/system01.dbf</path>
<afn>2</afn>
<rfn>1</rfn>
<createscnbas>280</createscnbas>
<createscnwrp>0</createscnwrp>
<status>1</status>
<fileblocks>33280</fileblocks>
<blocksize>8192</blocksize>
<vsn>318767104</vsn>
<fdbid>3619743411</fdbid>
<fcpsb>1918377</fcpsb>
<fcpsw>0</fcpsw>
<frlsb>1</frlsb>
<frlsw>0</frlsw>
<frlt>1005785759</frlt>
<autoext>1</autoext>
<maxsize>4194302</maxsize>
<incsize>1280</incsize>
<plugscn>0</plugscn>
<plugafn>0</plugafn>
<plugdbid>0</plugdbid>
</file>
</tablespace>
<tablespace>
<name>SYSAUX</name>
<type>0</type>
<tsn>1</tsn>
<status>1</status>
<issft>0</issft>
<isnft>0</isnft>
<encts>0</encts>
<flags>0</flags>
<bmunitsize>8</bmunitsize>
<file>
<path>/oradata/SEEDDATA/pdbseed/sysaux01.dbf</path>
<afn>4</afn>
<rfn>4</rfn>
<createscnbas>5499</createscnbas>
<createscnwrp>0</createscnwrp>
<status>1</status>
<fileblocks>32000</fileblocks>
<blocksize>8192</blocksize>
<vsn>318767104</vsn>
<fdbid>3619743411</fdbid>
<fcpsb>1918377</fcpsb>
<fcpsw>0</fcpsw>
<frlsb>1</frlsb>
<frlsw>0</frlsw>
<frlt>1005785759</frlt>
<autoext>1</autoext>
<maxsize>4194302</maxsize>
<incsize>1280</incsize>
<plugscn>0</plugscn>
<plugafn>0</plugafn>
<plugdbid>0</plugdbid>
</file>
</tablespace>
<tablespace>
<name>UNDOTBS1</name>
<type>2</type>
<tsn>2</tsn>
<status>1</status>
<issft>0</issft>
<isnft>0</isnft>
<encts>0</encts>
<flags>0</flags>
<bmunitsize>8</bmunitsize>
<file>
<path>/oradata/SEEDDATA/pdbseed/undotbs01.dbf</path>
<afn>9</afn>
<rfn>9</rfn>
<createscnbas>1917835</createscnbas>
<createscnwrp>0</createscnwrp>
<status>1</status>
<fileblocks>12800</fileblocks>
<blocksize>8192</blocksize>
<vsn>318767104</vsn>
<fdbid>3619743411</fdbid>
<fcpsb>1918377</fcpsb>
<fcpsw>0</fcpsw>
<frlsb>1</frlsb>
<frlsw>0</frlsw>
<frlt>1005785759</frlt>
<autoext>1</autoext>
<maxsize>4194302</maxsize>
<incsize>640</incsize>
<plugscn>0</plugscn>
<plugafn>0</plugafn>
<plugdbid>0</plugdbid>
</file>
</tablespace>
<tablespace>
<name>TEMP</name>
<type>1</type>
<tsn>3</tsn>
<status>1</status>
<issft>0</issft>
<isnft>0</isnft>
<encts>0</encts>
<flags>0</flags>
<bmunitsize>128</bmunitsize>
<file>
<path>/oradata/SEEDDATA/pdbseed/temp01.dbf</path>
<afn>2</afn>
<rfn>1</rfn>
<createscnbas>7255</createscnbas>
<createscnwrp>0</createscnwrp>
<status>1</status>
<fileblocks>4608</fileblocks>
<blocksize>8192</blocksize>
<vsn>318767104</vsn>
<autoext>1</autoext>
<maxsize>4194302</maxsize>
<incsize>80</incsize>
<plugscn>0</plugscn>
<plugafn>0</plugafn>
<plugdbid>0</plugdbid>
</file>
</tablespace>
<recover>0</recover>
<optional>
<ncdb2pdb>0</ncdb2pdb>
<csid>1</csid>
<ncsid>2000</ncsid>
<options>
<option>APS=19.0.0.0.0</option>
<option>CATALOG=19.0.0.0.0</option>
<option>CATJAVA=19.0.0.0.0</option>
<option>CATPROC=19.0.0.0.0</option>
<option>CONTEXT=19.0.0.0.0</option>
<option>DV=19.0.0.0.0</option>
<option>JAVAVM=19.0.0.0.0</option>
<option>OLS=19.0.0.0.0</option>
<option>ORDIM=19.0.0.0.0</option>
<option>OWM=19.0.0.0.0</option>
<option>SDO=19.0.0.0.0</option>
<option>XDB=19.0.0.0.0</option>
<option>XML=19.0.0.0.0</option>
<option>XOQ=19.0.0.0.0</option>
</options>
<olsoid>0</olsoid>
<dv>0</dv>
<APEX>NULL</APEX>
<parameters>
<parameter>processes=300</parameter>
<parameter>large_pool_size=67108864</parameter>
<parameter>java_pool_size=218103808</parameter>
<parameter>nls_language='AMERICAN'</parameter>
<parameter>nls_territory='AMERICA'</parameter>
<parameter>db_block_size=8192</parameter>
<parameter>compatible='19.0.0'</parameter>
<parameter>job_queue_processes=0</parameter>
<parameter>open_cursors=300</parameter>
<parameter>pga_aggregate_target=67108864</parameter>
<parameter>statistics_level='BASIC'</parameter>
<parameter>enable_pluggable_database=TRUE</parameter>
<spfile>*.db_securefile='PREFERRED'</spfile>
<spfile>*.undo_tablespace='UNDOTBS1'#flag:1,</spfile>
</parameters>
<sqlpatches/>
<tzvers>
<tzver>primary version:32</tzver>
<tzver>secondary version:0</tzver>
</tzvers>
<walletkey>0</walletkey>
<services/>
<opatches/>
<hasclob>1</hasclob>
<awr>
<loadprofile>db block changes=401.569620</loadprofile>
<loadprofile>execute count=12.500000</loadprofile>
<loadprofile>logons cumulative=3.000000</loadprofile>
<loadprofile>parse count (hard)=2.500000</loadprofile>
<loadprofile>parse count (total)=19.000000</loadprofile>
<loadprofile>physical reads=205.556962</loadprofile>
<loadprofile>physical writes=3.989568</loadprofile>
<loadprofile>redo size=65387.645570</loadprofile>
<loadprofile>session logical reads=23.000000</loadprofile>
<loadprofile>user calls=14.000000</loadprofile>
<loadprofile>user commits=1.949367</loadprofile>
<loadprofile>user rollbacks=0.037975</loadprofile>
</awr>
<hardvsnchk>0</hardvsnchk>
<localundo>1</localundo>
<apps/>
<dbedition>8</dbedition>
<dvopsctl>2</dvopsctl>
<clnupsrcpal>1</clnupsrcpal>
</optional>
</PDB>
DBCA 템플릿에는 Seed, Nonseed 두가지 타입이 있다.
타입 | 파일 확장자 | 데이터 파일 포함 | 데이터베이스 구조 |
시드 | .dbc | Yes | 기존 DB의 구조,물리적 데이터 파일 모두 포함. 필요 변경 사항은, DB명 데이터 파일의 대상 컨트롤 파일 수 온라인 리두 로그 그룹 수 파라미터 초기화 |
넌시드 (Nonseed) | .dbt | No | 이 유형의 템플릿은 새 데이터베이스를 만드는 데 사용된다. 생성할 데이터베이스의 특성을 포함한다. Nonseed 템플릿은 모든 데이터 파일과 온라인 리두 로그 파일이 사양에 맞게 생성되고 필요에 따라 이름, 크기 및 기타 속성이 변경될 수 있기 때문에 Seed 템플릿보다 더 유연하다. |
일반적인 템플릿 파일의 디렉토리 경로와 포함된 템플릿:
[oracle@enp0s3 templates]$ pwd
/u01/app/oracle/product/19.0.0/dbhome_1/assistants/dbca/templates
[oracle@enp0s3 templates]$ ls -la
합계 370968
drwxr-xr-x. 2 oracle oinstall 4096 11월 9 15:06 .
drwxr-xr-x. 5 oracle oinstall 62 11월 9 15:06 ..
-rw-r-----. 1 oracle oinstall 4888 4월 17 2019 Data_Warehouse.dbc
-rw-r-----. 1 oracle oinstall 4768 4월 17 2019 General_Purpose.dbc
-rw-r-----. 1 oracle oinstall 10772 4월 6 2019 New_Database.dbt
-rw-r-----. 1 oracle oinstall 18726912 4월 17 2019 Seed_Database.ctl
-rw-r-----. 1 oracle oinstall 274554880 4월 17 2019 Seed_Database.dfb
-rw-r-----. 1 oracle oinstall 86548480 4월 17 2019 pdbseed.dfb
-rw-r-----. 1 oracle oinstall 6611 4월 17 2019 pdbseed.xml
시드 데이터베이스의 데이터 파일은 확장자가 .dfb인 파일에 압축된 RMAN 백업 형식으로 저장된다. 위 ls 명령어로 볼 수 있듯 용량이 크고 같은 이름의 .ctl 확장자나 .dfb 확장자가 존재한다. .ctl 파일은 시드 데이터베이스 제어 파일이다. 이 파일은 ASM에 저장하거나 Managed Files에 저장할 때만 필요하다. .dbc 파일에는 시드 데이터베이스 파일 위치가 포함된다. 컨트롤 파일을 ㅁ운트 하는데 필요한 소스 데이터베이스 이름도 포함된다.