Welcome 微信登录

首页 / 数据库 / MySQL / Oracle 10g 数据库逻辑备份

1.首先我建立了一个名为"linuxidc”的用户并且将其密码设为“linuxidc123”  (以sys身份进行操作的sql语句)create  user linuxidc identified by linuxidc123; 2.为新  用户分配一些权限grant  create session to linuxidc;
grant  create table to linuxidc;3.新建一个目录用来存放文件。(root身份在服务器上进行的操作。并且为该目修改所有者及组属性)[root@ www.linuxidc.com ~]# cd  /u01/[root@ www.linuxidc.com u01]# mkdir  ts[root@ www.linuxidc.com u01]# chown  -R  Oracle:oinstall ts4.创建名为“linuxidc” (表空间)tablespace。并且将linuxidc用户加入到linuxidc表空间。并且给他分配一定的空间使用配额(sys身份)create tablespace  linuxidc
datafile "/u01/ts/linuxidc001.dbf"
size 20m ;alter  user linuxidc default tablespace  linuxidc;alter  user linuxidc quota  20m  on linuxidc;5.使用linuxidc账户登录。创建一张名称为test1的测试表。create  table  test1(
ts int,tsname varchar2(30)); 6.建立备份目录并使用exp对数据进行导出(在服务器上执行)[oracle@ www.linuxidc.com u01]$ mkdir  dump[root@ www.linuxidc.com u01]# chown  -R  oracle:oinstall dump [root@ www.linuxidc.com u01]# chmod  775  dump[oracle@ www.linuxidc.com dump]$ exp Export: Release 10.2.0.1.0 - Production on Wed May 16 06:44:20 2012 Copyright (c) 1982, 2005, Oracle.  All rights reserved. Username: sys  as  sysdba
Password: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Enter array fetch buffer size: 4096 > Export file: expdat.dmp > /u01/dump/emp052209.dmp       --为要备份的对象选择目标文件及存储路径(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U > t     --在这里悬着对表备份Export table data (yes/no): yes > Compress extents (yes/no): yes >                                    --默认压缩备份文件Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion) About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > scott.emp    --所要导出的表,指定该表的用户名Current user changed to SCOTT
. . exporting table                            EMP         14 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > Export terminated successfully with warnings.此时已经完成备份7.使用imp导入备份[oracle@ www.linuxidc.com dump]$ imp Import: Release 10.2.0.1.0 - Production on Wed May 16 07:07:21 2012 Copyright (c) 1982, 2005, Oracle.  All rights reserved. Username: sys as  sysdba
Password: Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options Import file: expdat.dmp > /u01/empo52209.dmp                         --指定要导入的备份文件及所在的路径IMP-00002: failed to open /u01/empo52209.dmp for read
Import file: expdat.dmp > /u01/dump/emp052209.dmp Enter insert buffer size (minimum is 8192) 30720> Export file created by EXPORT:V10.02.01 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
List contents of import file only (yes/no): no > Ignore create error due to object existence (yes/no): no > yes              --忽略错误提示Import grants (yes/no): yes > Import table data (yes/no): yes > Import entire export file (yes/no): no >
Username: scott                                                                       --该表的所属用户Enter table(T) or partition(T:P) names. Null list means all tables for user
Enter table(T) or partition(T:P) name or . if done: . importing SYS"s objects into SYS
. importing SCOTT"s objects into SCOTT
. . importing table                          "EMP"         14 rows imported
About to enable constraints...
Import terminated successfully with warnings.
[oracle@ www.linuxidc.com dump]$ 这个过程就是逻辑备份更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12Oracle LISTENER 未监听到Oracle实例问题解决Oracle 10g的闪回删除与回收站相关资讯      Oracle入门教程 
  • 使用SQLT来构建Oracle测试用例  (08/28/2014 06:17:41)
  • Oracle AUTOTRACE 统计信息  (02/18/2013 08:25:40)
  • Linux Oracle服务启动&停止脚本与  (12/16/2012 14:42:37)
  • Oracle入门教程:把表和索引放在不  (07/13/2013 11:21:40)
  • Oracle直接路径加载--append的深度  (02/07/2013 08:26:36)
  • Oracle Connect By用法  (12/16/2012 13:36:10)
本文评论 查看全部评论 (0)
表情: 姓名: 字数