首页 > 数据库 > mysql教程 > Oracle 11g数据库之数据导入导出与事物

Oracle 11g数据库之数据导入导出与事物

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-07 17:35:29
原创
1001 人浏览过

在使用oracle数据库中对备份恢复是最关键的,当数据库出现故障时可以及时恢复减少不必要的损失。下面我将简单介绍一下导入导出数

在使用Oracle数据库中对备份恢复是最关键的,当数据库出现故障时可以及时恢复减少不必要的损失。下面我将简单介绍一下导入导出数据库,方案,表,和在使用的过程当中事物的作用。
1.导出数据表
[oracle@CentOS ~]$ exp scott/system tables=t file='/home/oracle/t.dump' log='/home/oracle/t.log';    --导出scott用户中的t表数据(tables=可以写多个表,full=y  全部导出,ignore=y  表示忽略重复的数据)
Export: Release 11.2.0.1.0 - Production on Mon Feb 17 16:28:04 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table                              T          1 rows exported
Export terminated successfully without warnings.
[oracle@centos ~]$

2.导入数据表
[oracle@centos ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 17 16:29:13 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Enter user-name: scott
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop table t;    --删除我刚才导出的表
Table dropped.
SQL> commit;
Commit complete.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@centos ~]$ imp scott/system tables=t file='/home/oracle/t.dump';  --导入数据表
Import: Release 11.2.0.1.0 - Production on Mon Feb 17 16:29:58 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
import server uses WE8MSWIN1252 character set (possible charset conversion)
. importing SCOTT's objects into SCOTT
. importing SCOTT's objects into SCOTT
. . importing table                            "T"          1 rows imported
Import terminated successfully without warnings.
[oracle@centos ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Mon Feb 17 16:30:03 2014
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Enter user-name: scott
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from t;    --成功导入
A
----------
1
SQL>

3.导出用户下的所有表(scott)
[oracle@centos ~]$ exp scott/system  file='/home/oracle/scott.dump';  --导入scott自己的所有表(exp scott/system owner=用户名 file='路径'  --导出其它用户下的表)
Export: Release 11.2.0.1.0 - Production on Mon Feb 17 16:34:07 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses WE8MSWIN1252 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table                          DEPT          4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table                            EMP        12 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table                      SALGRADE          5 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table                  SYS_TEMP_FBT
. . exporting table                              T          1 rows exported
. . exporting table                          TONG1        14 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
[oracle@centos ~]$

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
数据导入问题
来自于 1970-01-01 08:00:00
0
0
0
数据库文件导入
来自于 1970-01-01 08:00:00
0
0
0
如何从终端导入 MySQL 数据库?
来自于 1970-01-01 08:00:00
0
0
0
mongodb导入后和导出前的统计数据不一样
来自于 1970-01-01 08:00:00
0
0
0
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板