(12cR1)
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export NLS_LANG=Japanese_Japan.AL32UTF8
export PATH=$PATH:$ORACLE_HOME/bin
mkdir -p /u01/app/oracle/oradata/orcl
vim $ORACLE_HOME/dbs/initorcl.ora
db_name='orcl'
memory_target=800M
db_domain='example.com'
control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/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 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/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 '/u01/app/oracle/oradata/orcl/system01.dbf'
SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/u01/app/oracle/oradata/orcl/undo01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE '/u01/app/oracle/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
conn / as sysdba
create spfile from pfile;
shutdown immediate;
startup;
(19c)
-- 従来の方法(非CDB)
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export NLS_LANG=Japanese_Japan.AL32UTF8
export PATH=$PATH:$ORACLE_HOME/bin
mkdir -p /u01/app/oracle/oradata/orcl
vim $ORACLE_HOME/dbs/initorcl.ora
db_name='orcl'
memory_target=800M
db_domain='example.com'
control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/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 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/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 '/u01/app/oracle/oradata/orcl/system01.dbf'
SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
SIZE 50M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/u01/app/oracle/oradata/orcl/undo01.dbf'
SIZE 20M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE '/u01/app/oracle/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
conn / as sysdba
create spfile from pfile;
shutdown immediate;
startup;
-- 従来の方法(CDB)
vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=1200M 0 0
df -h
umount /dev/shm
mount /dev/shm
df -h
su - oracle
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export NLS_LANG=Japanese_Japan.AL32UTF8
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
mkdir -p /u01/app/oracle/oradata/orcl
mkdir -p /u01/app/oracle/oradata/orcl/pdbseed
vim $ORACLE_HOME/dbs/initorcl.ora
db_name='orcl'
memory_target=1G
db_domain='example.com'
control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl')
ENABLE_PLUGGABLE_DATABASE=true
sqlplus / as sysdba
startup nomount;
-- CREATE DATABASE orcl
-- USER SYS IDENTIFIED BY oracle
-- USER SYSTEM IDENTIFIED BY oracle
-- LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log')
-- SIZE 100M BLOCKSIZE 512,
-- GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log')
-- SIZE 100M BLOCKSIZE 512,
-- GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/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 '/u01/app/oracle/oradata/orcl/system01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
-- SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
-- DEFAULT TABLESPACE users
-- DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
-- DEFAULT TEMPORARY TABLESPACE temp
-- TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
-- UNDO TABLESPACE undo
-- DATAFILE '/u01/app/oracle/oradata/orcl/undo01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
-- ENABLE PLUGGABLE DATABASE
-- SEED
-- FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/orcl/',
-- '/u01/app/oracle/oradata/orcl/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 '/u01/app/oracle/oradata/orcl/pdbseed/usertbs01.dbf'
-- SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/oradata/orcl/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 '/u01/app/oracle/oradata/orcl/system01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/u01/app/oracle/oradata/orcl/undo01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
ENABLE PLUGGABLE DATABASE
seed file_name_convert=(
'/u01/app/oracle/oradata/orcl/system01.dbf','/u01/app/oracle/oradata/orcl/pdbseed/system01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf','/u01/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/temp01.dbf','/u01/app/oracle/oradata/orcl/pdbseed/temp01.dbf',
'/u01/app/oracle/oradata/orcl/undo01.dbf','/u01/app/oracle/oradata/orcl/pdbseed/undo01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf','/u01/app/oracle/oradata/orcl/pdbseed/users01.dbf'
)
LOCAL UNDO ON
;
★対話的に入力必要
--
@?/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;
-- PDBの作成
show con_name
select * from V$PDBS;
select * from cdb_pdbs;
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdbadm IDENTIFIED BY oracle
FILE_NAME_CONVERT= ('/u01/app/oracle/oradata/orcl/pdbseed/', '/u01/app/oracle/oradata/orcl/pdb1/');
alter pluggable database pdb1 open;
(19c)
-- rpmによるインストール
cat /etc/oraInst.loc
ll -d /opt/oracle/product/19c/dbhome_1
cat /etc/sysconfig/oracledb_ORCLCDB-19c.conf
/etc/init.d/oracledb_ORCLCDB-19c configure
su - oracle
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus / as sysdba
---- 簡略版
cd $ORACLE_HOME/dbs
vim initorcl2.ora
db_name=orcl2
control_files = (ora_control1, ora_control2)
memory_target=600M
export ORACLE_SID=orcl2
sqlplus /nolog
conn / as sysdba
startup nomount;
create database;
alter user sys identified by oracle;
alter user system identified by oracle;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
データファイルは$ORACLE_HOME/dbsに作成される
(SYSTEM,SYSAUX,UNDO表領域)
一時表領域は作成されない
(21c)
---- 従来の方法の場合(create database文を使用する場合)
https://www.dbarj.com.br/en/2020/12/how-to-create-your-21c-oracle-database/
vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=1200M 0 0
df -h
umount /dev/shm
mount /dev/shm
df -h
su - oracle
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/21.0.0/dbhome_1
export NLS_LANG=Japanese_Japan.AL32UTF8
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
mkdir -p /u01/app/oracle/oradata/orcl
mkdir -p /u01/app/oracle/oradata/orcl/pdbseed
-- orabaseconfigディレクトリの確認
orabaseconfig
cd $(orabaseconfig)
ll
vim $(orabaseconfig)/dbs/initorcl.ora
db_name='orcl'
memory_target=1G
db_domain='example.com'
control_files = ('/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl')
ENABLE_PLUGGABLE_DATABASE=true
sqlplus / as sysdba
create spfile from pfile;
startup nomount;
CREATE DATABASE orcl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log')
SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/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 '/u01/app/oracle/oradata/orcl/system01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE undo
DATAFILE '/u01/app/oracle/oradata/orcl/undo01.dbf'
SIZE 100M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/orcl/',
'/u01/app/oracle/oradata/orcl/pdbseed/')
SYSTEM DATAFILES SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
LOCAL UNDO ON
USER_DATA TABLESPACE usertbs
DATAFILE '/u01/app/oracle/oradata/orcl/pdbseed/usertbs01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
shutdown immediate;
startup upgrade;
mkdir /home/oracle/log
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catctl.pl \
-d $ORACLE_HOME/rdbms/admin \
-c 'CDB$ROOT PDB$SEED' \
-l /home/oracle/log \
catpcat.sql
shutdown immediate;
startup;
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql
-- PDBの作成
conn / as sysdba
show con_name
select * from V$PDBS;
select * from cdb_pdbs;
CREATE PLUGGABLE DATABASE pdb1 ADMIN USER pdbadm IDENTIFIED BY oracle
FILE_NAME_CONVERT= ('/u01/app/oracle/oradata/orcl/pdbseed/', '/u01/app/oracle/oradata/orcl/pdb1/');
alter pluggable database pdb1 open;
alter pluggable database pdb1 SAVE STATE;
alter session set container = pdb1;
create user test identified by test;
grant dba to test;
orabasehome
vim $(orabasehome)/network/admin/listner.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mmm067)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
lsnrctl start listener
vim $(orabasehome)/network/admin/tnsnames.ora
LISTENER_orcl=
(DESCRIPTION =
(ADDRESS=(PROTOCOL=tcp)(HOST=mmm067)(PORT=1521)))
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mmm067)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1.example.com)
)
)
alter system set local_listener=LISTENER_orcl;
show parameter listener;
sqlplus test/test@pdb1
vim $ORACLE_HOME/sqlplus/admin/glogin.sql
set lines 1000
set pages 5000
set trims on
set sqlprompt "&_connect_identifier(&_user)> "
vim ~/.bashrc
alias cdh='cd $ORACLE_HOME'
alias cdb='cd $ORACLE_BASE'
alias sql='sqlplus / as sysdba'
. .bashrc
---------------------------------------------
---- 従来の方法の場合(dbcaを使用する場合)
https://oracle-base.com/articles/21c/oracle-db-21c-installation-on-oracle-linux-8
vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=1200M 0 0
df -h
umount /dev/shm
mount /dev/shm
df -h
su - oracle
vim /home/oracle/.bash_profile
export ORACLE_SID=orcl
export ORACLE_HOME=/u01/app/oracle/product/21.0.0/dbhome_1
export NLS_LANG=Japanese_Japan.AL32UTF8
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/perl/bin/:$PATH
mkdir -p /u01/app/oracle/oradata/orcl
dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbname orcl \
-sid orcl \
-responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword oracle \
-systemPassword oracle \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword oracle \
-databaseType MULTIPURPOSE \
-memoryMgmtType AUTO \
-totalMemory 1000 \
-storageType FS \
-datafileDestination /u01/app/oracle/oradata/orcl/ \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
show con_name
select * from V$PDBS;
select * from cdb_pdbs;
alter pluggable database pdb1 open;
alter pluggable database all SAVE STATE;
alter session set container = pdb1;
create user test identified by test;
grant dba to test;
orabasehome
vim $(orabasehome)/network/admin/listner.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mmm067)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
lsnrctl start listener
vim $(orabasehome)/network/admin/tnsnames.ora
LISTENER_orcl=
(DESCRIPTION =
(ADDRESS=(PROTOCOL=tcp)(HOST=mmm067)(PORT=1521)))
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mmm067)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1)
)
)
alter system set local_listener=LISTENER_orcl;
show parameter listener;
sqlplus test/test@pdb1
vim $ORACLE_HOME/sqlplus/admin/glogin.sql
set lines 1000
set pages 5000
set trims on
set sqlprompt "&_connect_identifier(&_user)> "
vim ~/.bashrc
alias cdh='cd $ORACLE_HOME'
alias cdb='cd $ORACLE_BASE'
alias sql='sqlplus / as sysdba'
. .bashrc
---------------------------------------------
---- rpmによるインストールの場合
cat /etc/oraInst.loc
ll -d /opt/oracle/product/21c/dbhome_1
cat /etc/sysconfig/oracledb_ORCLCDB-21c.conf
/etc/init.d/oracledb_ORCLCDB-21c configure
su - oracle
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
export ORACLE_SID=ORCLCDB
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG=American_America.AL32UTF8
sqlplus / as sysdba
alter session set container = ORCLPDB1;
create user test identified by test;
grant dba to test;
orabasehome
vim /opt/oracle/homes/OraDBHome21cEE/network/admin/tnsnames.ora
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mmm148)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB1)
)
)
sqlplus test/test@pdb1
-- ★読取り専用のOracleホームの確認
orabasehome
読取り/書込みのORACLE_HOMEではORACLE_HOMEのパスと同じ
読取り専用のORACLE_HOMEではORACLE_BASE/homes/HOME_NAME
対象ファイル:ネットワークファイル (orabasehomeの下のnetwork/adminディレクトリの下に配置)
orabaseconfig
読取り/書込みのORACLE_HOMEではORACLE_HOMEのパスと同じ
読取り専用のORACLE_HOMEではORACLE_BASEと同じ
対象ファイル:pfile, spfile, パスワードファイル(orabaseconfigの下のdbsディレクトリの下に配置)
--DB確認
show databases;
--DB作成
create database test;
create database test2 character set utf8mb4;
--DB定義確認
show create database test;
\l+
create database test owner postgres;
create database test2 owner postgres template = template0 encoding = 'utf8' lc_collate = 'C' lc_ctype = 'C';
USE master;
GO
CREATE DATABASE test
ON
( NAME = test_dat,
FILENAME = 'E:\DATA\testdat.mdf',
SIZE = 10MB,
MAXSIZE = 50MB,
FILEGROWTH = 5MB )
LOG ON
( NAME = test_log,
FILENAME = 'E:\DATA\testlog.ldf',
SIZE = 5MB,
MAXSIZE = 25MB,
FILEGROWTH = 5MB ) ;
GO