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 ...
随机推荐
- Win10/UWP新特性—SharedStorageAccessManager 共享文件
首先先给大家推荐一个UWP/Win10开发者群:53078485 里面有很多大婶,还有很多学习资源,欢迎大家来一起讨论Win10开发! 在UWP开发中,微软提供了一个新的特性叫做SharedStor ...
- 黑马----JAVA泛型基础
黑马程序员:Java培训.Android培训.iOS培训..Net培训 JAVA范型-基础 一.泛型的概念 1.实现了参数化类型 2.用于编写可应用于多种类型的代码,即所编写的代码可应用于许多许多的类 ...
- c# 常量,变量
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- SDK截图(三):压缩位图之理论准备篇
压缩位图我们使用简单的行程长度编码的方法,详情参考<windows程序设计>15章之DIB压缩. 在BITMAPINFOHEADER结构中有两个和位图压缩有关的字段,分别是biCompre ...
- win32自绘按钮,使用GDI+(一)
第一次写随笔,我本来想将win32窗口的标题栏设置成渐变色,像这样的效果 但发现找不到设置标题栏属性的api,SetWindowLong也只是增减窗口的固定的样式而已.所以想到一个思路,把标题栏去掉, ...
- ionic 开发APP 安装配置详解以及 cordova 环境配置详细过程
整个安装过程: 1. jdk 1.7.2 (http://www.oracle.com/technetwork/java/javase/downloads/index.html) 安装好之 ...
- Java的Package和Classpath
Package 在Java中,Package是用来包含一系相关实例的集合.这些相关联的实例包括:类.接口.异常.错误以及枚举. Package主要有一些的几点作用: Package可以处理名字冲突,在 ...
- python 字符串技巧 from python cookbook
所有数据进入程序中都只是一串字节 英文字符占一个字节 汉语是两个字节 一字节byte=8bit Unicode字符串为每种语言的每种字符设定了统一并且唯一的二进制编码 big = r'This is ...
- 国内如何使用gem?
答案很简单,使用淘宝镜像! https://ruby.taobao.org/ 造福人类啊! 设置方法: $ gem sources --add https://ruby.taobao.org/ --r ...
- 2016年4月面试题(Unity)
一. C#中值类型和引用类型的区别? A: 值类型的数据存储在内存的栈中:引用类型的数据存储在内存的堆中,而内存单元中只存放堆中对象的地址. 值类型存取速度快,引用类型存取速度慢 值类型表示实际数据, ...