数据库(表)的逻辑备份与恢复-导出表

管理初始化参数
初始化参数用于设置实例或是数据库的特征,oracle9i提供了200过个初始化参数,并且每个初始化参数都有默认值。

显示初始化参数
1)show parameter命令

如何修改参数
需要说明的如果你希望修改这些初始化的参数,可以到文件D:\oracle\admin\orcl\pfile\init.ora

数据库(表)的逻辑备份与恢复-导出表的介绍
逻辑备份是指使用工具export将数据对象的结构和数据导出到文件的过程,逻辑恢复是指当数据库对象被误操作而损坏后使用工具import利用备份的文件将数据对象导入到数据库的过程。物理备份即可在数据库open的状态下进行也可在关闭数据库后进行,但是逻辑备份和恢复只能在open的状态下进行

导出
导出具体的分为:导出表、导出方案、导出数据库三种方式。
导出使用exp命令来完成的,该命令常用的选项有:
userid:用于指定执行导出操作的用户名、口令、连接字符串
tables:用于指定执行导出操作的表
owner:用于指定执行导出操作的方案
full=y:用于指定执行导出操作的数据库
inctype:用于指定执行导出操作的增量类型
rows:用于指定执行导出操作是否要导出表中的数据
file:用于指定导出文件名

导出表(要在命令提示符中输入)
1)导出自己的表
exp userid=scott/tiger@orcl tables=(emp) file=e:\e1.dmp

例如
E:\app\asus\product\11.2.0\dbhome_1\BIN>exp userid=scott/tiger@orcl tables=(emp) file=e:\e1.dmp

要是要导出多张表
exp userid=scott/tiger@orcl tables=(emp,dept...) file=e:e2.dmp

E:\app\asus\product\11.2.0\dbhome_1\BIN>exp userid=scott/tiger@orcl tables=(emp,
dept) file=e:\e1.txt

Export: Release 11.2.0.1.0 - Production on 星期日 1月 24 23:05:26 2016

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Produc
tion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即将导出指定的表通过常规路径...
. . 正在导出表                             EMP导出了          14 行
. . 正在导出表                            DEPT导出了           4 行
成功终止导出, 没有出现警告。


2)导出其它方案的表
如果用户要导出其它方案的表,则需要dba的权限或是exp_full_database的权限

比如system就可以导出scott的表
exp userid=system/Mayu2638@oral tables=(scott.emp) file=e:\e2.dmp

特别注意:

在导入和导出的时候,要到oracle目录的 bin目录下。

导出表
3)导出表的结构
exp userid=scott/tiger@orcl tables=(emp) file=e:\e4.dmp rows=n

实例:
E:\app\asus\product\11.2.0\dbhome_1\BIN>exp userid=scott/tiger@orcl tables=(emp,
dept) file=e:\e3.dmp rows=n

Export: Release 11.2.0.1.0 - Production on 星期日 1月 24 23:23:07 2016

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Produc
tion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集
注: 将不导出表数据 (行)

即将导出指定的表通过常规路径...
. . 正在导出表                             EMP
. . 正在导出表                            DEPT
成功终止导出, 没有出现警告。



4)使用直接导出方式(专门处理数据量大的表)
exp userid=scott/tiger@orcl tables=(emp) file=e:\e5.dmp direct=y

实例:
E:\app\asus\product\11.2.0\dbhome_1\BIN>exp userid=scott/tiger@orcl tables=(emp,
dept) file=e:\e4.dmp direct=y

Export: Release 11.2.0.1.0 - Production on 星期日 1月 24 23:26:04 2016

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.


连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Produc
tion
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即将导出指定的表通过直接路径...
. . 正在导出表                             EMP导出了          14 行
. . 正在导出表                            DEPT导出了           4 行
成功终止导出, 没有出现警告。



这种方式比默认的常规方式速度要快,当数据量大时,可以考虑使用这样的方法
这时需要数据库的字符集要与客户端字符集完全一致,否则会报错...

猜你喜欢

转载自1124117571.iteye.com/blog/2286015