이 페이지의 이전 버전을 보고 있습니다. 현재 버전 보기.

현재와 비교 페이지 이력 보기

버전 1 다음 »

mkdir -p $ORACLE_BASE/admin/[DB_NAME]/scripts

 

racdb1.sh
#!/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]
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: [DB_NAME]:[DB_HOME]:Y
[DB_HOME]/bin/sqlplus /nolog @[ORACLE_BASE]/admin/[DB_NAME]/scripts/racdb1.sql

 

racdb1.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 [DB_HOME]/bin/orapwd file=[DB_HOME]/dbs/orapw[ORACLE_SID1] 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/CreateClustDBViews.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

 

CreateDB.sql
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 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

 

CreateDBFiles.sql
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

 

CreateDBCatalog.sql
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"
@[DB_HOME]/sqlplus/admin/pupbld.sql;
connect "SYSTEM"/"&&systemPassword"
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/sqlPlusHelp.log append
@[DB_HOME]/sqlplus/admin/help/hlpbld.sql helpus.sql;
spool off
spool off

 

CreateClustDBViews.sql
SET VERIFY OFF
connect "SYS"/"&&sysPassword" as SYSDBA
set echo on
spool [ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateClustDBViews.log append
@[DB_HOME]/rdbms/admin/catclust.sql;
spool off

 

lockAccount.sql
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

 

postDBCreation.sql
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
spool off
exit;

 

init.ora
##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################
 
###########################################
# Cache and I/O
###########################################
db_block_size=8192
 
###########################################
# Cluster Database
###########################################
#cluster_database=true
#remote_listener=[SCAN_NAME]:[LISTENER_PORT]
 
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
 
###########################################
# Database Identification
###########################################
db_domain=""
db_name="[DB_NAME]"
 
###########################################
# File Configuration
###########################################
control_files=('/dev/raw/raw12','/dev/raw/raw13')

 
###########################################
# Miscellaneous
###########################################
compatible=11.2.0.0.0
diagnostic_dest=[ORACLE_BASE]
memory_target=834666496
 
###########################################
# Processes and Sessions
###########################################
processes=150
 
###########################################
# Security and Auditing
###########################################
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

 

racdb2.sh
#!/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]
umask ${OLD_UMASK}
ORACLE_SID=[ORACLE_SID2]; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH; export PATH
echo You should Add this entry in the /etc/oratab: [DB_NAME]:[DB_HOME]:Y
[DB_HOME]/bin/sqlplus /nolog @[ORACLE_BASE]/admin/[DB_NAME]/scripts/racdb2.sql

 

racdb2.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 [DB_HOME]/bin/orapwd file=[DB_HOME]/dbs/orapw[ORACLE_SID2] force=y
host [GRID_HOME]/bin/setasmgidwrap o=[DB_HOME]/bin/oracle
REM host [DB_HOME]/bin/srvctl add database -d [DB_NAME] -o [DB_HOME] -p /dev/raw/raw20 -n [DB_NAME]
REM host [DB_HOME]/bin/srvctl add instance -d [DB_NAME] -i [ORACLE_SID1] -n [HOST_NAME1]
REM host [DB_HOME]/bin/srvctl add instance -d [DB_NAME] -i [ORACLE_SID2] -n [HOST_NAME2]
REM host [DB_HOME]/bin/srvctl disable database -d [DB_NAME]
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDB.sql
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBFiles.sql
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateDBCatalog.sql
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/CreateClustDBViews.sql
host echo "SPFILE='/dev/raw/raw20'" > [DB_HOME]/dbs/init[ORACLE_SID2].ora
host echo Run script "[DB_HOME]/admin/[DB_NAME]/scripts/racdb1.sh" from node "[HOST_NAME1]" if you have not already run it.
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/lockAccount.sql
REM @[ORACLE_BASE]/admin/[DB_NAME]/scripts/postDBCreation.sql

 

  • 레이블 없음