Oracle补习班第八天
The best hearts are always the bravest.
心灵最高尚的人,也总是最勇敢的人。
1,权限、角色、与用户
创建用户
create user aa identified by 123456;
create user bb identified by 123456;
create user cc identified by 123456;
创建角色
create role hr_clerk;
create role hr_mgr;
给角色赋权
grant create table to hr_mgr;
grant select on scott.emp to hr_mgr;
grant create session to hr_mgr;
grant select on scott.emp to hr_clerk;
grant create session to hr_clerk;
grant insert on scott.emp to hr_clerk;
grant update on scott.emp to hr_clerk;
给用户角色
grant hr_mgr,hr_clerk to aa;
grant hr_clerk to bb,cc;
总结:角色是权限的集合
oracle是有预定义角色的,常用的CONNECT,RESOURCE,DBA
2,将数据加载到数据库中使用SQL loader工具
操作步骤逻辑如下:
新建一个txt文档,写入需要插入的数据;
新建一个ctl文件,写入参数;
sqlldr scott/tiger@orcl02 control=/tmp/sqlldr.ctl;
实验具体步骤如下:
select ename from scott.emp;
vim /tmp/'the data need to be insert.txt' #粘贴上面数据到txt
vim/tmp/sqlldr.ctl
load data
infile '/tmp/'the data need to be insert.txt''
into table emp1
fields terminated by ','
(ename)
sqlldr scott/tiger@orcl2 control=/tmp/sqlldr.ctl
select * from emp1;
实验插入两行数据步骤如下:
select ename||','||empno from scott.emp
vim /tmp/'the data need to be insert2.txt'
vim /tmp/sqlldr2.ctl
load data
infile '/tmp/'the data need to be insert2.txt''
into table emp2
fields terminated by ','
(ename,empno)
sqldr scott/tiger control=/tmp/sqlldr2.ctl
3,在数据库之间传输数据,使用工具exp,imp
交互式导出用户
exp
username:scott
passwd:tiger
enter array fetch buffer size:4096>1000000
export file:expdat.dmp>/tmp/scott.dmp
user,or table>U
export grants>yes
export table data>yes
compress extents>no
命令式导出用户
exp "'sys/oracle as sysdba'" BUFFER=1000000 FILE=/tmp/sys.dmp OWNER=sys
参数文件方式导出
vim /tmp/scott.par
USERID=scott/tiger
FILE=/tmp/sys.dmp
BUFFER=1000000
OWNER=sys
LOG=/tmp/sys_exp.log
exp parfile=/tmp/scott.par
总结:exp导出有三种方法,交互式,命令行,参数式。
关键字:数据库full=y,用户owner,表空间tablespaces,表tables,查看exp help=y
exp scott/tiger buffer=1000000 file=/tmp/test.dmp tables=emp quary=\'where deptno=30\'
exp scott/tiger buffer=1000000 file=/tmp/test.dmp tables=emp row=no #表结构
4,在数据库之间传输数据,使用工具expdp,impdp
$ mkdir /tmp/dmpdir
> create or replace directory dmpdir as '/tmp/dmpdir';
> grant read,write on directory dmpdir to scott;
$ expdp scott/tiger dumpfile=scott.dmp directory=dmpdir
$ expdp system/oracle dumpfile=system_scott.dmp directory=dmpdir schemas=system,scott
Oracle补习班第八天的更多相关文章
- Oracle补习班第三天
In every triumph, there's a lot of try. 每个胜利背后都有许多尝试 Oracle管理实例组件 主要组件分为两部分例程,与数据库: 例程分为两部分SGA跟进程: S ...
- Oracle补习班第四天
Everything has its time and that time must be watched. 万物皆有时,时来不可失 1,管理参数文件 参数文件分两种spfile二进制文件和pfile ...
- Oracle补习班第五天
Great minds have purpose,others have wishes. 杰出的人有着目标,其他人只有愿望 控制文件是小型二进制文件,只能在mount阶段新建 1,重做控制文件 alt ...
- Oracle补习班第七天
Keep conscience clear, then never fear. 问心无愧,永无畏惧 服务端监听 lsnrctl status #查看监听服务 netca #配置动态监听 lsnrct ...
- Oracle补习班第九天
Better to light one candle than to curse the darkness. 与其诅咒黑暗,不如点亮烛光! 1,用SQL备份数据库数据文件 sqlplus / as s ...
- Oracle补习班第一天
My life is a straight line, turning only for you. 我的人生是一条直线,为你转弯
- Oracle补习班第十天
Life without love is like a tree without blossoms or fruit. 缺少爱的生活就像从未开花结果的枯树 RMAN备份工具 crosscheck ba ...
- Oracle课程档案,第八天
存储管理 查询块的大小:show parameter db_block_size database:数据库 tablespace:表空间 datafile:数据文件 segments:段 extent ...
- BOS物流管理系统-第八天
BOS物流管理系统-第八天-权限系统设计-Shiro 回顾: 两大块业务:基础设置模块,业务派单模块. 两天:权限控制. 拦截器大的范围的.纯登录级别(认证级别)大颗粒的权限控制的一种技术. Shir ...
随机推荐
- [C++] 自己实现快速memcpy
仅在Win32上使用,Win64上不允许内嵌汇编= = __declspec(naked) void* __stdcall __memcpy ( __in void* Dest, // ebp+0x0 ...
- CSS3中:nth-child和:nth-of-type的区别深入理解。 关于:nth-child和:nth-of-type的区别之前一直没太注意,经深入理解才发现里面其实暗藏玄机
关于:nth-child和:nth-of-type的区别之前一直没太注意.最近打算深入了解一些CSS3,才发现里面其实暗藏玄机. :nth-child可以选择父元素下的字元素,:nth-of-type ...
- 上下文管理、线程池、redis订阅和发布
一:上下文管理: 对于一些对象在使用之后,需要关闭操作的.比如说:socket.mysql数据库连接.文件句柄等. 都可以用上下文来管理. 语法结构: Typical usage: @contextm ...
- 系统中异常公共处理模块 in spring boot
最近在用spring boot 做微服务,所以对于异常信息的 [友好展示]有要求,我设计了两点: 一. 在业务逻辑代码中,异常的抛出 我做了限定,一般只会是三种: 1. OmcException // ...
- 使用PHP将长文章分页
如何分页 手动分页:一般在编辑内容时加入特殊分页标记,如{pages},提交后,PHP程序会根据分页符处理分页,生成不同的静态页面.这种分页方法分页准确,但是需要人工手动添加分页符,工作量大. 自动分 ...
- 【科普】为什么WiFi自动信道选到的信道多数在1/6/11
http://bbs.hiwifi.com/thread-4126-1-1.html 论坛上不少朋友很困惑,为什么小极的自动信道选择选到的信道只会在1.6.11这三个信道呢?WiFi不是一共有10几个 ...
- JSP-JSTL学习
<%@page import="com.Student"%> <%@page import="com.Person"%> <%@p ...
- python 输出十六进制中文乱码
代码中红色字体为解决方案: #-*-coding:utf-8-* import csv filename='C:\Users\yaru\Desktop\Senti_Value(1).csv' data ...
- Flask 的扩展
1. Flask-Script,为Flask程序提供了一个命令行解析器: (venv) $ pip install flask-script 2. Bootstrap(http://getbootst ...
- 《Web全栈工程师的自我修养》读书笔记(转载)
[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/5 ...