docker快速安装Oracle11g

1.下载镜像 

docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g

2.创建快速搭建脚本build.sh

#!/bin/bash
#启动镜像
containId=`docker ps -a |grep -i oracle11g|awk '{print $1}'`
FDIR=$(dirname $(readlink -f "$0"))
if [[ ! $containId ]] ;then
        echo "target container not exist!"
else
        echo "target container exist , ID = "$containId
        docker stop $containId
        docker rm $containId
        echo "success delete container "$containId
fi

docker run -d -p 1521:1521  -v $FDIR/data/oracle:/data/oracle  --name oracle11g --restart always  registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g
sleep 3
docker logs -f --tail 100 oracle11g

3.启动脚本并进入容器进行配置

sh build.sh

docker exec -it oracle11g bash

 root密码:helowin

su - root

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 

conn /as sysdba;

修改密码:
alter user system identified by system;
alter user sys identified by sys;
alter profile default limit password_life_time unlimited;

创建用户:
create user test identified by test;

并给用户赋予权限:
grant connect,resource,dba to test;

用户解锁:
alter user test account unlock;

自动增加表空间容量:
alter tablespace users add datafile '/home/oracle/app/oracle/oradata/helowin/users02.dbf' size 10240m autoextend on next 1024m maxsize unlimited;

扩大共享内存:
alter system set SHARED_POOL_SIZE='150M' SCOPE=spfile;

shutdown immediate;

startup;

4.登录信息

5.常见问题解决

①ORA-09925
df -ih 发现Inodes空间不足:删除日志等文件for i in /*; do echo $i; find $i | wc -l; done
清理adump目录
find /home/oracle/app/oracle/admin/helowin/adump -name '*.aud' -mtime +3 -exec rm -rf {} \;
清理trace文件
find /home/oracle/app/oracle/diag/rdbms/helowin/helowin/trace -name '*.trc' -mtime +3 -exec rm -rf {} \;
find /home/oracle/app/oracle/diag/rdbms/helowin/helowin/trace -name '*.trm' -mtime +3 -exec rm -rf {} \;
清理xml日志
find /home/oracle/app/oracle/diag/rdbms/helowin/helowin/alert -name 'log_*.xml' -mtime +3 -exec rm -rf {} \;
清理监听日志
find /home/oracle/app/oracle/diag/tnslsnr/{NODE_NAME}/listener/alert -name 'log_*.xml' -mtime +3 -exec rm -rf {} \;

②关闭归档日志

#查看是否是归档方式
archive log list; 
#禁用自动归档
alter system set log_archive_start=false scope=spfile; 
shutdown immediate;
打开控制文件,不打开数据文件
startup mount; #
#将数据库切换为非归档模式
alter database noarchivelog; 
#将数据文件打开
alter database open; 
#查看此时便处于非归档模式
archive log list; 

③设置归档日志

#查询归档文件大小;
show parameter DB_RECOVERY_FILE_DEST_SIZE;
select * from v$flash_recovery_area_usage;
#设置归档文件大小;
alter system set db_recovery_file_dest_size=30737418240;
删除归档文件
rman target /
delete archivelog until time 'sysdate-5';

④禁止系统用户外部登录

#显示外部登录方式

show PARAMETER REMOTE_LOGIN_PASSWORD;

#设置禁止外部登录

alter system set remote_login_passwordfile=none scope=spfile;

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值