I. Overview
Before dmp file into Oracle, the need to create a user orcale. Then using the user name and password to imp way to import data into the oracle.
Second, the implementation steps
1, landing oracle database
sqlplus / as sysdba
2, the query table space and temporary table space storage location
select name from v$tempfile;
select name from v$datafile;
3, the user creates a temporary table space and table space, a storage position using any of the above can be found in
create temporary tablespace demo_temp tempfile '/oracle/u02/oradata/ERP2/demo_temp.dbf' size 100m reuse autoextend on next 20m maxsize unlimited;
create tablespace demo datafile '/oracle/u02/oradata/ERP2/demo.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage (initial 128k next 128k minextents 2 maxextents unlimited);
NOTE: The command to delete the tablespace drop tablespace temp including contents and datafiles; 4, create a user and specify the table space
create user demo identified by demo default tablespace demo temporary tablespace demo_temp;
4, if an error this time, Oracle 19c: ": invalid common user or role name ORA-65096" error occurred while creating user
Then it comes to basic management CDB and the PDB, official sources oracle.
basic concepts:
Multitenant Environment: multi-tenant environment
CDB (Container Database): a database container
PD (Pluggable Database): pluggable database
PDB diagram of CDB
COMMON USERS (normal user): CDB often built on layer ## in order to begin the user name ## C or C;
the LOCAL the USERS (local user): CONTAINER designate only established when the PDB layer established.
Original official documents as follows:
The data dictionary in each container in a CDB is separate, and the current container is the container whose data dictionary is used for name resolution and for privilege authorization. The current container can be the root or a PDB. Each session has exactly one current container at any point in time, but it is possible for a session to switch from one container to another.
Each container has a unique ID and name in a CDB. You can use the CON_ID and CON_NAME parameters in the USERENV namespace to determine the current container ID and name with the SYS_CONTEXT function.
To put it plainly, that your current session can not create a user you need, you need to use the function SYS_CONTEXT
a, see Oracle 19c version
select * from v$version;
select sys_context ('USERENV', 'CON_NAME') from dual;
b, we can specify other containers by ALTER SESSION SET CONTAINER
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
C、将PDB open
alter pluggable database pdborcl open;
d、查看容器
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
e、切换到pdb
alter session set container=PDBORCL;
f、查看当前使用容器
select sys_context ('USERENV', 'CON_NAME') from dual;
g、创建用户
create user demo identified by demo default tablespace demo temporary tablespace demo_temp;
5、导入文件到oracle
oracle连接方式用两种,一般用户喜欢使用Server_id的方式,导入方式为
imp demo/123456@orcl file="C:\Users\xiejiachen\Desktop\test20190630.DMP" full =y;
使用server_name的导入方式如下:
imp demo/123456@localhost/ORCLpdb1 file=home/oracle/demo.dmp ignore=y full=y
其中demo为用户名,123456为密码,@后面是主机名称,ORCLpdb1是server的名称。