ローカル管理 orcl
bigfile PROD1
OMF PROD2
CDB PROD3
mkdir -p /oradata/orcl
chown -R oracle: /oradata
vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=7000M 0 0
df -h
umount /dev/shm
mount /dev/shm
df -h
su - oracle
vim ~/.bashrc
alias orcl='export ORACLE_SID=orcl'
alias PROD1='export ORACLE_SID=PROD1'
alias PROD2='export ORACLE_SID=PROD2'
alias PROD3='export ORACLE_SID=PROD3'
alias cdh='cd $ORACLE_HOME'
alias cdb='cd $ORACLE_BASE'
alias sql='sqlplus / as sysdba'
. ~/.bashrc
cdh
cd dbs
export ORACLE_SID=orcl
vim initorcl.ora
db_name='orcl'
memory_target=1G
db_domain='example.com'
control_files = ('/oradata/orcl/control01.ctl','/oradata/orcl/control02.ctl')
sqlplus / as sysdba
startup nomount;
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/orcl/redo01a.log','/oradata/orcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/oradata/orcl/redo02a.log','/oradata/orcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/oradata/orcl/redo03a.log','/oradata/orcl/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/oradata/orcl/system01.dbf'
SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/oradata/orcl/sysaux01.dbf'
SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/oradata/orcl/users01.dbf'
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oradata/orcl/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/oradata/orcl/undo01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE '/oradata/orcl/usertbs01.dbf'
SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
----
mkdir /oradata/PROD1
export ORACLE_SID=PROD1
cdh
cd dbs
vim initPROD1.ora
db_name='PROD1'
memory_target=1G
db_domain='example.com'
control_files = ('/oradata/PROD1/control01.ctl','/oradata/PROD1/control02.ctl')
sqlplus / as sysdba
startup nomount;
CREATE DATABASE PROD1
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/PROD1/redo01a.log','/oradata/PROD1/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/oradata/PROD1/redo02a.log','/oradata/PROD1/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/oradata/PROD1/redo03a.log','/oradata/PROD1/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
set default bigfile tablespace
EXTENT MANAGEMENT LOCAL
DATAFILE '/oradata/PROD1/system01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/oradata/PROD1/sysaux01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/oradata/PROD1/users01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oradata/PROD1/temp01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/oradata/PROD1/undo01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE '/oradata/PROD1/usertbs01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
----
mkdir /oradata/PROD2
export ORACLE_SID=PROD2
cdh
cd dbs
vim initPROD2.ora
db_name='PROD2'
memory_target=1G
db_domain='example.com'
control_files = ('/oradata/PROD2/control01.ctl','/oradata/PROD2/control02.ctl')
DB_CREATE_FILE_DEST='/oradata/PROD2'
sqlplus / as sysdba
startup nomount;
CREATE DATABASE PROD2
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undo
DEFAULT TABLESPACE users;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
----
mkdir -p /oradata/PROD3
mkdir -p /oradata/PROD3/pdbseed
export ORACLE_SID=PROD3
export NLS_LANG=American_America.AL32UTF8
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
cdh
cd dbs
vim initPROD3.ora
DB_NAME=PROD3
DB_DOMAIN=example.com
CONTROL_FILES=('/oradata/PROD3/control01.ctl','/oradata/PROD3/control02.ctl')
ENABLE_PLUGGABLE_DATABASE=true
MEMORY_TARGET=1G
sqlplus / as sysdba
startup nomount;
CREATE DATABASE PROD3
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/oradata/PROD3/redo01a.log','/oradata/PROD3/redo01b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/oradata/PROD3/redo02a.log','/oradata/PROD3/redo02b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/oradata/PROD3/redo03a.log','/oradata/PROD3/redo03b.log')
SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/oradata/PROD3/system01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/oradata/PROD3/sysaux01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/oradata/PROD3/users01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oradata/PROD3/temp01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/oradata/PROD3/undo01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT = ('/oradata/PROD3/',
'/oradata/PROD3/pdbseed/')
SYSTEM DATAFILES SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE '/oradata/PROD3/pdbseed/usertbs01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
-- 対話的
@?/rdbms/admin/catcdb.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
conn / as sysdba
create spfile from pfile;
shutdown immediate;
startup;
----