测试用户创建
SQL> create user milk identified by milk;
User created.
SQL> grant dba to milk;
Grant succeeded.
SQL> create user milk1 identified by milk;
User created.
SQL> grant connect,resource to milk1;
Grant succeeded.
导出的目录创建
SQL> create directory dir_aq as '/home/oracle/';
Directory created.
SQL> exit
编辑导出脚本
[oracle@g1 ~]$ cat exp.par
userid='/ as sysdba'
logfile=123.log
include=user
schemas=milk,milk1
directory=dir_aq
dumpfile=123.dmp
编辑导入txt的脚本
[oracle@g1 ~]$ cat expdp.par
userid='/ as sysdba'
sqlfile=123.sql
logfile=123.log
include=user
schemas=milk,milk1
directory=dir_aq
dumpfile=123.dmp
开始导出用户
[oracle@g1 ~]$expdp parfile=exp.par
开始导入成sql语句
[oracle@g1 ~]$impdp parfile=expdp.par
本地有123.sql就是建用户语句
[oracle@g1 ~]$ cat 123.sql
-- CONNECT SYS
ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
-- new object type path: SCHEMA_EXPORT/USER
-- CONNECT SYSTEM
CREATE USER "MILK" IDENTIFIED BY VALUES 'S:C345EB607A7EC1D7EE6D4F56F4311327BF2189552D6B0822
B4E1BB42C42E;FFE1199AE956431E' DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP";
CREATE USER "MILK1" IDENTIFIED BY VALUES 'S:87F32830A175754038DAD04746B502493F6B37CAA692F1F
8A5A169EF8612;548D1A7D4F5CE4AC' DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP";
将这个123.sql拿到新库去跑,就创建用户了。