생계/Oracle2022. 12. 22. 21:10

오라클 엔진을 설치하고 나서 dbca 로 간단하게 데이터베이스를 생성할수도 있지만
CREATE DATABASE 구문으로 DB 를 생성할수도 있다. 

1. CREATE DB

export ORACLE_SID=ORCL;
export DB_NAME=ORCL;

--shutdown immediate;
sqlplus / as sysdba
startup mount exclusive restrict
drop database;

-- pfile 은 사전에 준비되어있어야 한다.
startup nomount pfile='initORCL.ora'

CREATE DATABASE ORCL
user sys identified by oracle
user system identified by oracle
CONTROLFILE REUSE
LOGFILE
GROUP 1 ('+DATA') SIZE 10M REUSE,
GROUP 2 ('+DATA') SIZE 10M REUSE
DATAFILE '+DATA' SIZE 10G AUTOEXTEND ON MAXSIZE 30G
DEFAULT TABLESPACE USERS DATAFILE '+DATA' SIZE 10G AUTOEXTEND ON MAXSIZE 30G
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA' SIZE 10G AUTOEXTEND ON MAXSIZE 30G
UNDO TABLESPACE UNDOTBS DATAFILE '+DATA' SIZE 10G AUTOEXTEND ON MAXSIZE 30G
CHARACTER SET AL32UTF8
;

alter database mount;
alter database open;

2. DICTIONARY, 후속작업 

수동으로 디비를 생성하고 open 했지만 깡통 디비이기에 할수 있는게 없다.
후속으로 아래 스크립트를 실행하자.

conn sys/oracle as sysdba
SQL>@?/rdbms/admin/catalog.sql
-- Creates the data dictionary and public synonyms for many of its views, and grants PUBLIC access to the synonyms; also calls the scripts CATAUDIT.SQL, CATESP.SQL, and CATLDR.SQL

SQL>@?/rdbms/admin/catproc.sql
-- Runs all scripts required for or used with PL/SQL: CATPRC.SQL, CATRSNAP.SQL, CATRPC.SQL, STANDARD.SQL, DBMSSTDX.SQL, PIPDL.SQL, PIDIAN.SQL, DIUTIL.SQL, PISTUB.SQL, DBMSSNAP.SQL, DBMSLOCK.SQL, DBMSPIPE.SQL, DBMSALRT.SQL, SBMSOTPT.SQL, DBMSDESC.SQL

SQL>@?/sqlplus/admin/pupbld.sql
-- re-create the PRODUCT_USER_PROFILE table
SQL> @?/rdbms/admin/utlrp.sql
-- recompiles invalid objects


3. CRS등록

srvctl add database -db orcl
-oraclehome "오라클홈경로"
-spfile  "SPFILE경로"
-diskgroup "

srvctl config database -db orcl

.control_files='',"",""
create spfile from pfile

4. LISTENER, TNS 추가

 

반응형
Posted by 돌고래트레이너