赞
踩
version: '3.7' services: oracle_11g: image: registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g container_name: oracle_11g environment: - TZ=Asia/Shanghai volumes: - /etc/localtime:/etc/localtime:ro - ./data/oracle:/data/oracle - ./data/profile:/etc/profile ports: - 1521:1521 privileged: true user: root restart: always command: /bin/bash -c "ln -s $ORACLE_HOME/bin/sqlplus /usr/bin" deploy: resources: limits: memory: 2G reservations: memory: 500M networks: application: aliases: - net-oracle_11g networks: application: name: net driver: bridge
docker-compose up -d
docker exec -it oracle_11g bash
sqlplus /nolog
如果没有 进行一下操作
vi /etc/profile
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
然后在执行 source /etc/profile 使配置生效
最后方便使用创建软连接 ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
su - oracle
sqlplus /nolog --登录
startup; --启动数据库,注意第一次进入才执行
conn /as sysdba --连接数据库
alter user system identified by system;–修改system用户账号密码;
alter user sys identified by system;–修改sys用户账号密码;
create user test identified by test; – 创建内部管理员账号密码;
grant connect,resource,dba to test; --将dba权限授权给内部管理员账号和密码;
alter profile default limit password_life_time unlimited; --修改密码规则策略为密码永不过期;
alter system set processes=1000 scope=spfile; --修改数据库最大连接数据;
修改以上信息后,需要重新启动数据库
conn /as sysdba
shutdown immediate; --关闭数据库
startup; --启动数据库
exit:退出软链接
alter system set local_listener=‘(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))’; – 然后重启,如果执行不成也退出
然后退出SQL页面在执行
lsnrctl start #开启监听
dbstart # 启动用户实例
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。