加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

oracle命令基本操作

发布时间:2020-12-12 18:50:20 所属栏目:百科 来源:网络整理
导读:--创建表空间 create tablespace TBS_OTHERS datafile 'G:APPORCLORADATAORCLTBS_OTHERS01.dbf' size 1000m; -- 创建用户 create user C##JHGL identified by jhgl default tablespace TBS_OTHERScreate user C##YJYJHGL identified by jhgl default ta

--创建表空间

create tablespace TBS_OTHERS datafile 'G:APPORCLORADATAORCLTBS_OTHERS01.dbf' size 1000m;


-- 创建用户

create user C##JHGL identified by jhgl default tablespace TBS_OTHERS
create user C##YJYJHGL identified by jhgl default tablespace TBS_OTHERS
create user C##WCJHGL identified by jhgl default tablespace TBS_OTHERS
grant dba,resource,connect to C##JHGL,C##YJYJHGL,C##WCJHGL
grant dba,connect to C##WCJHGL

-- Drop tablespace TBS_OTHERS;

drop user C##JHGL cascade;
drop user C##YJYJHGL cascade;
drop user C##WCJHG cascade;

--删除session

--查询session对应的sid,serial#
select saddr,sid,serial#,paddr,username,status from v$session where username is not null;
--kill session
alter system kill session 'sid,serial#' ;

导出命令 后创建

创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建。

create directory dpdata1 as 'd:testdump';

按用户导

expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dpdata1;

还原数据
1)导到指定用户下

impdp scott/tiger DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=scott;
impdp user/password directory=dpdir dumpfile=Logontab.dmp table_exists_action=replace 
logfile=implogontab.log

able_exists_action选项:{skip 是如果已存在表,则跳过并处理下一个对象;append是为表增加数据;truncate是截断表,然后为其增加新数据;replace是删除已存在表,重新建表并追加数据}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读