Oracle导入导出创建用户赋予权限删除用户
impdp导入导出(会覆盖原来的数据不会覆盖视图)
expdp ymgd/ymgd@127.0.0.1:1521/orcl DIRECTORY=DATA_PUMP_DIR schemas=ymgd dumpfile=20221020ymgd.dmp logfile=0616ymgdexp.log
账号 密码 ip 端口号 实例 数据泵位置 用户 导出文件名称 导出日志名称
impdp ymgd/ymgd@127.0.01:1521/ORCL directory=DATA_PUMP_DIR dumpfile=20221020YMGD.DMP table_exists_action=replace full=y
查看数据泵位置命令
select * from dba_directories;
imp导入导出(适合新库)
# 数据库导出 指定导出某个用户的所有数据 包括表 索引 序列 存储过程 函数 等
exp ymgd/ymgd@127.0.0.1:1521/orcl file=D:/app/tmp/20221020ymgd.dmp OWNER=ymgd LOG=D:/app/tmp/20221020ymgd.log
--数据库导入
imp ymgd/ymgd@127.0.0.1:1521/orcl file=D:/app/tmp/20221020ymgd.dmp full=y ignore=y LOG=D:/app/tmp/20221020ymgd.log
# 备注:CX 用户名;CX 密码 ;orcl 数据库名称 ; file 数据文件存储位置; OWNER 用户 (多个用户使用括弧 如:(user,sys)) log 日志位置;ignore 报错后依然继续处理
查看表空间
select * from dba_tablespaces
创建表空间
create tablespace YMGD
logging datafile'D:/app/home/oracle/YMGD.dbf'
size 8192m autoextend on next 64m maxsize unlimited;
创建用户分配权限
create user ymgd
identified by "ymgd"
default tablespace YMGD
profile DEFAULT
ACCOUNT UNLOCK;
# 分别赋予权限
grant create session,create table to ymgd;
grant UNLIMITED TABLESPACE to ymgd;
grant select on V_$session to ymgd;
grant select on V_$sesstat to ymgd;
grant select on V_$statname to ymgd;
# 直接赋予dba权限
grant connect,resource,dba to ymgd;
删除用户
drop user ymgd cascade;