新建用户/表空间/序列--数据库用户导入导出

来源:互联网 发布:mac怎么格式化u盘 编辑:程序博客网 时间:2024/05/21 17:48

新建用户:

--新建表空间
create tablespace  data_noc   
logging   
datafile 'E:\oracle\product\10.2.0\oradata\orcl\data_noc.DBF'  --datafile详解:http://blog.csdn.net/ppp_10001/article/details/4688848
size 512m   
autoextend on   
next 128m maxsize 20480m   
extent management local; 

-- 新建用户(Create the user) 
create user noc
  identified by "td$123"
  default tablespace data_noc
  temporary tablespace TEMP
  profile DEFAULT;
-- Grant/Revoke role privileges 
grant connect to noc;
grant dba to noc;
grant exp_full_database to noc;
grant imp_full_database to noc;
grant resource to noc;
-- Grant/Revoke system privileges 
grant create table to noc;
grant select any table to noc with admin option;
grant unlimited tablespace to noc;

--新建序列
create sequence rnop.SEQ_LOGMANAGE
minvalue 1
maxvalue 999999999999999999999999999
start with 109948
increment by 1
nocache;








=========================================================================

导入导出讲解:

一只想飛的豬的豬圈!:http://www.cnblogs.com/fjfzhkb/archive/2007/09/03/879807.html


Oracle数据导入导出imp/exp 
功能:Oracle数据导入导出imp/exp就相当与oracle数据还原与备份。



1.导出实例:

数据导出:

 1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
   exp system/manager@TEST file=d:\daochu.dmp full=y
 2 将数据库中system用户与sys用户的表导出
   exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
 3 将数据库中的表table1 、table2导出
   exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2) 
 4 将数据库中的表table1中的字段filed1以"00"打头的数据导出
   exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like  '00%'\"
  
     上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。
                     不过在上面命令后面 加上 compress=y  就可以了


exp hkb/hkb@boss_14 full=y file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbfull.log;

导出注意事项:导出的是当前用户的的数据,当前用户如果有DBA的权限,则导出所有数据!

导出用户tdl_hz_hw4用户下多有表测试:


资料:

oracle数据库导出用户:http://www.2cto.com/database/201302/187338.html




2.导入实例:

格式:
 imp system/admin fromuser=sde touser=sde file=E:\soft\ArcGISSetup\cxsdemap.dmp log=E:\soft\ArcGISSetup\cxsdemap.log buffer=600000 

在命令行执行一下语句:

 imp noc/td$123@ZJWX210  fromuser=TDL_HZ_HW4  touser=TDL_HZ_HW4  file=D:\data\TDL_HZ_HW4.dmp  log=D:\data\TDL_HZ_HW4.log buffer=600000 

noc/td$123@ZJWX210  :所属用户/所属用户密码@所在库
fromuser:来源用户 //一般不同名用户之间的数据导入用到较多
touser:目标用户

同名用户之间的数据导入:
imp hkb/hkb@xe  file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbimp.log full=y

不同名之间的数据导入:
imp system/test@xe fromuser=hkb touser=hkb_new file=c:\orabackup\hkbfull.dmp

log=c:\orabackup\hkbimp.log;


数据的导入各种情况:
 1 将D:\daochu.dmp 中的数据导入 TEST数据库中。
   imp system/manager@TEST  file=d:\daochu.dmp
   上面可能有点问题,因为有的表已经存在,然后它就报错,对该表就不进行导入。
   在后面加上ignore=y 就可以了。
 2 将d:\daochu.dmp中的表table1 导入
 imp system/manager@TEST  file=d:\daochu.dmp  tables=(table1) 


1.小丑Samuel:http://www.cnblogs.com/herane/archive/2010/03/12/1684649.html

Oracle exp 导出用户对象

  导出Oracle scott方案下用户对象

exp system/password@orcl  grants=n feedback=10000 file=e:\scott.dmp owner=scott

只要在本机设置了TNS——orcl,知道system用户名和密码就可以导出数据到本地

grants=n 表示不导出权限;

feedback表示10000条记录反馈一次——表现在终端就是一个黑点;

file就不用说了

owner指明从哪个用户下导出