当前位置:   article > 正文

linux中如何通过docker安装oracle12c_docker pull oraclelinux oracle 12c

docker pull oraclelinux oracle 12c

1、下载镜像

docker pull docker.io/truevoly/oracle-12c
  • 1

2、运行镜像

(1)创建挂载

mkdir /data/oracle/data_temp && chmod 777 /data/oracle/data_temp
  • 1

(2)运行镜像

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
  • 1

(3)查看运行日志

  • 可以通过查看日志,观察安装进度。出现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! ;)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37

3、配置oracle

# 进入容器
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

4、连接信息

账号:pt_test
密码:pt_2022
端口:1521
服务名:xe
  • 1
  • 2
  • 3
  • 4

5、常用操作

-- 查看用户的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;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

文章转载于:https://blog.csdn.net/springlustre/article/details/120330533

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/906138
推荐阅读
相关标签
  

闽ICP备14008679号