作者:手机用户2702932960 | 来源:互联网 | 2023-10-13 09:36
官方文档https:docs.oracle.comendatabaseoracleoracle-database12.2adminmanaging-a-multitenant-en
官方文档
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/managing-a-multitenant-environment.html#GUID-93F1E584-D309-4301-82E0-AD0E60D4977C
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ladbi/installing-the-oracle-preinstallation-rpm-with-uln-support.html#GUID-AF94713E-97AF-4F20-8DBC-36BC383D0301
wget http://yum.oracle.com/public-yum-ol7.repo
wget http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum install oracle-database-server-12cR2-preinstall.x86_64 --nogpgcheck
https://www.howtoforge.com/tutorial/how-to-install-oracle-database-12c-on-centos-7/
[root@bogon ~]# systemctl stop firewalld
[root@bogon ~]# systemctl disable firewalld
[root@bogon ~]# systemctl status firewalld
[root@linux01 ~]#vi /etc/selinux/config #This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
12c安装
1.
yum -y install binutils elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh compat-libcap1 libXext* libXtst* libX11* libXau* libxcb* libXi* nscd* libXp* xorg* xterm* unzip* readline* compat*
yum install libXext.i686 -y
yum install zlib-devel.i686 -y
2. 创建必要?户:
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -u 54321 -g oinstall -G dba,oper oracle
3.修改密码
passwd oracle
4.关闭防?墙
[root@bogon ~]# systemctl stop firewalld
[root@bogon ~]# systemctl disable firewalld
[root@bogon ~]# systemctl status firewalld
5.创建?录
mkdir -p /u01/app/oracle/product/12.2.0.1/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01
6. oracle 用户下
编辑环境变量
[oracle@localhost ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=vdedu
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=vdedu
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
root用户
7. 编辑/etc/hosts [root@bogon ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.80.157 vdedu
~
8. 下载oracle12c安装包
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/oracle12c-linux-12201-3608234.html?ssSourceSiteId=otncn
传到虚拟机/u01 下
9. oracle用户下解压 linuxx64_12201_database.zip
[oracle@localhost u01]$ unzip linuxx64_12201_database.zip
10.准备安装
su - oracle
export DISPLAY=:0.0
xhost +
11. [oracle@localhost database]$ cd /u01/database
[oracle@localhost database]$ ./runInstaller
12. 配置监听netca
13. dbca 创建数据库
cd $ORACLE_HOME/network/admin
cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdedu)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0.1/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_VDEDU =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdedu)(PORT = 1521))
VDEDU =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdedu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vdedu)
)
)
PDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vdedu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vdedu)
)
)
show con_name;查看当前
show pdbs; 容器个数
desc v$containers;
启动PDB
alter pluggable database pdb open;
alter pluggable database pdb close immediate;
进入pdb
alter session set container=pdb;
sqlplus sys/oracle@PDB as sysdba;
cdb/ 下只能创建comm user
create user c##us identified by oracle;
pdb 普通用户
create user n identified by o;
监听注册
conn / as sysdba
show parameter common_
alter system set loca_listener=' ';
创建表空间
select file_name, tablespace_name from dba_data_files;
create tablespace tbs01 datafile '/u01/....../tabs0101.dbf' size 10M autoextend on extent management local autoallocate;
create tablespace temp tempfile '/u01/app/oracle/oradata/VDEDU/temp01.dbf' size 100m autoextend on;
create tablespace add tempfile &#39;<路径和文件名>&#39; size <文件名> [autoextend on];