赞
踩
docker pull docker.io/truevoly/oracle-12c
mkdir /data/oracle/data_temp && chmod 777 /data/oracle/data_temp
docker run --restart always -d -p 8080:8080 -p 1521:1521 -v -v /data/oracle/data_temp:/home/oracle/data_temp -v /etc/localtime:/etc/localtime:ro --name oracle12c truevoly/oracle-12c
Database ready to use. Enjoy! ;)
表示安装成功。[root@k8s-node73 data]# docker logs -f oracle12c Database not initialized. Initializing database. Starting tnslsnr Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log" for further details. Configuring Apex console Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed Starting web management console PL/SQL procedure successfully completed. Starting import from '/docker-entrypoint-initdb.d': ls: cannot access /docker-entrypoint-initdb.d/*: No such file or directory Import finished Database ready to use. Enjoy! ;)
# 进入容器 docker exec -it oracle12c /bin/bash # 进入数据库 sqlplus /nolog # 数据库中执行一下命令 SQL> connect sys as sysdba Enter password: oracle Connected. SQL> select status from v$instance; STATUS ------------ OPEN SQL> alter user system identified by 123456; User altered. # 创建用户 SQL> create user pt_test identified by pt_2022; SQL> grant connect, resource, dba to pt_test; # 查询数据库名称 SQL> select value from v$parameter where name='service_names'; VALUE ------------- xe
账号:pt_test
密码:pt_2022
端口:1521
服务名:xe
-- 查看用户的profile类型 select username ,profile from dba_users; -- 查看制定概要文件(默认为DEFAULT)的密码有效期: select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME'; -- 然后将密码的有效期有180天设置为“无限制”; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; -- 修改密码 alter user pt_test identified by 123456; -- 查询所有用户 SELECT * FROM ALL_USERS; -- 创建账户 create user pt_test identified by 123456; GRANT CONNECT, RESOURCE, DBA TO pt_test; -- 给用户授予权限 grant create session to pt_test; grant connect,resource to pt_test; -- 解除锁定 alter user pt_test account unlock; commit;
文章转载于:https://blog.csdn.net/springlustre/article/details/120330533
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。