-> The installation of Docker and docker compose click here
Currently there is a XXX.DMP
file, 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, DMP
the 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
vi
Or vim
edit the file, the name is docker-compose.yml
, enter the following content, wq
save 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/oracle
the directory, enter the command docker-compose up -d
to start the container
. 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: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;
exit
Exit 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:
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,
select Advanced, SYSDBA
log in with a role
, go back to the general settings, log in with sys,
and test the connection
. 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
. We put our DMP file in this directory (you can use xftp
transfer)
to open Navicat and connect to our Database, find 数据泵
the function
At this point, we will find that there is an extra dmp file in the data pump, double-click directly, produce SQL, run
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