本文主要是介绍docker 安装 oracle11g,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#创建oracle11g
docker run -d --name myoracle11g -p 1522:1521 akaiot/oracle_11g
#登录到oracle,要先docker ps 查看具体的docker id
docker exec -it 22222222 bash
su root
密码:helowin
# 设置环境变量
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#切换回oracle账号
su oracle
vi ~/.bashrc
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
export ORACLE_SID=helowin
export PATH=$ORACLE_HOME/bin:$PATH
``登录oracle```bash
sqlplus /nolog
conn /as sysdba;
#创建一个dba账户
create user FLINKCDC identified by "123456";
grant connect,resource,dba to FLINKCDC;
#创建一个普通账户
create user FLINKCDC2 identified by "123456";
grant create session,execute_catalog_role,select_catalog_role to FLINKCDC2;
# 允许用户查看所有表
GRANT SELECT ANY TABLE TO FLINKCDC2;
#debezium 采集数据是需要归档及logminer查询权限
grant select any transaction,select any dictionary to FLINKCDC2;
grant select on SYSTEM.LOGMNR_COL$ to FLINKCDC2;
grant select on SYSTEM.LOGMNR_OBJ$ to FLINKCDC2;
grant select on SYSTEM.LOGMNR_USER$ to FLINKCDC2;
grant select on SYSTEM.LOGMNR_UID$ to FLINKCDC2;
grant select on V_$DATABASE to FLINKCDC2;
#需要创表权限
grant resource to FLINKCDC2;grant flashback on FLINKCDC."SYS_USER1" to FLINKCDC2;
ALTER TABLE FLINKCDC."SYS_USER1" ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
oracle开启远程访问
# 进入到listener.ora 和 tnsnames.ora 目录下
cd /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin
# 开启监听器
vi listener.ora
# 配置vi tnsnames.ora
#登录oracle
sqlplus /nolog;
#使用sysdba来登录
conn /as sysdba;
# 查看是否开启了归档日志
# 如果返回 'ARCHIVELOG',则进行用户授权步骤
# 如果返回 'NOARCHIVELOG',则执行后续归档日志启用步骤
SELECT log_mode FROM v$database;
#开启归档日志
#关闭数据库
SQL> shutdown immediate;
#开启mount状态
SQL> startup mount;
# 开启归档日志,出现Database altered. 表示开启成功
SQL> alter database archivelog;
#查看归档状态
SQL> SELECT log_mode FROM v$database;
#打开数据库,一定要执行
SQL> alter database open;
效果图:
注意事项:
- 归档日志将占用大量的磁盘空间,如磁盘空间允许,则建议调大归档日志空间。
#设置归档日志目录和大小
SQL> show parameter recoveryNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 4182M
recovery_parallelism integer 0# 修改归档目录地址
SQL> alter system set db_recovery_file_dest='/u01/app/oracle/archivelog' scope=spfile;
System altered.# 修改归档目录大小
SQL> alter system set db_recovery_file_dest_size=4096m scope=spfile;
System altered.#重启数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 499126056 bytes
Database Buffers 255852544 bytes
Redo Buffers 2707456 bytes
Database mounted.
Database opened.
SQL> show parameter recoveryNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/archivelog
db_recovery_file_dest_size big integer 4G
recovery_parallelism integer 0
这篇关于docker 安装 oracle11g的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!