[root@jemora11204 /]# su - oracle[oracle@jemora11204 ~]$ lsnrctl start
[oracle@jemora11204 ~]$ sqlplus / as sysdba
SYS@JEM11G2> startup
SYS@JEM11G2>select * from v$version;
1.5 外部连接容器内的数据库
sqlplus sys/jem@192.168.1.54:21521/JEM11GR2 AS SYSDBA
注意:此处访问宿主机端口为21521,容器内部是1521,端口映射,系统管理员密码为jem
1.6 修改配置
docker run -itd--name oracle11204 -h oracle11204 --privileged=true -p1521:1521 -p222:22 -p21158:1158 xingyuyu123/oracle:oracle11204 init
#那么现在的容器名称就是oracle11204,但是配置文件不是需要修改[root@api-new local]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
697f19ec9a76 xingyuyu123/oracle:oracle11204 "init"21 minutes ago Up 21 minutes 0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:222->22/tcp, :::222->22/tcp, 0.0.0.0:21158->1158/tcp, :::21158->1158/tcp oracle11204
[root@api-new local]# #进入容器dockerexec-it oracle11204 bash# 修改root以及oralce口令echo root |passwd root --stdinecho oracle |passwd oracle --stdin# 修改主机名su - oracle#修改listener.ora(将HOST后面修改为容器名称)vim /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS =(PROTOCOL = IPC)(KEY = EXTPROC1521))(ADDRESS =(PROTOCOL = TCP)(HOST = oracle11204)(PORT =1521))))ADR_BASE_LISTENER = /u01/app/oracle#修改tnsnames.ora(将HOST后面修改为容器名称),这里的orcl是已经修改过的服务名vim /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora
orcl =(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = oracle11204)(PORT =1521))(CONNECT_DATA =(SERVER = DEDICATED)#(SERVICE_NAME = JEM11GR2)(SERVICE_NAME = orcl)))#修改服务名
sqlplus / as sysdba或者sqlplus sys/jem as sysdba
#查看当前服务名
show parameter service_name
#修改服务名
alter system setservice_names='orcl'scope=both;#修改tnsnames.ora(将HOST后面修改为容器名称),这里的orcl是已经修改过的服务名vim /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora
orcl =(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST = oracle11204)(PORT =1521))(CONNECT_DATA =(SERVER = DEDICATED)#(SERVICE_NAME = JEM11GR2)(SERVICE_NAME = orcl)))#修改两处#修改sys密码
ALTER USER sys IDENTIFIED BY system;#验证密码是否修改成功exit
sqlplus sys/new_password as sysdba
1.7 数据库密码过期的方法
select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME';#显示结果是密码的生命周期是180天。
若要将其设置为生命周期无限制可以执行下面语句:
alter profile default limit password_life_time unlimited;
commit;#进行以上步骤之后需要改变密码,否则还会出现password has expired异常#改变密码的命令
alter user XXXUSER identified by yourPassword;#如果账号被锁住,则需要解锁命令
alter user XXXUSER identified by oracle account unlock;
2.部署Oracle 12CR2环境(12.2.0.1)
docker pull registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora12c_12201#docker tag registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora12c_12201 oracle:oracle12201docker tag registry.cn-shanghai.aliyuncs.com/techerwang/oracle:ora12c_12201 jemora12c:12201#docker run -itd --name oracle12201 -h oracle12201 --privileged=true -p 1521:1521 -p 422:22 -p 15500:5500 -p 15501:5501 oracle:oracle12201 initdocker run -itd--name jemora1221 -h jemora1221 --privileged=true -p41521:1521 -p422:22 -p15500:5500 -p15501:5501 jemora12c:12201 initdockerexec-it jemora1221 bashsu - oraclelsnrctl startsqlplus / as sysdbastartupselect * from v$version;默认服务名:jem sys/jem
# 1.前提是安装好docker# 2.拉取镜像(该镜像是我修改过的,可以直接使用)[root@api-new local]# docker pull xingyuyu123/oracle:oracle12201
oracle11204: Pulling from xingyuyu123/oracle
5dd797628260: Pull complete
ea1a739ab78d: Pull complete
593d06e585fc: Pull complete
12ad75124c46: Pull complete
edfb37612170: Pull complete
ad7a03f14bef: Pull complete
Digest: sha256:a597bdb0523ffb4cf3cee677269f8dba5555d38441f1e819fed06a1c845c0c7e
Status: Downloaded newer image for xingyuyu123/oracle:oracle12201
docker.io/xingyuyu123/oracle:oracle12201
[root@api-new local]#[root@api-new local]# docker images[root@api-new local]# docker run -itd --name oracle12201 -h oracle12201 --privileged=true -p 1522:1521 -p 222:22 -p 21158:1158 xingyuyu123/oracle:oracle12201 init
697f19ec9a768211a85afd958ab0a8b3fd7ea8c6aef860979f555c7e2f3ebbdc
[root@api-new local]#[root@api-new local]# docker ps#服务名:orcl或者jem#sys密码:sys/system#root用户密码:root#oracle用户密码:oracle# Tomcat配置连接
-- Multitenant Environment:多租户环境
-- CDB(Container Database):数据库容器
-- PDB(Pluggable Database):可插拔数据库
-- COMMON USERS(普通用户):经常建立在CDB层,用户名以C##或c##开头;
-- LOCAL USERS(本地用户):仅建立在PDB层,建立的时候得指定CONTAINER。
SELECT * FROM v$version;select sys_context ('USERENV', 'CON_NAME') from dual;
-- Oracle 12当中指定容器才能创建用户;查看容器
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
-- 打开pdb
alter pluggable database JEMPDB open;
-- 查看容器
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
-- 切换容器
alter session setcontainer=JEMPDB;
-- 查看当前使用容器
select sys_context ('USERENV', 'CON_NAME') from dual;
-- 创建用户
create user jkzl IDENTIFIED BY 123456;
SELECT username FROM dba_users;ALTER SESSION SET container=JEMPDB;
SELECT username FROM dba_users;select INSTANCE_NAME from v$instance;#Oracle12连接方式<dataSource><property name="driverClassName"value="oracle.jdbc.OracleDriver"></property><property name="url"value="jdbc:oracle:thin:@192.168.124.224:1522/JEMPDB"></property><property name="username"value="JKZL"></property><property name="password"value="123456"></property><property name="initSize"value="50"></property><!--初始化连接池个数--><property name="maxIdle"value="50"></property><!--最大个数--><property name="minIdle"value="20"></property><!--最小个数--><property name="maxWait"value="6000"></property><!--连接超时时间--></dataSource>#Oracle11连接方式<dataSource><property name="driverClassName"value="oracle.jdbc.OracleDriver"></property><property name="url"value="jdbc:oracle:thin:@192.168.124.224:1521:JEM11GR2"></property><property name="username"value="JKZL"></property><property name="password"value="123456"></property><property name="initSize"value="50"></property><!--初始化连接池个数--><property name="maxIdle"value="50"></property><!--最大个数--><property name="minIdle"value="20"></property><!--最小个数--><property name="maxWait"value="6000"></property><!--连接超时时间--></dataSource>#oracle11的服务名或者sid是JEM11GR2#oracle12的服务名或者sid是jem,容器的名是JEMPDB,必须先在容器当中创建本地用户才行,否则使用普通用户。
DTO(Data Transfer Object)数据传输对象
前后端之间的传输时使用
比如前端登录请求的请求参数有username,password,但后端pojo类user有username,password,birthday,gender时,可以创…
# 第一步:下载MySQL安装包 访问MySQL官方网站的[下载页面](https://dev.mysql.com/downloads/mysql/),根据你的操作系统(Windows、macOS、Linux等)选择合适的MySQL Community Server版本进行下载。对于Windows用户,可以…
2024-AIDD-人工智能药物设计设计思路-Artificial Intelligence for Drug Design
在药物设计中,特别是针对特定靶点的药物设计(AIDD,Artificial Intelligence for Drug Design),您可以遵循以下步骤: 靶点选…
定义 S G SG SG函数:
对于状态 x x x和它的所有 k k k个后继状态 y 1 , y 2 , . . . , y k y_1, y_2,...,y_k y1,y2,...,yk: S G ( x ) m e x { S G ( y 1 ) , S G ( y 2 ) , . . . , S G ( y k ) } SG(x) mex\{SG(y_1), SG(y_2), ..., SG(y_k)\} SG(x)mex…