alias grid_env='export ORACLE_HOME=$GRID_HOME;export ORACLE_SID=+ASM;export PATH=$GRID_HOME/bin:$PATH' alias db_env='export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1;export ORACLE_SID=orcl' alias ss='sqlplus / as sysdba' alias oh='cd $ORACLE_HOME' alias gh='cd $GRID_HOME' ===== oracle bash profile =====
This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hitting <ENTER> without typing an answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle Default group to own the driver interface []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done [root@asmtest oracle]#
[root@asmtest oracle]# oracleasm init Creating /dev/oracleasm mount point: /dev/oracleasm Loading module "oracleasm": oracleasm Configuring "oracleasm" to use device physical block size Mounting ASMlib driver filesystem: /dev/oracleasm [root@asmtest oracle]# oracleasm status Checking if ASM is loaded: yes Checking if /dev/oracleasm is mounted: yes [root@asmtest oracle]# oracleasm configure ORACLEASM_ENABLED=true ORACLEASM_UID=oracle ORACLEASM_GID=asmadmin ORACLEASM_SCANBOOT=true ORACLEASM_SCANORDER="" ORACLEASM_SCANEXCLUDE="" ORACLEASM_SCAN_DIRECTORIES="" ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false" [root@asmtest oracle]#
- FDISK
디스크 추가 전
[root@asmtest dev]# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2
ASM 에서 사용할 디스크그룹을 아래와 같이 추가하자
- crs1,2,3 : asm 파일용, 대충 각 1G - data : database 용, 최소 20G - reco : recovery 영역, 대충 5G
VM관리자에서 설정 클릭
* 디스크는 online 상에선 추가가 안되고 vm 이 down 된 상태에서 가능하다. 처음부터 준비하면 좋다.
오라클 엔진을 설치하고 나서 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