Docker uses docker compose to install Oracle 11g R2 mount directory restore.DMP backup data to the new database Navicat connection

->  The installation of Docker and docker compose click here

describe

Currently there is a XXX.DMPfile, which is a file backed up from the old Oracle database.
Now you need to use Docker to deploy a new Oracle database. The version is 11g R2.
After deployment, you need to import the data of the old database, that is, DMPthe file, into the new database.
Here The tools needed are XShell and Navicat

Step 1: Create a docker-compose.yml file

First create an Oracle directory

mkdir /software/oracle
cd /software/oracle

viOr vimedit the file, the name is docker-compose.yml, enter the following content, wqsave and exit

version: "3"
services:
  oracle:
    image: registry.aliyuncs.com/helowin/oracle_11g
    container_name: oracle
    stdin_open: true
    tty: true
    restart: always
    ports:
      - 1521:1521
    volumes:
      - ./dpdump:/home/oracle/app/oracle/admin/orcl/dpdump/
    privileged: true

Step 2: Start into the container

In /software/oraclethe directory, enter the command docker-compose up -dto start the container
insert image description here
. For the first time, you will download the image first. Just wait patiently. The Oracle image is a bit large.
After the container starts successfully, enter the command todocker exec -it oracle bash enter the inside of the container. It is very likely that an error will be reported that the memory is insufficient and cannot be allocated. At this time, you can enter a command to solve the problem. Container stop command:
insert image description here


docker system prune
docker-compose stop

Step 3: Log in to the Oracle database

Refresh environment variables

source ~/.bash_profile

enter the database

sqlplus /nolog

Login with sysdba

conn /as sysdba

Change the system password to "system"

alter user system identified by system;

Change the password of sys to "sys"

alter user sys identified by sys;

exitExit the database and container, enter twice in a row

Solve the problem of "ORA-01109: database not open" when changing the password


​​​​Delete the newly generated version control file, copy the version control file in the data volume as the newly generated version control
file  Copy
rm -rf /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl after login
cp /home/oracle/app/oracle/oradata/helowin/control01.ctl /home/oracle/app/oracle/flash_recovery_area/helowin/control02.ctl
sqlplus / as sysdba # connect to the oracle database as dba
shutdown immediate # close the database instance (An error will be reported here, don't worry about it)
startup # Start the instance

Demo screenshot:
insert image description here

Step 4: Navicat connects to the Oracle database

Close the firewall first, or open port 1521.
Refer to the link: server open port

Open Navicat, create a new Oracle link,
insert image description here
select Advanced, SYSDBAlog in with a role
insert image description here
, go back to the general settings, log in with sys,
insert image description here
and test the connection
insert image description here
. So far, our Oracle data has been built successfully

Step 5: Import DMP file to restore database data

After we start the container, we will find that there is an additional folder in the directory dpdump. This is the directory we mounted
insert image description here
. We put our DMP file in this directory (you can use xftptransfer)
insert image description here
to open Navicat and connect to our Database, find 数据泵the function
insert image description here
At this point, we will find that there is an extra dmp file in the data pump, double-click directly, produce SQL, run
insert image description here
insert image description here
insert image description here

At this point, it is basically ok.
If an error is reported during the import process, just create the user role in the previous database first, and it will be fine.

Seeing this means the import was successful
insert image description here

Guess you like

Origin blog.csdn.net/weixin_45623983/article/details/128302882