當前位置:首頁 > IT技術(shù) > 數(shù)據(jù)庫 > 正文

rpm安裝21c單實例數(shù)據(jù)庫
2021-09-17 11:44:16

linux 7.6 使用rpm安裝21c單實例數(shù)據(jù)庫

一、基礎環(huán)境配置

1.1 關(guān)閉防火墻

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

1.2 關(guān)閉selinux

vim /etc/selinux/config
SELINUX=disabled

1.3 配置yum源

vi /etc/yum.repo.d/server.repo
[rhel7.6-media]
name=Redhat-$releasever - Media
baseurl=file:///media/cdrom/
gpgcheck=0
enabled=1  

1.4 安裝預安裝包

1.4.1 下載預安裝包

wget https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm

1.4.2 安裝預安裝包

yum install -y oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm

二、安裝Oracle 21c

2.1 下載Oracle 21c安裝包

wget https://download.oracle.com/otn/linux/oracle21c/oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm?AuthParam=1631846224_40c7d9730ae05c710cac67aeceed000c

2.2 安裝Oracle 21c

yum  install -y oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
[root@ora21crpm soft]# yum  install oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Examining oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm: oracle-database-ee-21c-1.0-1.x86_64
Marking oracle-database-ee-21c-1.0-1.ol7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-21c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================
 Package                                      Arch                         Version                        Repository                                                      Size
===============================================================================================================================================================================
Installing:
 oracle-database-ee-21c                       x86_64                       1.0-1                          /oracle-database-ee-21c-1.0-1.ol7.x86_64                       7.1 G

Transaction Summary
===============================================================================================================================================================================
Install  1 Package

Total size: 7.1 G
Installed size: 7.1 G
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : oracle-database-ee-21c-1.0-1.x86_64                                                                                                                         1/1 
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-21c configure
  Verifying  : oracle-database-ee-21c-1.0-1.x86_64                                                                                                                         1/1 

Installed:
  oracle-database-ee-21c.x86_64 0:1.0-1                                                                                                                                        

Complete!

2.3 創(chuàng)建ora21c數(shù)據(jù)庫及創(chuàng)建ora21cpdb

2.3.1 拷貝配置文件

cp /etc/init.d/oracledb_ORCLCDB-21c /etc/init.d/oracledb_ora21c-21c
cp /etc/sysconfig/oracledb_ORCLCDB-21c.conf /etc/sysconfig/oracledb_ora21c-21c.conf

2.3.2 修改配置文件

vi /etc/init.d/oracledb_ora21c-21c
# DB defaults
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
export ORACLE_SID=ora21c
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=ora21cpdb
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

2.3.3 創(chuàng)建數(shù)據(jù)庫

/etc/init.d/oracledb_ora21c-21c configure
[root@ora21crpm soft]# /etc/init.d/oracledb_ora21c-21c configure
Configuring Oracle Database ora21c.
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/ora21c.
Database Information:
Global Database Name:ora21c
System Identifier(SID):ora21c
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ora21c/ora21c.log" for further details.

Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.

2.4 配置環(huán)境變量

vi  /home/oracle/.bash_profile
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1
export PATH=$PATH:/opt/oracle/product/21c/dbhome_1/bin
export ORACLE_SID=ora21c

2.5 連接到數(shù)據(jù)庫

[oracle@ora21crpm ~]$ sqlplus  / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Thu Sep 16 23:10:20 2021
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle.  All rights reserved.


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      ora21c
db_unique_name                       string      ora21c
global_names                         boolean     FALSE
instance_name                        string      ora21c
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      ora21c
SQL> 

本文摘自 :https://www.cnblogs.com/

開通會員,享受整站包年服務立即開通 >