docker mac m1 oracle-12c
1、
docker pull truevoly/oracle-12c
2、
docker run -d -p 8061:8080 -p 1521:1521 truevoly/oracle-12c
3、docker ps -a
[root@VM_0_2_centos data_temp]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6f1c2f5372b5 truevoly/oracle-12c "/entrypoint.sh " 9 minutes ago Up 9 minutes 0.0.0.0:1521->1521/tcp, 0.0.0.0:8080->8080/tcp orac
d9fe468f1d89 mysql:5.7 "docker-entrypoint.s…" 2 hours ago Up 17 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql
4、
docker exec -it 6f1c2f5372b5 /bin/bash
5、
sqlplus system/oracle@//localhost:1521/xe
6、执行:sqlplus /nolog
输入:connect sys as sysdba;
输入:connect sys as sysdba;
输入密码:oracle
7、
select status from v$instance; alter user system identified by oracle;
重新sqlplus登陆输入修改后的system oralce密码新建用户
8、新建用户create user 账户 identified by 密码:
create user testlu identified by LuQAZwsx;
GRANT CONNECT, RESOURCE, DBA TO testlu;
9、授权:
grant create session to testlu; grant connect,resource to testlu;
10、使用以下命令获取安装的数据库的服务名称。默认是XE
select value from v$parameter where name='service_names';
--首先查询一下用户的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 hysjy identified by 123456; -- 查询所有用户 SELECT * FROM ALL_USERS; -- 创建账户 create user hysjy identified by 123456; GRANT CONNECT, RESOURCE, DBA TO hysjy; -- 给用户授予权限 grant create session to hysjy; grant connect,resource to hysjy; -- 解除锁定 alter user hysjy account unlock; commit;