Blog reference:
Overview:
Obtain the test library xxx.dmp file from the implementer and import it to the local for testing.
Two ways of oracle import and export:
- Directly use the oracle menu bar tools to import and export.
- The way to use commands.
method one:
Way two:
Export database statement:
EXPDP 用户名/密码 DIRECTORY=DATA_PUMP_DIR DUMPFILE=FSSJCJ.DMP LOGFILE=FSSJCJ.LOG version=11.1.0.6.0
I got the dmp file provided by the implementation, because I didn’t know how to use the second method to export, I used the first method to import, and the result was an error.
Namely: Expdp exported but imported with client's imp
After discovering that the implementation is exported in the second method, the corresponding import is carried out in the form of commands.
Then proceed to create a new table space, user operations.
New table space: pay attention to the new table space, the user should be consistent with the implementer
create tablespace FSSJCJ datafile 'D:\oracleDB\FSSJCJ.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
Create user:
create user FSSJCJ identified by FSSJCJ default tablespace FSSJCJ
Grant user permissions:
grant connect, resource to FSSJCJ grant create session to FSSJCJ grant dba to FSSJCJ
CMD enters the command window:
Login database: (system user login)
sqlplus / as sysdba
创建directory:
create or replace directory dmpdir as 'D:\oracleDB';
Exit to the DOS command window and execute SQL:
Otherwise, an error message like this appears: SP2-0734: Unknown command starts with "imp scott/..."-the remaining lines are ignored
impdp FSSJCJ/FSSJCJ directory=dmpdir dumpfile=FSSJCJ.dmp full=y
There is a problem, an error is reported:
ORA-39001: 参数值无效 ORA-39000: 转储文件说明错误 ORA-39142: 版本号 3.1 (在转储文件 "" 中) 不兼容
EXPDP / IMPDP ORA-39142
impdp encounter ORA-39001, ORA-39000, ORA-39142
the reason:
The implementation database version is 11.2, and my database version is 11.1.0.6, which is not compatible when importing.
Therefore, the implementation is re-exported and the specified version is exported:
EXPDP FSSJCJ/FSSJCJ DIRECTORY=DATA_PUMP_DIR DUMPFILE=FSSJCJ.DMP LOGFILE=FSSJCJ0116.LOG version=11.1.0.6.0
Execute SQL again:
C:\Users\xxx>impdp FSSJCJ/FSSJCJ directory=dmpdir dumpfile=FSSJCJ.dmp full=y Import: Release 11.1.0.6.0 - Production on 星期四, 16 1月, 2020 14:03:22 Copyright (c) 2003, 2007, Oracle. All rights reserved. 连接到: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 已成功加载/卸载了主表 "FSSJCJ"."SYS_IMPORT_FULL_01" 启动 "FSSJCJ"."SYS_IMPORT_FULL_01": FSSJCJ/******** directory=dmpdir dumpfile=FSSJCJ.dmp full=y 处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA 处理对象类型 SCHEMA_EXPORT/SEQUENCE/SEQUENCE 处理对象类型 SCHEMA_EXPORT/TABLE/TABLE 处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA . . 导入了 "FSSJCJ"."MJ_COBRA_REGION" 34.57 MB 3227 行 . . 导入了 "FSSJCJ"."B0605_LOGINFO" 9.083 MB 12931 行 ... ... 处理对象类型 SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 作业 "FSSJCJ"."SYS_IMPORT_FULL_01" 已于 14:04:50 成功完成
At this point, the database is successfully imported.
Oracle delete user and table space
Delete USER.
DROP USER XX CASCADE
Delete the table space.
DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;
Delete empty tablespaces, which do not contain physical files.
DROP TABLESPACE tablespace_name;
Delete the empty tablespace, which contains physical files.
DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
Delete the non-empty table space, does not contain physical files.
DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
Delete non-empty tablespaces, including physical files.
DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;