oracle23安装并 配置内网代理(安装nginx oracle23)

发布时间:2023年12月21日

安装nginx步奏如下

1.安装所需依赖

yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel automake autoconf libtool make

2. 解压nginx压缩包,进入解压后的nginx目录

tar -xvf ./nginx-1.24.0.tar.gz

cd ./nginx

3. 以下编译命令中增加模块有,ssl支持 stream支持,需要其他的模块可以自行添加即可。这里配置安装目录为/usr/local/nginx

# 编译
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream

# 安装
make && make install

  1. 进入安装目录
cd /usr/local/nginx
  1. 启动
./sbin/nginx -c ./conf/nginx.conf

  1. 常用命令
# 启动nginx
./sbin/nginx -c ./conf/nginx.conf
# 停止
./sbin/nginx -s stop
# 修改配置文件后重新加载配置文件
# 检测配置文件是否有错
./sbin/nginx -t
# 重新加载配置
./sbin/nginx -s reload

以上配置oracle代理时候可能会出现
unknown directive “stream” in /usr/local/nginx/conf/nginx.conf 报错

解决办法如下

进入nginx文件解压目录,进行编译、安装,通过添加–with-stream参数指定安装stream模块。

[root@localhost nginx-1.12.2]# ./configure --with-stream
[root@localhost nginx-1.12.2]# make & make install

再次检查nginx.conf配置文件,确认配置无语法错误后,再次尝试启动服务。

[root@localhost sbin]# ./nginx

安装oracle23 教程如下

1.1. docker pull container-registry.oracle.com/database/free:latest

2. mkdir -p /home/mymount/oracle23c/oradata

3. # 授权,不授权会导致后面安装失败

chmod 777 /home/mymount/oracle23c/oradata

4.3. #racle_SID是用来唯一标识一个Oracle实例的,确保了在同一台服务器上不存在SID冲突的情况,也方便了在多台服务器上进行数据库管理。

docker run -d  \
-p 1522:1521 -p 5501:5500 \
-e ORACLE_PDB=PDB \
-e ORACLE_PWD=123456 \
-e ORACLE_EDITION=standard \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-v /home/mymount/oracle23c/oradata:/opt/oracle/oradata \
--name oracle23 \
container-registry.oracle.com/database/free:latest
  1. 查看是否启动成功
docker  logs  -tf  oracle23

6.进入容器

docker exec -it oracle23 bash

7.启动oracle

输入sqlplus   然后会提示你输入账号密码 或者直接输入
sqlplus / as sysdba

8.查询有哪些pdb库

select name,open_mode from v$pdbs;

9.然后切换到除了pdb开头的数据库

alter session set container=FREEPDB1;

10 .查找用户

select userName from dba_users;

11查看有哪些表空间

select tableSpace_name from Dba_tablespaces;

12 删除用户以及表结构(参照:https://blog.csdn.net/daxiang52/article/details/50408312)

drop user ZS_EDU cascade;
  1. 创建临时表空间
create temporary tablespace eduTem tempfile '/opt/oracle/oradata6' size 50m autoextend on next 50m maxsize 20480m extent management local;

14创建表空间(查看有哪些表空间select tableSpace_name from Dba_tablespaces;)

create tablespace edu logging datafile '/opt/oracle/oradata7' size 50m autoextend on next 50m maxsize 20480m extent management local;

17 删除表空间 Oracle删除表空间语法结构:(https://www.php.cn/faq/489137.html)

drop tablespace tab_name [including contents][cascade constraints]

案例、删除student表空间,并删除表空间的数据文件和完整性
drop tablespace student including contents cascade constraints;
  1. 创建用户并指定表空间
create user zs_edu identified by zsShang default tablespace edu temporary tablespace eduTem;
  1. 给用户授权
grant connect,resource,dba to 用户名;

以下场景适用于只开放了一个端口9003的情况下需要来回切换端口(以下为nginx配置代理oracle)

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

stream {
        upstream oracle {

        server 128.0.0.1:1522 weight=1 max_fails=2 fail_timeout=30s;

    }

   server {

        listen       9003;

        proxy_connect_timeout 1s;

        proxy_timeout 3s;

        proxy_pass oracle;

      }

 }
http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

#gzip  on;






    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
  #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


     server {
        listen       19003;
        server_name  localhost;

        charset utf-8;

        location /edu-evaluate {
      proxy_pass  http://localhost:8080/renren-admin/;
        }
        location / {
            alias   /home/edu/edu-evaluate-vue/dist/;
            index  index.html index.htm;
        }

    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
 

如何连接代理后的oracle

在这里插入图片描述

文章来源:https://blog.csdn.net/m0_52946104/article/details/135097928
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。