Linux安装oracle23c

官网下载:

1. rpm包

  • oracle-database-free-23c-1.0-1.el8.x86_64.rpm
  • oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm

2. 安装依赖包

  • 上传compat-openssl10-1.0.2u-1.el9.x86_64.rpm 包并且进行安装

    • 此依赖包需要先进行安装
    rpm -ivh compat-openssl10-1.0.2u-1.el9.x86_64.rpm --force --nodeps
    
  • yum 安装依赖

    yum -y install bc binutils compat-openssl10 elfutils-libelf glibc glibc-devel ksh libaio libXrender libX11 libXau libXi libXtst libgcc libnsl libstdc++ libxcb libibverbs libasan liblsan make policycoreutils policycoreutils-python-utils smartmontools sysstat libnsl2 libnsl2-devel net-tools nfs-utils
    

3. 安装oracle

  • 将下载的 oracle-database-free-23c-1.0-1.el8.x86_64.rpm 和 oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm 上传的对应目录

(1)

curl -L -o oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm

(2)预安装

dnf -y localinstall oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm 

(3)安装oracle数据库

dnf -y localinstall oracle-database-free-23c-1.0-1.el8.x86_64.rpm

(4)修改配置文件

  • 取消 /opt/oracle/product/23c/dbhomeFree/cv/admin/cvu_config 文件中的 CV_ASSUME_DISTID 注释

    # CV_ASSUME_DISTID=OL7 
    
    修改为 
    
    CV_ASSUME_DISTID=OL7 
    

(5)初始化样例测试数据库(非必要)

/etc/init.d/oracle-free-23c configure

# 如果出现[INS-08109] Unexpected error occurred while validating inputs at state 'DBCreationOptions'. 
# 参考:
https://www.reddit.com/r/oracle/comments/wdjslm/oracle_database_21c_xe_oracle_linux_9/https://www.reddit.com/r/oracle/comments/wdjslm/oracle_database_21c_xe_oracle_linux_9/

https://logic.edchen.org/how-to-resolve-ins-08101-unexpected-error/

在/opt/oracle/product/23c/dbhomeFree/cv/admin/cvu_config中取消 CV_ASSUME_DISTID 的注释
参考just uncomment ‘CV_ASSUME_DISTID’ from this file $YOUR_ORACLE_HOME/cv/admin/cvu_config through editor

(5)切换oracle用户,配置环境变量 vi ~/.bash_profile

# 切换oracle用户
su oracle

# 使用vi 文本编辑器编辑配置文件
vi ~/.bash_profile

# 填写以下内容
export ORACLE_SID=FREE
export ORAENV_ASK=NO
export ORACLE_HOME=/opt/oracle/product/23c/dbhomeFree
export PATH=$ORACLE_HOME/bin:$PATH

# 刷新配置文件
source ~/.bash_profile

2. 启动停止Oracle23C

1. 启动监听

# 切换oracle用户
su oracle

# 启动监听
lsnrctl start

2. 查看监听状态

lsnrctl status

3. 连接数据库

sqlplus / as sysdba

4. 启动数据库

# 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

startup;

5. 停止数据库

# 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

# 停止数据库
SHUTDOWN IMMEDIATE;

3. 创建表空间、表结构、用户

1. 创建表空间

# 1. 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

# 2. 表空间 test 根据实际存储路径进行修改:/home/oracle/data/
create tablespace test datafile '/home/oracle/data/test' size 10000m autoextend off
extent management local 
segment space management auto;

* 删除表空间(如果需要删除表空间则执行)

```shell
# 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

# 查询表空间
SELECT tablespace_name FROM dba_tablespaces;

# 删除表空间 A
DROP TABLESPACE A INCLUDING CONTENTS;

2. 创建用户

# 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

# 创建用户 user123
create user user123 identified by user123 default tablespace test temporary tablespace temp;

3. 用户授权

# 如果未进入sqlplus 需要先进入
sqlplus / as sysdba

grant resource,connect to user123; 
grant create  view to user123;
grant create database link to user123; 
grant create synonym to user123;
grant unlimited TABLESPACE to user123; 
grant DBA  to user123;
grant  SELECT_CATALOG_ROLE to user123; 
grant select any table to user123 ;
grant create session to user123;
posted on 2023-08-25 14:05  秃头靓仔-001  阅读(575)  评论(0编辑  收藏  举报