oracle 常见操作

2021-05-20  本文已影响0人  akka9
# 登录
docker login container-registry.oracle.com

# 下载 19.3 最新版
docker pull container-registry.oracle.com/database/enterprise:19.3.0.0


# docker-compose.yml
version: "2.4"


services:

  oracle:
    image: container-registry.oracle.com/database/enterprise:19.3.0.0
    container_name: oracle
    privileged: false
    environment:
      - TZ=Asia/Shanghai
      - ORACLE_SID=ORCLCDB
      - ORACLE_PDB=ORCLPDB1
      - ORACLE_PDB_SID=ORCLPDB1
      - ORACLE_PWD=Change,me,5521
      #- INIT_SGA_SIZE=
      #- INIT_PGA_SIZE=
      - ENABLE_ARCHIVELOG=false
      - ORACLE_CHARACTERSET=AL32UTF8
      - ORACLE_BASE=/opt/oracle
      - ORACLE_HOME=/opt/oracle/product/19c/dbhome_1
      - PATH=/opt/oracle/product/19c/dbhome_1/bin:/opt/oracle/product/19c/dbhome_1/OPatch/:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
    volumes:
      - /data/oracle/oradata:/opt/oracle/oradata
    ports:
      - "5001:1521"
      - "5002:8080"
      - "5005:5500"
    restart: always
    mem_limit: 10g
    mem_swappiness: 0
    memswap_limit: 16g
    shm_size: 2g

# mkdir -p /data/oracle/oradata && chown 54321 -R /data/oracle/oradata



# 创建目录
SQL> alter session set container=ORCLPDB1;
SQL> create or replace directory BAK as '/opt/oracle/oradata/BAK';

select * from dba_directories;


# 数据泵导出
export ORACLE_PDB_SID=ORCLPDB1

expdp \'/ as sysdba\'  directory=BAK dumpfile=DB-20210222.dmp logfile=DB-20210222.log schemas=DB_USER1

# 数据泵导入方法1: 先删用户后导入
export ORACLE_PDB_SID=ORCLPDB1

drop user DB_USER1 cascade;
impdp \'/ as sysdba\' directory=BAK file=DB-20210308.dmp schemas=DB_USER1 table_exists_action=replace logfile=DB-20210308.log transform=segment_attributes:n

# 数据泵导入方法2: 导入覆盖,但是  seqence 无法覆盖
export ORACLE_PDB_SID=ORCLPDB1

impdp \'/ as sysdba\' directory=BAK file=DB-20210308.dmp schemas=DB_USER1 EXCLUDE=USER table_exists_action=replace logfile=DB-20210308.log transform=segment_attributes:n
上一篇下一篇

猜你喜欢

热点阅读