버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

Database 생성

작업 스크립트 준비

코드 블럭
languagebash
titleoracle 유저로 생성
linenumberstrue
mkdir -p $ORACLE_BASE/admin/[DB_NAME]/scripts
cd $ORACLE_BASE/admin/[DB_NAME]/scripts


펼치기


서식 미적용
[oracle@racdb1 ~]$ mkdir -p $ORACLE_BASE/admin/racdb/scripts
 
[oracle@racdb1 ~]$ cd $ORACLE_BASE/admin/racdb/scripts



스크립트 생성 디렉토리를 $ORACLE_BASE 경로 아래에 생성합니다.

작업할 스크립트를 모두 이곳에 저장합니다.


코드 블럭
languagebash
titleoracle 유저로 vi racDB.sh 생성
linenumberstrue
#!/bin/sh

OLD_UMASK=`umask`
umask 0027
mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/adump
mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/dpdump
mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/hdump
mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/pfile
mkdir -p [ORACLE_BASE]/cfgtoollogs/dbca/[DB_NAME]
ssh oracle@[HOST_NAME2] "mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/adump"
ssh oracle@[HOST_NAME2] "mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/dpdump"
ssh oracle@[HOST_NAME2] "mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/hdump"
ssh oracle@[HOST_NAME2] "mkdir -p [ORACLE_BASE]/admin/[DB_NAME]/pfile"
ssh oracle@[HOST_NAME2] "mkdir -p [ORACLE_BASE]/cfgtoollogs/dbca/[DB_NAME]"
umask ${OLD_UMASK}
ORACLE_SID=[ORACLE_SID1]; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
echo You should Add this entry in the /etc/oratab: [ORACLE_SID]:[DB_HOME]:N
[DB_HOME]/bin/sqlplus /nolog @[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateRACDB.sql


펼치기


서식 미적용
#!/bin/sh
 
OLD_UMASK=`umask`
umask 0027
mkdir -p /u01/app/oracle/admin/racdb/adump
mkdir -p /u01/app/oracle/admin/racdb/dpdump
mkdir -p /u01/app/oracle/admin/racdb/hdump
mkdir -p /u01/app/oracle/admin/racdb/pfile
mkdir -p /u01/app/oracle/cfgtoollogs/dbca/racdb
ssh oracle@rac2 "mkdir -p /u01/app/oracle/admin/racdb/adump"
ssh oracle@rac2 "mkdir -p /u01/app/oracle/admin/racdb/dpdump"
ssh oracle@rac2 "mkdir -p /u01/app/oracle/admin/racdb/hdump"
ssh oracle@rac2 "mkdir -p /u01/app/oracle/admin/racdb/pfile"
ssh oracle@rac2 "mkdir -p /u01/app/oracle/cfgtoollogs/dbca/racdb":
umask ${OLD_UMASK}
ORACLE_SID=racdb1; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
echo You should Add this entry in the /etc/oratab: racdb:/u01/app/oracle/product/11.2.0/db_1:N
/u01/app/oracle/product/11.2.0/db_1/bin/sqlplus /nolog @/u01/app/oracle/admin/racdb/scripts/CreateRACDB.sql



데이터베이스 생성을 위해 필요한 디렉토리를 만들고 전체 작업을 수행할 메인 스크립트를 생성합니다.

괄호 [] 안에 표시된 변수 부분은 실제 설치할 환경에 해당되는 내용으로 수정하여 저장하도록 합니다.

[ORACLE_BASE] : 오라클 소프트웨어 설치 베이스 경로

[DB_NAME] : 데이터베이스 명

[HOST_NAME2] : 2번 노드의 서버 명

[ORACLE_SID1] : 1번 인스턴스 명

[ORACLE_SID] : 각 노드의 인스턴스 명

[DB_HOME] : 데이터베이스 소프트웨어 설치 경로


코드 블럭
titleoracle 유저로 vi CreateRACDB.sql 생성
linenumberstrue
set verify off
ACCEPT sysPassword CHAR PROMPT 'Enter new password for SYS: ' HIDE
ACCEPT systemPassword CHAR PROMPT 'Enter new password for SYSTEM: ' HIDE
host [DB_HOME]/bin/orapwd file=[DB_HOME]/dbs/orapw[ORACLE_SID1] force=y
host ssh oracle@[HOST_NAME2] "host [DB_HOME]/bin/orapwd file=[DB_HOME]/dbs/orapw[ORACLE_SID2] force=y"
host [GRID_HOME]/bin/setasmgidwrap o=[DB_HOME]/bin/oracle

host [DB_HOME]/bin/srvctl add database -d [DB_NAME] -o [DB_HOME] -p /dev/raw/raw20 -n [DB_NAME]
host [DB_HOME]/bin/srvctl add instance -d [DB_NAME] -i [ORACLE_SID1] -n [HOST_NAME1]
host [DB_HOME]/bin/srvctl add instance -d [DB_NAME] -i [ORACLE_SID2] -n [HOST_NAME2]
host [DB_HOME]/bin/srvctl disable database -d [DB_NAME]
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDB.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBFiles.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBCatalog.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateJVM.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateClustDBViews.sql
host echo "SPFILE='/dev/raw/raw20'" > [DB_HOME]/dbs/init[ORACLE_SID1].ora@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateOracleText.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateXDB.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateORDSchema.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/lockAccountCreateMultiMedia.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/postDBCreationCreateOLAP.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateSpatial.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateEMRepos.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateAPEX.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateOWB.sql
host echo "SPFILE='/dev/raw/raw20'" > [DB_HOME]/dbs/init[ORACLE_SID1].ora
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/lockAccount.sql
@[ORACLE_BASE]/admin/[DB_NAME]/scripts/postDBCreation.sql


펼치기


서식 미적용
set verify off
ACCEPT sysPassword CHAR PROMPT 'Enter new password for SYS: ' HIDE
ACCEPT systemPassword CHAR PROMPT 'Enter new password for SYSTEM: ' HIDE
host /u01/
펼치기
서식 미적용
set verify off
ACCEPT sysPassword CHAR PROMPT 'Enter new password for SYS: ' HIDE
ACCEPT systemPassword CHAR PROMPT 'Enter new password for SYSTEM: ' HIDE
host /u01/app/oracle/product/11.2.0/db_1/bin/orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwracdb1 force=y
host ssh oracle@rac2 "host /u01/app/oracle/product/11.2.0/db_1/bin/orapwd file=/u01/app/oracle/product/11.2.0/db_1/dbs/orapwracdb2 force=y"
host /u01/app/11.2.0/grid/bin/setasmgidwrap o=/u01/app/oracle/product/11.2.0/db_1/bin/oracle
hostorapwd file=/u01/app/oracle/product/11.2.0/db_1/bindbs/srvctl add database -d racdb -o orapwracdb1 force=y
host ssh oracle@rac2 "/u01/app/oracle/product/11.2.0/db_1 -p /devbin/raw/raw20 -n racdb
host orapwd file=/u01/app/oracle/product/11.2.0/db_1/bindbs/srvctl add instance -d racdb -i racdb1 -n rac1orapwracdb2 force=y"
host /u01/app/11.2.0/grid/bin/setasmgidwrap o=/u01/app/oracle/product/11.2.0/db_1/bin/oracle
host /u01/app/oracle/product/11.2.0/db_1/bin/srvctl add instancedatabase -d racdb -i racdb2 -n rac2
host o /u01/app/oracle/product/11.2.0/db_1/bin/srvctl disable database -d -p /dev/raw/raw20 -n racdb
@host /u01/app/oracle/admin/racdb/scripts/CreateDB.sql
@product/11.2.0/db_1/bin/srvctl add instance -d racdb -i racdb1 -n rac1
host /u01/app/oracle/admin/racdb/scripts/CreateDBFiles.sql
@/u01/app/oracle/admin/racdb/scripts/CreateDBCatalog.sql
@product/11.2.0/db_1/bin/srvctl add instance -d racdb -i racdb2 -n rac2
host /u01/app/oracle/admin/racdb/scripts/CreateJVMproduct/11.2.0/db_1/bin/srvctl disable database -d racdb
@/u01/app/oracle/admin/racdb/scripts/CreateDB.sql
@/u01/app/oracle/admin/racdb/scripts/CreateClustDBViewsCreateDBFiles.sql
host echo "SPFILE='/dev/raw/raw20'" > @/u01/app/oracle/admin/racdb/scripts/CreateDBCatalog.sql
@/u01/app/oracle/product/11.2.0/db_1/dbs/initracdb1.oraadmin/racdb/scripts/CreateJVM.sql
@/u01/app/oracle/admin/racdb/scripts/lockAccountCreateClustDBViews.sql
@/u01/app/oracle/admin/racdb/scripts/postDBCreation.sql

서비스에 등록하고 각각의 SQL 스크립트를 수행할 스크립트를 생성합니다.

괄호 [] 안에 표시된 변수 부분은 실제 설치할 환경에 해당되는 내용으로 수정하여 저장하도록 합니다.

[DB_HOME]

[ORACLE_SID1]

[GRID_HOME]

[DB_NAME]

[ORACLE_SID1]

[HOST_NAME1]

[ORACLE_SID2]

[HOST_NAME2]

CreateOracleText.sql
@/u01/app/oracle/admin/racdb/scripts/CreateXDB.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateORDSchema.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateMultiMedia.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateOLAP.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateSpatial.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateEMRepos.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateAPEX.sql
--@/u01/app/oracle/admin/racdb/scripts/CreateOWB.sql
host echo "SPFILE='/dev/raw/raw20'" > /u01/app/oracle/product/11.2.0/db_1/dbs/initracdb1.ora
@/u01/app/oracle/admin/racdb/scripts/lockAccount.sql
@/u01/app/oracle/admin/racdb/scripts/postDBCreation.sql



서비스에 등록하고 각각의 SQL 스크립트를 수행할 스크립트를 생성합니다.

괄호 [] 안에 표시된 변수 부분은 실제 설치할 환경에 해당되는 내용으로 수정하여 저장하도록 합니다.

[DB_HOME]

[ORACLE_SID1]

[GRID_HOME]

[DB_NAME]

[ORACLE_SID1]

[HOST_NAME1]

[ORACLE_SID2]

[HOST_NAME2]

[ORACLE_BASE]


코드 블럭
titleoracle 유저로 vi CreateDB.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDB.log append
startup nomount pfile="[ORACLE_BASE]/admin/[DB_NAME]/scripts/init.ora";
CREATE DATABASE "[DB_NAME]"
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/dev/raw/raw6' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/dev/raw/raw7' SIZE 699M AUTOEXTEND OFF
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/raw/raw9' SIZE 699M AUTOEXTEND OFF
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/raw/raw10' SIZE 699M AUTOEXTEND OFF
CHARACTER SET KO16MSWIN949
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/dev/raw/raw14') SIZE 199M,
GROUP 2 ('/dev/raw/raw15') SIZE 199M,
GROUP 3 ('/dev/raw/raw16') SIZE 199M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateDB.log append
startup nomount pfile="/u01/app/oracle/admin/racdb/scripts/init.ora";
CREATE DATABASE "racdb"
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/dev/raw/raw6' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/dev/raw/raw7' SIZE 699M AUTOEXTEND OFF
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/raw/raw9' SIZE 699M AUTOEXTEND OFF
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/raw/raw10' SIZE 699M AUTOEXTEND OFF
CHARACTER SET KO16MSWIN949
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/dev/raw/raw14') SIZE 199M,
GROUP 2 ('/dev/raw/raw15') SIZE 199M,
GROUP 3 ('/dev/raw/raw16') SIZE 199M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
spool off





코드 블럭
titleoracle 유저로 vi CreateDBFiles.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBFiles.log append
CREATE SMALLFILE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/dev/raw/raw11' SIZE 699M AUTOEXTEND OFF;
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/dev/raw/raw8' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateDBFiles.log append
CREATE SMALLFILE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/dev/raw/raw11' SIZE 699M AUTOEXTEND OFF;
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/dev/raw/raw8' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS";
spool off





코드 블럭
titleoracle 유저로 vi CreateDBCatalog.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBCatalog.log append
@[DB_HOME]/rdbms/admin/catalog.sql;
@[DB_HOME]/rdbms/admin/catblock.sql;
@[DB_HOME]/rdbms/admin/catproc.sql;
@[DB_HOME]/rdbms/admin/catoctk.sql;
@[DB_HOME]/rdbms/admin/owminst.plb;
connect "SYSTEM"/"&&systemPassword"
set echo on
@[DB_HOME]/sqlplus/admin/pupbld.sql;
@[DB_HOME]/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateDBCatalog.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catalog.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catblock.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catproc.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catoctk.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/owminst.plb;
connect "SYSTEM"/"&&systemPassword"
set echo on
@/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/pupbld.sql;
@/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateJVM.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateJVM.log append
@[DB_HOME]/javavm/install/initjvm.sql;
@[DB_HOME]/xdk/admin/initxml.sql;
@[DB_HOME]/xdk/admin/xmlja.sql;
@[DB_HOME]/rdbms/admin/catjava.sql;
@[DB_HOME]/rdbms/admin/catxdbj.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateJVM.log append
@/u01/app/oracle/product/11.2.0/db_1/javavm/install/initjvm.sql;
@/u01/app/oracle/product/11.2.0/db_1/xdk/admin/initxml.sql;
@/u01/app/oracle/product/11.2.0/db_1/xdk/admin/xmlja.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catjava.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catxdbj.sql;
spool off
[ORACLE_BASE]





코드 블럭
titleoracle 유저로 vi CreateDBCreateClustDBViews.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDB.log append
startup nomount pfile="[ORACLE_BASE]/admin/[DB_NAME]/scripts/init.ora";
CREATE DATABASE "[DB_NAME]"
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/dev/raw/raw6' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/dev/raw/raw7' SIZE 699M AUTOEXTEND OFF
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/raw/raw9' SIZE 699M AUTOEXTEND OFF
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/raw/raw10' SIZE 199M AUTOEXTEND OFF
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/dev/raw/raw14') SIZE 199M,
GROUP 2 ('/dev/raw/raw15') SIZE 199M,
GROUP 3 ('/dev/raw/raw16') SIZE 199M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPasswordCreateClustDBViews.log append
@[DB_HOME]/rdbms/admin/catclust.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateClustDBViews.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catclust.sql;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateOracleText.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateOracleText.log append
@[DB_HOME]/ctx/admin/catctx [PASSWORD] SYSAUX TEMP NOLOCK;
connect "CTXSYS"/"[PASSWORD]"
@[DB_HOME]/ctx/admin/defaults/dr0defin.sql "KOREAN";
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateOracleText.log append
@/u01/app/oracle/product/11.2.0/db_1/ctx/admin/catctx change_on_install SYSAUX TEMP NOLOCK;
connect "CTXSYS"/"change_on_install"
spool @/u01/app/oracle/admin/racdb/scripts/CreateDB.log append
startup nomount pfile="/u01/app/oracle/admin/racdb/scripts/init.ora";
CREATE DATABASE "racdb"
MAXINSTANCES 32
MAXLOGHISTORY 1
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/dev/raw/raw6' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/dev/raw/raw7' SIZE 699M AUTOEXTEND OFF
SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/raw/raw9' SIZE 699M AUTOEXTEND OFF
SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/raw/raw10' SIZE 199M AUTOEXTEND OFF
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
LOGFILE GROUP 1 ('/dev/raw/raw14') SIZE 199M,
GROUP 2 ('/dev/raw/raw15') SIZE 199M,
GROUP 3 ('/dev/raw/raw16') SIZE 199M
USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";
spool offproduct/11.2.0/db_1/ctx/admin/defaults/dr0defin.sql "KOREAN";
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateXDB.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateXDB.log append
@[DB_HOME]/rdbms/admin/catqm.sql [PASSWORD] SYSAUX TEMP YES;
connect "SYS"/"&&sysPassword" as SYSDBA
@[DB_HOME]/rdbms/admin/catxdbj.sql;
@[DB_HOME]/rdbms/admin/catrul.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateXDB.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catqm.sql change_on_install SYSAUX TEMP YES;
connect "SYS"/"&&sysPassword" as SYSDBA
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catxdbj.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catrul.sql;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateORDSchema
코드 블럭
titleoracle 유저로 vi CreateDBFiles.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBFilesCreateORDSchema.log append
CREATE SMALLFILE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/dev/raw/raw11' SIZE 699M AUTOEXTEND OFF;
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/dev/raw/raw8' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS"@[DB_HOME]/ord/admin/ordinst.sql SYSAUX SYSAUX;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateDBFilesCreateORDSchema.log append
CREATE SMALLFILE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/dev/raw/raw11' SIZE 699M AUTOEXTEND OFF;
CREATE SMALLFILE TABLESPACE "USERS" LOGGING DATAFILE '/dev/raw/raw8' SIZE 699M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT  AUTO;
ALTER DATABASE DEFAULT TABLESPACE "USERS"@/u01/app/oracle/product/11.2.0/db_1/ord/admin/ordinst.sql SYSAUX SYSAUX;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateMultiMedia.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateMultiMedia.log append
@[DB_HOME]/ord/im/admin/iminst.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateMultiMedia.log append
@/u01/app/oracle/product/11.2.0/db_1/ord/im/admin/iminst.sql;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateDBCatalogCreateOLAP.sql 생성
linenumberstrue
linenumberstrue
SET VERIFY OFFSET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBCatalogCreateOLAP.log append
@[DB_HOME]/rdbms/admin/catalog.sql;connect "SYS"/"&&sysPassword" as SYSDBA
@[DB_HOME]/rdbmsolap/admin/catblockolap.sql SYSAUX TEMP;
@[DB_HOME]/rdbms/admin/catproc.sql;
@[DB_HOME]/rdbms/admin/catoctk.sql;
@[DB_HOME]/rdbms/admin/owminst.plb;
connect "SYSTEM
spool off


펼치기


서식 미적용
SET VERIFY OFF
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateOLAP.log append
connect "SYS"/"&&
systemPassword
sysPassword"
set
 
echo
as 
on
SYSDBA
@
[DB_HOME]/sqlplus
/u01/app/oracle/product/11.2.0/db_1/olap/admin/
pupbld
olap.sql
; @[DB_HOME]/sqlplus/admin/help/hlpbld.sql helpus.sql; spool off
펼치기
 SYSAUX TEMP;
spool off





noformat
코드 블럭
languagebash
titleoracle 유저로 vi CreateSpatial.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool 
/u01/app/oracle/admin/racdb
[ORACLE_BASE]/admin/[DB_NAME]/scripts/
CreateDBCatalog
CreateSpatial.log append
@
/u01/app/oracle/product/11.2.0/db_1/rdbms
[DB_HOME]/md/admin/
catalog
mdinst.sql;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool @/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catblock.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catproc.sql;admin/racdb/scripts/CreateSpatial.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbmsmd/admin/catoctkmdinst.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/owminst.plb;spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateEMRepos.sql 생성
linenumberstrue
SET VERIFY OFF
connect "
SYSTEM
SYS"/"&&
systemPassword
sysPassword" as SYSDBA
set echo 
on @/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/pupbld.sql; @/u01/app/oracle/product/11.2.0/db_1/sqlplus/admin/help/hlpbld.sql helpus.sql
off
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateEMRepos.log append
@[DB_HOME]/sysman/admin/emdrep/sql/emreposcre [DB_HOME] SYSMAN &&sysPassword TEMP ON;
WHENEVER SQLERROR CONTINUE;
spool off


true
펼치기


서식 미적용
코드 블럭
languagebash
titleoracle 유저로 vi CreateJVM.sql 생성
linenumbers
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo 
on
off
spool 
[ORACLE_BASE]
/u01/app/oracle/admin/
[DB_NAME]
racdb/scripts/
CreateJVM
CreateEMRepos.log append
@
[DB_HOME]/javavm/install/initjvm.sql; @[DB_HOME]/xdk/admin/initxml.sql; @[DB_HOME]/xdk/admin/xmlja.sql; @[DB_HOME]/rdbms/admin/catjava.sql; @[DB_HOME]/rdbms/admin/catxdbj.sql; spool off
펼치기
/u01/app/oracle/product/11.2.0/db_1/sysman/admin/emdrep/sql/emreposcre /u01/app/oracle/product/11.2.0/db_1 SYSMAN &&sysPassword TEMP ON;
WHENEVER SQLERROR CONTINUE;
spool off





noformat
코드 블럭
languagebash
titleoracle 유저로 vi CreateAPEX.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool 
/u01/app/oracle
[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateAPEX.log append
@[DB_HOME]/apex/catapx.sql [PASSWORD] SYSAUX SYSAUX TEMP /i/ NONE;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool racdb/scripts/CreateJVM.log append
@/u01/app/oracle/product/11.2.0/db_1/javavm/install/initjvm.sql;
@/u01/app/oracle/product/11.2.0/db_1/xdk/admin/initxml.sql;
@/u01/app/oracle/product/11.2.0/db_1/xdk/admin/xmlja.sql;
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catjava.sql;admin/racdb/scripts/CreateAPEX.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbmsapex/admin/catxdbj.sqlcatapx.sql change_on_install SYSAUX SYSAUX TEMP /i/ NONE;
spool off





코드 블럭
languagebash
titleoracle 유저로 vi CreateClustDBViewsCreateOWB.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateClustDBViewsCreateOWB.log append
@[DB_HOME]/rdbmsowb/adminUnifiedRepos/catclustcat_owb.sql SYSAUX TEMP;
spool off


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/CreateClustDBViewsCreateOWB.log append
@/u01/app/oracle/product/11.2.0/db_1/rdbmsowb/adminUnifiedRepos/catclustcat_owb.sql SYSAUX TEMP;
spool off





코드 블럭
titleoracle 유저로 vi lockAccount.sql 생성
linenumberstrue
SET VERIFY OFF
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/lockAccount.log append
BEGIN
 FOR item IN ( SELECT USERNAME FROM DBA_USERS WHERE ACCOUNT_STATUS IN ('OPEN', 'LOCKED', 'EXPIRED') AND USERNAME NOT IN ('SYS','SYSTEM') )
 LOOP
  dbms_output.put_line('Locking and Expiring: ' || item.USERNAME);
  execute immediate 'alter user ' ||
         sys.dbms_assert.enquote_name(
         sys.dbms_assert.schema_name(
         item.USERNAME),false) || ' password expire account lock' ;
 END LOOP;
END;
/
spool off


펼치기


서식 미적용
SET VERIFY OFF
set echo on
spool /u01/app/oracle/admin/racdb/scripts/lockAccount.log append
BEGIN
 FOR item IN ( SELECT USERNAME FROM DBA_USERS WHERE ACCOUNT_STATUS IN ('OPEN', 'LOCKED', 'EXPIRED') AND USERNAME NOT IN ('SYS','SYSTEM') )
 LOOP
  dbms_output.put_line('Locking and Expiring: ' || item.USERNAME);
  execute immediate 'alter user ' ||
         sys.dbms_assert.enquote_name(
         sys.dbms_assert.schema_name(
         item.USERNAME),false) || ' password expire account lock' ;
 END LOOP;
END;
/
spool off





코드 블럭
titleoracle 유저로 vi postDBCreation.sql 생성
linenumberstrue
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/postDBCreation.log append
execute DBMS_AUTO_TASK_ADMIN.disable();
@[DB_HOME]/rdbms/admin/catbundle.sql psu apply;
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;
select group# from v$log where group# =3;
select group# from v$log where group# =4;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 ('/dev/raw/raw17') SIZE 199M,
 GROUP 5 ('/dev/raw/raw18') SIZE 199M,
 GROUP 6 ('/dev/raw/raw19') SIZE 199M;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
host echo cluster_database=true >>[ORACLE_BASE]/admin/[DB_NAME]/scripts/init.ora;
host echo remote_listener=[SCAN_NAME]:[LISTENER_PORT]>>[ORACLE_BASE]/admin/[DB_NAME]/scripts/init.ora;
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
create spfile='/dev/raw/raw20' FROM pfile='[ORACLE_BASE]/admin/[DB_NAME]/scripts/init.ora';
shutdown immediate;
host [DB_HOME]/bin/srvctl enable database -d [DB_NAME];
host [DB_HOME]/bin/srvctl start database -d [DB_NAME];
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
@[DB_HOME]/rdbms/admin/utlrp.sql;
spool off
exit;


펼치기


서식 미적용
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool /u01/app/oracle/admin/racdb/scripts/postDBCreation.log append
execute DBMS_AUTO_TASK_ADMIN.disable();
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle.sql psu apply;
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;
select group# from v$log where group# =3;
select group# from v$log where group# =4;
ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 4 ('/dev/raw/raw17') SIZE 199M,
 GROUP 5 ('/dev/raw/raw18') SIZE 199M,
 GROUP 6 ('/dev/raw/raw19') SIZE 199M;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
host echo cluster_database=true >>/u01/app/oracle/admin/racdb/scripts/init.ora;
host echo remote_listener=rac-scan:1521>>/u01/app/oracle/admin/racdb/scripts/init.ora;
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
create spfile='/dev/raw/raw20' FROM pfile='/u01/app/oracle/admin/racdb/scripts/init.ora';
shutdown immediate;
host /u01/app/oracle/product/11.2.0/db_1/bin/srvctl enable database -d racdb;
host /u01/app/oracle/product/11.2.0/db_1/bin/srvctl start database -d racdb;
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/utlrp.sql;
spool off
exit;





코드 블럭
titleoracle 유저로 vi init.ora 생성
linenumberstrue
db_block_size=8192
#cluster_database=true
#remote_listener=[SCAN_NAME]:[LISTENER_PORT]
open_cursors=300
db_domain=""
db_name="[DB_NAME]"
control_files=('/dev/raw/raw12','/dev/raw/raw13')
compatible=11.2.0.0.0
diagnostic_dest=[ORACLE_BASE]
memory_target=834666496
processes=150
audit_file_dest="[ORACLE_BASE]/admin/[DB_NAME]/adump"
audit_trail=db
remote_login_passwordfile=exclusive
 
[ORACLE_SID1].instance_number=1
[ORACLE_SID2].instance_number=2
[ORACLE_SID1].thread=1
[ORACLE_SID2].thread=2
[ORACLE_SID1].undo_tablespace=UNDOTBS1
[ORACLE_SID2].undo_tablespace=UNDOTBS2

db_recovery_file_dest_size=3G
db_recovery_file_dest='/FRA'


펼치기


서식 미적용
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################
 
###########################################
# Cache and I/O
###########################################
db_block_size=8192
 
###########################################
# Cluster Database
###########################################
#cluster_database=true
#remote_listener=rac-scan:1521
 
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
 
###########################################
# Database Identification
###########################################
db_domain=""
db_name="racdb"
 
###########################################
# File Configuration
###########################################
control_files=('/dev/raw/raw12','/dev/raw/raw13')

 
###########################################
# Miscellaneous
###########################################
compatible=11.2.0.0.0
diagnostic_dest=/u01/app/oracle
memory
sga_target=3g
pga_aggregate_target=8346664961g
 
###########################################
# Processes and Sessions
###########################################
processes=150
 
###########################################
# Security and Auditing
###########################################
audit_file_dest="/u01/app/oracle/admin/racdb/adump"
audit_trail=db
remote_login_passwordfile=exclusive
 
racdb1.instance_number=1
racdb2.instance_number=2
racdb1.thread=1
racdb2.thread=2
racdb1.undo_tablespace=UNDOTBS1
racdb2.undo_tablespace=UNDOTBS2





코드 블럭
languagebash
titleoracle 유저로 수행
linenumberstrue
chmod 774 racDB.sh
ls -ltra | grep racDB.sh


펼치기


서식 미적용
[oracle@racdb1 racdb1:/u01/app/oracle/admin/racdb/scripts]$> ls -ltra | grep racDB.sh
-rwrwxr-r-x-r--. 1 oracle oinstall  557 2019-04-07 19:05891  4월 14 10:39 racDB.sh

[oracle@racdb1 racdb1:/u01/app/oracle/admin/racdb/scripts]$> chmod 774 racDB.sh

[oracle@racdb1 racdb1:/u01/app/oracle/admin/racdb/scripts]$> ls -ltra | grep racDB.sh
-rwxrwxr--. 1 oracle oinstall  891  557 2019-04-07 19:054월 14 10:39 racDB.sh





코드 블럭
languagebash
titleroot 유저로 1번 노드에서 수행
linenumberstrue
chmod 770 [ORACLE_BASE]/cfgtoollogs


펼치기


서식 미적용
[root@rac1 oracle]# chmod 770 /u01/app/oracle/cfgtoollogs




데이터베이스 생성

코드 블럭
languagebash
titleoracle 유저에서 수행
linenumberstrue
cd $ORACLE_BASE/admin/[DB_NAME]/scripts
sh racDB.sh


펼치기


서식 미적용
[oracle@racdb1 ~]$ cd $ORACLE_BASE/admin/racdb/scripts

[oracle@racdb1 racdb1:/u01/app/oracle/admin/racdb/scripts]$> sh racDB.sh 
You should Add this entry in the /etc/oratab: racdb:/u01/app/oracle/product/11.2.0/db_1:N

SQL*Plus: Release 11.2.0.4.0 Production on MonTue Apr 814 1415:3826:0919 20192020

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

Enter new password for SYS: 
Enter new password for SYSTEM: 

Enter password for SYS: 


Enter password for SYS: oracle

Unable to find error file.






Connected to an idle instance.
SQL> spool /u01/app/oracle/admin/racdb/scripts/CreateDB.log append
SQL> startup nomount pfile="/u01/app/oracle/admin/racdb/scripts/init.ora";
ORACLE instance started.

Total System Global Area  830930944 bytes
Fixed Size                  22578003206836224 bytes
VariableFixed Size    2257520 bytes
Variable Size       490736760654314896 bytes
Database Buffers          335544320 2533359616 bytes
Redo Buffers                2392064 16904192 bytes
SQL> CREATE DATABASE "racdb"
  2  MAXINSTANCES 32
  3  MAXLOGHISTORY 1
  4  MAXLOGFILES 192
  5  MAXLOGMEMBERS 3
  6  MAXDATAFILES 1024
  7  DATAFILE '/dev/raw/raw6' SIZE 699M1000M AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL
  8  SYSAUX DATAFILE '/dev/raw/raw7' SIZE 699M1000M AUTOEXTEND OFF
  9  SMALLFILE DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/raw/raw9' SIZE 699M AUTOEXTEND OFF
 10  SMALLFILE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/raw/raw10' SIZE 199M1000M AUTOEXTEND OFF
 11  CHARACTER SET AL32UTF8KO16MSWIN949
 12  NATIONAL CHARACTER SET AL16UTF16
 13  LOGFILE GROUP 1 ('/dev/raw/raw14') SIZE 199M,
 14  GROUP 2 ('/dev/raw/raw15') SIZE 199M,
 15  GROUP 3 ('/dev/raw/raw16') SIZE 199M
 16  USER SYS IDENTIFIED BY "&&sysPassword" USER SYSTEM IDENTIFIED BY "&&systemPassword";

Database created.
 
.... << 생략 >> ....
 
SQL>
SQL> Rem =====================================================================
SQL> Rem Run component validation procedure
SQL> Rem =====================================================================
SQL>
SQL> EXECUTE dbms_registry_sys.validate_components;

PL/SQL procedure successfully completed.

SQL> SET serveroutput off
SQL>
SQL>
SQL> Rem ===========================================================================
SQL> Rem END utlrp.sql
SQL> Rem ===========================================================================
SQL> spool off
not spooling currently
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
펼치기
title설치 로그 예제...

CreateDB.log

CreateDBFiles.log

CreateDBCatalog.log

CreateJVM.log

CreateClustDBViews.log

lockAccount.log

postDBCreation.log

racDB.log





코드 블럭
languagebash
titleroot 유저로 모든 노드의 vi /etc/oratab 에 추가
linenumberstrue
[ORACLE_SID]:[DB_HOME]:N


펼치기


서식 미적용
racdb1:/u01/app/oracle/product/11.2.0/db_1:N


서식 미적용
racdb2:/u01/app/oracle/product/11.2.0/db_1:N