网络管理员备份与恢复中常用术语表集合

| 收藏本文 下载本文 作者:ZZZ

下面给大家分享网络管理员备份与恢复中常用术语表集合(共含8篇),欢迎阅读!同时,但愿您也能像本文投稿人“ZZZ”一样,积极向本站投稿分享好文章。

网络管理员备份与恢复中常用术语表集合

篇1:网络管理员备份与恢复中常用术语表集合

管理员:Administrator,被授权配置、安装和管理VERITAS NetBackup软件的用户,

归档:Archive,在二级存储中复制主存储,然后从主存储中删除文件。

目的是让数据的保留时间更长。

备份:Backup,在二级备份中复制主存储文件,但不将文件从主存储中删除。

目的是防止数据出现系统故障和意外丢失。

备份镜像:Backup Image,在每次备份或归档操作中,VERITAS NetBackup™ 软件为客户端保存的数据的集合,包括所有相关文件、目录和编录信息。

备份窗口:Backup Window,完成自动备份与用户引导的备份和归档的这段时间。

客户端策略:Client Policy,管理员指定的共享共同备份特征的一组客户端。

命令行界面:Command Line Interface,由VERITAS NetBackup软件提供的基于客户端的用户界面,可以通过命令和shell脚本,控制备份及恢复操作。

软件压缩:Software Compression,减少客户端的备份镜像的尺寸,最大程度地降低数据恢复需求和网络流量的操作。

配置数据库:Configuration Database,包括服务器、客户端和存储装置定义、客户端策略定义、日程安排等内容的VERITAS NetBackup数据库。

Daemon:一个与内核分离的UNIX过程,可执行特殊任务。

解压缩:Decompression,在恢复操作过程中重建压缩数据的操作。

设备数据库:Device Database,VERITAS NetBackup介质管理器的数据库,包括关于VERITAS NetBackup配置中的磁带和光盘存储设备的信息。

文件数据库:File Database,VERITAS NetBackup的数据库,包含说明过去的备份和归档的信息。

频率:Frequency,根据特殊VERITAS NetBackup日程进行的多次成功备份之间的指定时间。

完全备份:Full Backup,备份客户端上的所有规定文件。

图形用户界面(GUI):VERITAS NetBackup软件提供的基于管理员或客户端的用户界面,符合OSF/Motif规范。

增量备份:Incremental Backup,只备份上一次备份后发生了变化的特殊客户端文件。

主服务器:Master Server,进行所有管理操作的服务器,负责所有备份的日程安排。

介质服务器:Media Server,在主服务器(管理其他二级存储装置)控制下运行的服务器,

菜单界面:Menu Interface,VERITAS NetBackup软件提供的基于管理员或客户端的界面,供没有图形用户界面功能的用户使用

多卷设备:Multiple Volume Device,物理存储设备,由于内置机械手控制,修改卷时不需要手动介入

多路复用技术:Multiplexing,通过多个同步备份,将数据传输到同一设备上。

NetBackup域:NetBackup Domain,单个NetBackup主服务器及其相关介质服务器。

NFS挂载:NFS Mounts,驻留在远程节点上的文件,通过NFS协议挂载到本地节点。

主存储:Primary Storage,直接与维护新数据或有效数据的客户端或服务器相连的在线磁盘存储。

裸分区恢复:Raw Partition Restore,磁盘驱动器分区的物理备份。

可移动的介质:Removable Media,没有永久安装在二级存储设备上的盒式磁带或光盘。

恢复:Restore,将以往的备份或归档文件从二级存储恢复回到主存储的操作。

保留水平:Retension Level,规定备份或归档在被删除前的保存时间长度参数。

机械手:Robotic,执行通常分配给NetBackup用户完成的复杂机械任务,如选择一个可移动的介质,并将它载入二级存储设备。

二级存储:Secondary Storage,与备份或归档来自主存储的存储服务器相连的辅助存储。

安全客户端:Secure Client,不需要服务器的a /.rhosts文件输入的客户端。

单卷设备:Single Volume Device,需要手动介入来修改卷的物理存储设备。

独立设备:Standalone Device,需要手动介入来修改卷的物理存储设备。

存储介质:Storage Media,可以存储数据的任何对象,例如磁带、盒式磁带和磁盘/光盘等。

存储单元:Storage Unit,VERITAS NetBackup软件使用的逻辑实体,包括一个或多个存储设备,这些设备属于某种特殊类型或介质密度,附加在特定主机上。

真实镜像恢复(TIR):True Image Restore,只恢复在特定备份的某个日期和时间存在于目录中的文件,先前删除的文件忽略不计。

信任客户端:Trusting Client,带有a /.rhosts文件条目(供服务器使用)的客户端。

用户:User,操作客户端工作站的人员。

卷:Volume,任何物理存储介质,如磁带或光盘等。

卷数据库:Volume Database,VERITAS NetBackup介质管理器数据库,包括在备份和恢复操作中的卷管理信息。

篇2:逻辑备份与恢复

oracle227

逻辑备份与恢复备份与恢复简介:

备份是数据库中数据的副本,它可以保护数据在出现意外

损失时最大限度的恢复,

Oracle数据库的备份包括以下两种类型:

物理备份是对数据库的操作系统物理文件(如数据文件、控制文件和日志文件等)的备份:RMAN备份

逻辑备份是对数据库逻辑组件(如表、视图和存储过程等数据库对象)的备份:imp[dp]/exp[dp]

故障类型:

导致数据库操作中止的故障包括四种类型:

语句故障:在执行 SQL 语句无效可导致语句故障。

用户进程故障:当用户程序出错而无法访问数据库时发生用户进程故障。导致用户进程故障的原因是异常断开连接或异常终止进程

实例故障:当 Oracle 的数据库实例由于硬件或软件问题而无法继续运行时,就会发生实例故障

介质故障:在数据库无法正确读取或写入某个数据库文件时,会发生介质故障

语句故障select * from aa;//假如aa表并不存在的情况不需要处理用户进程故障用户(死机、用户进程消失了)<――>连接<――>服务器(pmon进程处理,监测到客户端进程消失后马上就把serverPro杀死掉)不需要处理实例故障oracle服务器死机、坏掉了,通过重启oracle就可以解决实例故障不需要处理介质故障硬盘坏了导致数据文件丢失或者损坏了需要dba来进行处理

传统的导入导出:

简介:传统的导出导入程序用于实施数据库的逻辑备份和恢复导出程序将数据库中的对象定义和数据备份到一个操作系统二进制文件中导入程序读取二进制导出文件并将对象和数据载入数据库中传统的导出导入程序是客户端工具。

导出和导入实用程序的特点有:可以按时间保存表结构和数据允许导出指定的表,并重新导入到新的数据库中可以把数据库迁移到另外一台异构服务器上在两个不同版本的Oracle数据库之间传输数据在联机状态下进行备份和恢复可以重新组织表的存储结构,减少链接及磁盘碎片

使用以下三种方法调用导出和导入实用程序:

1,交互提示符:以交互的方式提示用户逐个输入参数的值。

2,命令行参数:在命令行指定执行程序的参数和参数值。

3,参数文件:允许用户将运行参数和参数值存储在参数文件中,以便重复使用参数

导出和导入数据库对象的四种模式是:四种模式独立互斥的,不能同时存在

1,数据库模式:导出和导入整个数据库中的所有对象

2,表空间模式:导出和导入一个或多个指定的表空间中的所有对象

3,用户模式:导出和导入一个用户模式中的所有对象

4,表模式:导出和导入一个或多个指定的表或表分区表的高水位线可以使用导入导出来下降

导出操作的基本命令参数:

参数

说明

USERID

确定执行导出实用程序的用户名和口令

BUFFER

确定导出数据时所使用的缓冲区大小,其大小用字节表示

FILE

指定导出的二进制文件名称,默认的扩展名是.dmp

FULL

指定是否以全部数据库方式导出,只有授权用户才可使用此参数

OWNER

要导出的数据库用户列表

HELP

指定是否显示帮助消息和参数说明

ROWS

确定是否要导出表中的数据

TABLES

按表方式导出时,指定需导出的表和分区的名称

PARFILE

指定传递给导出实用程序的参数文件名

TABLESPACES

按表空间方式导出时,指定要导出的表空间名

[root@ localhost ~]# su - oracle[oracle@ localhost ~]$ clear[oracle@ localhost ~]$ cd $ORACLE_BASE[oracle@ localhost oracle]$ lsadmin archive cfgtoollogs checkpoints diag flash_recovery_area oradata pl_sql_pacakge[oracle@ localhost oracle]$ mkdir - p test_imp_exp[oracle@ localhost oracle]$ cd test_imp_exp/[oracle@ localhost test_imp_exp]$ ls[oracle@ localhost test_imp_exp]$ pwd/u01 /app /oracle /test_imp_exp[oracle@ localhost test_imp_exp]$ sqlplus hr/ hr@ jiagulun

SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 20 23: 50: 52

Copyright ( c) 1982 , , Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>select * from student;

ID NAMEAGE---------- -------------------- ----------

SQL>select * from address;

XH ZZ---------- ----------

SQL>exit;Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options[oracle@ localhost test_imp_exp]$ exp help =y--通过这个来查看关于exp命令的解释

Export: Release 11.2.0.1.0 - Production on Tue Jan 20 23:51:56 2015

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

You can let Export prompt you for parameters by entering the EXPcommand followed by your username/password :

Example: EXP SCOTT/TIGER

Or, you can control how Export runs by entering the EXP command followedby various arguments. To specify parameters, you use keywords:

Format: EXP KEYWORD= value or KEYWORD =(value1 ,value2 ,... ,valueN ) Example: EXP SCOTT/TIGER GRANTS=Y TABLES=( EMP, DEPT, MGR) or TABLES=( T1: P1, T1: P2), if T1 is partitioned table

USERID must be the first parameter on the command line.

Keyword Description (Default )KeywordDescription (Default )--------------------------------------------------------------------------USERID username/password FULL export entire file (N )BUFFER size of data buffer OWNER list of owner usernamesFILE output files (EXPDAT.DMP ) TABLES list of table namesCOMPRESS import into one extent (Y ) RECORDLENGTH length of IO recordGRANTS export grants (Y) INCTYPEincremental export typeINDEXES export indexes (Y ) RECORD track incr. export (Y )DIRECT direct path (N )TRIGGERS export triggers (Y )LOG log file of screen output STATISTICS analyze objects (ESTIMATE )ROWS export data rows (Y ) PARFILEparameter filenameCONSISTENT cross- table consistency (N ) CONSTRAINTS export constraints (Y )

OBJECT_CONSISTENT transaction set to read only during object export (N )FEEDBACK display progress every x rows (0 )FILESIZE maximum size of each dump fileFLASHBACK_SCN SCN used to set session snapshot back toFLASHBACK_TIME time used to get the SCN closest to the specified timeQUERY select clause used to export a subset of a tableRESUMABLEsuspend when a space related error is encountered (N )RESUMABLE_NAME text string used to identify resumable statementRESUMABLE_TIMEOUT wait time for RESUMABLETTS_FULL_CHECK perform. full or partial dependency check for TTSVOLSIZE number of bytes to write to each tape volumeTABLESPACES list of tablespaces to exportTRANSPORT_TABLESPACE export transportable tablespace metadata (N)TEMPLATE template name which invokes iAS mode export

[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tables =student file=/u01/app/oracle/test_imp_exp/hr_student_file.dbf log=/u01/app/oracle/test_imp_exp/hr_student_log.log

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:05:42 2015--上面的命令为通过导出表的模式导出student表

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path .... . exporting tableSTUDENT 4 rows exportedExport terminated successfully without warnings.[oracle@ localhost test_imp_exp]$ ! ls - als - a. .. expdat.dmp hr_student_file.dbf hr_student_log.log

[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tablespaces= users file=/u01/app/oracle/test_imp_exp/hr_tbs_users_file.dbf log=/u01/app/oracle/test_imp_exp/hr_tbs_users_log.log

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:08:23 2015--导出表空间

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing optionsEXP-00023 : must be a DBA to do Full Database or Tablespace export--假如是导出数据库或者恶表空间需要dba来做(2) U( sers), or ( 3) T( ables): ( 2) U >u--自动跳到了交互提示符模式:exp

Export grants (yes /no ): yes >yes

Export table data (yes /no ): yes >yes

Compress extents (yes /no ): yes >yes

Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export selected tablespaces ...

. exporting referential integrity constraints. exporting triggersExport terminated successfully with warnings.[oracle@ localhost test_imp_exp]$ lsexpdat.dmp hr_student_file.dbf hr_student_log.log hr_tbs_users_file.dbf hr_tbs_users_log.log[oracle@ localhost test_imp_exp]$ lltotal 40-rw -r--r-- 1 oracle oinstall 0 Jan 21 00:02 expdat.dmp-rw -r--r-- 1 oracle oinstall 16384 Jan 21 00:05 hr_student_file.dbf-rw -r--r-- 1 oracle oinstall 427 Jan 21 00:05 hr_student_log.log-rw -r--r-- 1 oracle oinstall 16384 Jan 21 00:10 hr_tbs_users_file.dbf-rw -r--r-- 1 oracle oinstall 463 Jan 21 00:10 hr_tbs_users_log.log[oracle@ localhost test_imp_exp]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 00: 11: 22 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>create user test1 identified by test1;

User created.

SQL>grant connect, resource to test1 ;

Grant succeeded.

SQL> create table test_export_tab(id number (20 ),name varchar2 (20 ));

Table created.

SQL>insert into test_export_tab values( 1, ‘zhangsan‘);

1 row created.

SQL>exit;Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tables=test1.test_export_tab file=/u01/app/oracle/test_imp_exp/hr_test1_tab_file.dbf log=/u01/app/oracle/test_imp_exp/hr_test1_tab_log.log

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:20:07 2015--导出不同用户的表

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...EXP-00009 : no privilege to export TEST1 ‘s table TEST_EXPORT_TABExport terminated successfully with warnings.--导出不同用户的数据信息必须有权限[oracle@localhost test_imp_exp]$ exp system/oracle@jiagulun tables=test1.test_export_tab file=/u01/app/oracle/test_imp_exp/hr_test1_tab_file.dbf log=/u01/app/oracle/test_imp_exp/hr_test1_tab_log.log

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:23:48 2015--system用户可以导出不同用户数据

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 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path ...Current user changed to TEST1. . exporting table TEST_EXPORT_TAB 1 rows exportedExport terminated successfully without warnings.

导入操作的基本命令参数:

参数

说明

USERID

指定执行导入的用户名和密码

BUFFER

指定用来读取数据的缓冲区大小,以字节为单位

COMMIT

指定是否在每个数组(其大小由BUFFER参数设置)插入后进行提交

FILE

指定要导入的二进制文件名

FROMUSER

指定要从导出转储文件中导入的用户模式

TOUSER

指定要将对象导入的用户名。FROMUSER与TOUSER可以不同

FULL

指定是否要导入整个导出转储文件

TABLES

指定要导入的表的列表

ROWS

指定是否要导入表中的行

PARFILE

指定传递给导入实用程序的参数文件名,此文件可以包含这里列出的所有参数

IGNORE

导入时是否忽略遇到的错误,默认为N

TABLESPACES

按表空间方式导入,列出要导入的表空间名

[oracle@ localhost test_imp_exp]$ exp hr/ hr@ jiagulun tables = student,address file = $ORACLE_BASE /test_imp_exp /hr_stu_add log = $ORACLE_BASE/test_imp_exp /hr_stu_add

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 00:56:30 2015--导出文件的表不是table=(tab1,tab2)而是如上面所示

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Conventional Path .... . exporting tableSTUDENT 4 rows exported. . exporting tableADDRESS 4 rows exportedExport terminated successfully without warnings.[oracle@ localhost test_imp_exp]$ lshr_stu_add.dmp hr_stu_add.log[oracle@ localhost test_imp_exp]$ sqlplus hr/ hr

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 00: 57: 04 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>drop table address;

Table dropped.

SQL>drop table student;

Table dropped.

SQL>commit;

Commit complete.

SQL>purge recyclebin;--清除回收站

Recyclebin purged.

SQL>exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options[oracle@ localhost test_imp_exp]$ imp hr/hr@jiagulun file=$ORACLE_BASE/test_imp_exp/hr_stu_add.dmp

Import: Release 11.2 .0.1.0 - Production on Wed Jan 21 00 :59 :27 2015--导入表到自己当中去

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

Export file created by EXPORT: V11.02.00 via conventional pathimport done in ZHS16GBK character set and AL16UTF16 NCHAR character set. importing HR‘s objects into HR. importing HR‘ s objects into HR. . importing table “STUDENT” 4 rows imported. . importing table “ADDRESS” 4 rows importedAbout to enable constraints...Import terminated successfully without warnings.[oracle@ localhost test_imp_exp]$ imp hr/hr@jiagulun file=$ORACLE_BASE/test_imp_exp/hr_stu_add.dmp fromuser =hr touser=test1

Import: Release 11.2 .0.1.0 - Production on Wed Jan 21 01 :00 :31 2015--通过其他用户把表导入到另外用户中去

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

Export file created by EXPORT: V11.02.00 via conventional pathimport done in ZHS16GBK character set and AL16UTF16 NCHAR character setIMP- 00007: must be a DBA to import objects to another user ‘s accountIMP-00000: Import terminated unsuccessfully--通过其他用户把表导入到另外用户中去,这是不行的[oracle@localhost test_imp_exp]$ imp test1/test1@jiagulun file=$ORACLE_BASE/test_imp_exp/hr_stu_add.dmp fromuser=hr touser=test1 tables=student

Import: Release 11.2.0.1.0 - Production on Wed Jan 21 01:01:26 2015--自己导入其他用户的表到自己当中去

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 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by HR, not by you--可以导入,但是会有警告

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set. importing HR‘ s objects into TEST1. . importing table “STUDENT” 4 rows importedImport terminated successfully without warnings.[oracle@ localhost test_imp_exp]$ imp system/ oracle@ jiagulun file=$ORACLE_BASE/test_imp_exp/hr_stu_add.dmp fromuser =hr touser=test1 tables= address

Import: Release 11.2 .0.1.0 - Production on Wed Jan 21 01 :02 :00 2015--通过system导入其他表到另外用户中可以

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

Export file created by EXPORT: V11.02.00 via conventional path

Warning: the objects were exported by HR , not by you--通过system导入其他表到另外用户中可以但也会有警告出现

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set. importing HR‘s objects into TEST1. . importing table “ADDRESS” 4 rows importedAbout to enable constraints...Import terminated successfully without warnings.[oracle@localhost test_imp_exp]$ sqlpus test1/test1-bash: sqlpus: command not found[oracle@localhost test_imp_exp]$ sqlplus test1/test1

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 01:02:22 2015

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>select * from tab;

TNAME TABTYPE CLUSTERID------------------------------ ------- ----------ADDRESSTABLESTUDENTTABLETEST_EXPORT_TAB TABLE

SQL>假如我想导入用户已经存在的表:需要添加ignore参数下面是通过交互提示符的方式导入的:没有添加ignore

[oracle@localhost test_imp_exp]$ imp

Import: Release 11.2.0.1.0 - Production on Wed Jan 21 01:33:00 2015

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

Username: test1

Password:

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Import data only (yes/no): no >

Import file: expdat.dmp >hr_stu_add.dmp

Enter insert buffer size (minimum is 8192) 30720>

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by HR, not by you

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set

List contents of import file only (yes/no): no >

Ignore create error due to object existence (yes/no): no >

Import grants (yes/no): yes >

Import table data (yes/no): yes >

Import entire export file (yes/no): no >

Username: hr

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 HR‘s objects into TEST1

. importing HR‘s objects into TEST1

IMP-00015: following statement failed because the object already exists:

“CREATE TABLE ”STUDENT“ (”ID“ NUMBER(10, 0), ”NAME“ VARCHAR2(20), ”AGE“ NUMB”

“ER(10, 0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6”

“5536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DE”

“FAULT) LOGGING NOCOMPRESS”

IMP-00015: following statement failed because the object already exists:

“CREATE TABLE ”ADDRESS“ (”XH“ NUMBER, ”ZZ“ VARCHAR2(10)) PCTFREE 10 PCTUSED”

“ 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1”

“ FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) LOGG”

“ING NOCOMPRESS”

Import terminated successfully with warnings.下面是通过参数文件的方式导入的:添加ignore

file=$ORACLE_BASE/test_imp_exp/hr_stu_add.dmp

ignore=y

fromuser=hr

touser=test1

[oracle@localhost test_imp_exp]$ imp test1/test1@jiagulun parfile=imp_by_spfile

Import: Release 11.2.0.1.0 - Production on Wed Jan 21 01:46:58 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path

Warning: the objects were exported by HR, not by you

import done in ZHS16GBK character set and AL16UTF16 NCHAR character set

. importing HR‘s objects into TEST1

. . importing table “STUDENT”

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_STUDENT) violated

Column 1 1

Column 2 ????

Column 3 20

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_STUDENT) violated

Column 1 2

Column 2 ????

Column 3 25

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_STUDENT) violated

Column 1 3

Column 2 ????

Column 3 30

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_STUDENT) violated

Column 1 4

Column 2 ????

Column 3 30 0 rows imported

. . importing table “ADDRESS”

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_ADDRESS) violated

Column 1 3

Column 2 ????

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_ADDRESS) violated

Column 1 2

Column 2 ???

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_ADDRESS) violated

Column 1 1

Column 2 ????

IMP-00019: row rejected due to ORACLE error 1

IMP-00003: ORACLE error 1 encountered

ORA-00001: unique constraint (TEST1.PK_ADDRESS) violated

Column 1 4

Column 2 ???? 0 rows imported

About to enable constraints...

Import terminated successfully with warnings.

[oracle@localhost test_imp_exp]$

之所以会出现建表语句是因为exp操作就是把数据库中的表的建表信息,数据信息,对象信息全部转换成sql语句当使用Imp的其实也就是执行里面的sql语句。当ignore设置为Y时,oracle会忽略其中的错误重新执行一遍建表操作,数据插入操作等

可传输表空间:下面模拟两个不同主机下的不同数据库进行表空间的传输操作:

明确什么事自包含?

就是要传输的表空间的对象中被建立的对象存放在其他表空间中:例如表,可以把表的索引建立在其他的表空间中,这样就不是自包含了。

在Linux下进行的传输表空间:

[oracle@ localhost imp_tran_file]$ sqlplus / as sysdba--sys登录oracle数据库

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 18: 06: 45 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>create tablespace test_tran_ts datafile ‘/u01/app/oracle/oradata/jiagulun/test_tran_ts_file.dbf‘ size 10 m;

Tablespace created.--创建表空间

SQL>create table test_tran_tab1 (id number ,name varchar2 (20 )) tablespace test_tran_ts ;

Table created.--在该表空间中创建表

SQL> alter tablespace test_tran_ts read only;

Tablespace altered.--修改表空间为只读的状态

[oracle@ localhost imp_tran_file]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 18: 18: 58 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>exec dbms_tts.transport_set_check (test_tran_ts ,true );BEGIN dbms_tts.transport_set_check (test_tran_ts ,true ); END;

*ERROR at line 1:ORA-06550 : line 1, column 36 :PLS-00201 : identifier ‘TEST_TRAN_TS‘ must be declaredORA-06550 : line 1, column 7 :PL/SQL: Statement ignored

SQL>exec dbms_tts.transport_set_check (‘test_tran_ts‘ ,true );--检查表空间的是否是自包含

PL/SQL procedure successfully completed.

SQL>SELECT * FROM TRANSPORT_SET_VIOLATIONS ;--检查表空间的是否是自包含

no rows selected

SQL>exit;Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

[oracle@ localhost test_imp_exp]$ exp \‘system/oracle@jiagulun as sysdba\‘ tablespaces=test_tran_ts transport_tablespace =y file=/u01/app/oracle/test_imp_exp/exp_tran_file.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 18:25:37 2015

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

EXP-00056 : ORACLE error 1031 encounteredORA-01031 : insufficient privilegesUsername:Password:

EXP-00056 : ORACLE error 1017 encounteredORA-01017 : invalid username /password ; logon deniedUsername:Password:

EXP-00056 : ORACLE error 1017 encounteredORA-01017 : invalid username /password ; logon deniedEXP-00005 : all allowable logon attempts failedEXP-00000 : Export terminated unsuccessfully[oracle@ localhost test_imp_exp]$ exp \‘sys/oracle@jiagulun as sysdba\‘ tablespaces=test_tran_ts transport_tablespace =y file=/u01/app/oracle/test_imp_exp/exp_tran_file.dmp--必须使用sys用户而且是as sysdba才可以--在Linux中需要对‘进行转义才可以Export: Release 11.2.0.1.0 - Production on Wed Jan 21 18:25:49 2015

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing optionsExport done in ZHS16GBK character set and AL16UTF16 NCHAR character setNote: table data ( rows) will not be exportedAbout to export transportable tablespace metadata...For tablespace TEST_TRAN_TS .... exporting cluster definitions. exporting table definitions. exporting referential integrity constraints. exporting triggers. end transportable tablespace metadata exportExport terminated successfully without warnings.[oracle@ localhost test_imp_exp]$ lsexp_tran_file.dmp hr_stu_add.dmp hr_stu_add.log imp_by_spfile[oracle@ localhost test_imp_exp]$ mkdir -p imp_tran_file--之所以建立一个文件夹是因为模拟是从另外一台主机拷贝过来的,统一放在该目录下[oracle@ localhost test_imp_exp]$ lsexp_tran_file.dmp hr_stu_add.dmp hr_stu_add.log imp_by_spfile imp_tran_file[oracle@ localhost test_imp_exp]$ cp - avf /u01 /app /oracle /oradata /jiagulun /test_tran_tstest_tran_ts01.dbf test_tran_ts_file.dbf[oracle@ localhost test_imp_exp]$ cp - avf /u01 /app /oracle /oradata /jiagulun /test_tran_ts_file.dbf . /imp_tran_file /`/ u01/ app/ oracle/ oradata/ jiagulun/ test_tran_ts_file.dbf‘ ->`./imp_tran_file/test_tran_ts_file.dbf‘[oracle@ localhost test_imp_exp]$ cd imp_tran_file/[oracle@ localhost imp_tran_file]$ lsexp_tran_file.dmp test_tran_ts_file.dbf[oracle@ localhost imp_tran_file]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 18: 29: 38 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>drop tablespace test_tran_ts including contents;--删除刚刚创建的表空间,因为实际上是在同一个oracle中进行传输表空间的

Tablespace dropped.

SQL>exitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options[oracle@ localhost imp_tran_file]$ imp \‘sys/oracle@jiagulun as sysdba\‘ tablespaces=test_tran_ts transport_tablespace =y file=/u01/app/oracle/test_imp_exp/imp_tran_file/exp_tran_file.dmp datafiles=/u01/app/oracle/test_imp_exp/imp_tran_file/test_tran_ts_file.dbf--导入表空间Import: Release 11.2 .0.1.0 - Production on Wed Jan 21 18 :32 :15 2015

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 - 64bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

Export file created by EXPORT: V11.02.00 via conventional pathAbout to import transportable tablespace (s ) metadata...import done in ZHS16GBK character set and AL16UTF16 NCHAR character set. importing SYS‘s objects into SYS. importing SYS‘ s objects into SYSImport terminated successfully without warnings.[oracle@ localhost imp_tran_file]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 18: 32: 25 2015

Copyright ( c) 1982 , 2009, Oracle. All rights reserved.

Connected to :Oracle Database 11 g Enterprise Edition Release 11.2 .0.1.0 - 64 bit ProductionWith the Partitioning , OLAP , Data Mining and Real Application Testing options

SQL>set linesize 10000 pagesize 10000;SQL>select dt.tablespace_name ,dt.block_size ,dt.status ,dt.contents from dba_tablespaces dt;

TABLESPACE_NAME BLOCK_SIZE STATUS CONTENTS------------------------------ ---------- --------- ---------SYSTEM 8192 ONLINE PERMANENTSYSAUX 8192 ONLINE PERMANENTUNDOTBS1 8192 ONLINE UNDOTEMP 8192 ONLINE TEMPORARYUSERS 8192 ONLINE PERMANENTUNDOTBS2 8192 ONLINE UNDOEXAMPLE8192 ONLINE PERMANENTTESTTS 8192 ONLINE PERMANENTTEMP2 8192 ONLINE TEMPORARYTEMP3 8192 ONLINE TEMPORARYTEST_TRAN_TS 8192 READ ONLY PERMANENT

11 rows selected.

SQL>alter tablespace TEST_TRAN_TS read, write;alter tablespace TEST_TRAN_TS read, write *ERROR at line 1:ORA-02142 : missing or invalid ALTER TABLESPACE option

SQL>alter tablespace TEST_TRAN_TS read write;--修改表空间的状态

Tablespace altered.

SQL>insert into test_tran_tab values( 1, ‘张三‘);insert into test_tran―n_tab values( 1, ‘张三‘)*ERROR at line 1:ORA-00942 : table or view does not exist

SQL>insert into test_tran_tab values( 1, ‘zs‘);

1 row created.

SQL>select * from test_tran_tab;

ID NAME---------- --------------------1 zs

SQL>

使用数据泵的方式导入导出:

exp/imp的缺点是速度太慢,在大型生产库中尤其明显。从10g开始,oracle设计了数据泵,这是一个服务器端的工

具,它为Oracle数据提供高速并行及大数据的迁移。imp/exp可以在客户端调用,但是expdp/impdp只能在服

务端,因为在使用expdp/impdp以前需要在数据库中创建一个 Directory 。

在expdp进行导出时,先创建了MT表,并把对象的信息插入到MT表,之后进行导出动作;导出完成后,MT表也导

出到转储文件中;导出任务完成后、或者删除了导出任务后,MT表自动删除;如果导出任务异常终止,MT表仍然保留。

expdp也具有四种模式:表、用户、可传输表空间、全库。

数据泵的导出:1,部分的exp中的参数仍然可用,有的不能使用,如index。

2,directory:供转储文件和日志文件使用的目录对象。

3,job_name:指定的任务的名称。

4,content:指定要导出的数据, 其中有效关键字值为: (ALL), DATA_ONLY 和 METADATA_ONLY,当设置content为ALL 时,将导出对象定义及其所有数据;

DATA_ONLY时,只导出对象数据;为METADATA_ONLY时,只导出对象定义 。

5,reuse_dumpfiles:如果导出文件已经存在,是否覆盖。

6,compression:压缩导出文件。

7,estimate:指定估算被导出表所占用磁盘空间分方法.默认值是BLOCKS

8, estimate_only:是否只估算导出占用的磁盘空间,而不进行真正的导出,默认是N。

9,exclude:用于指定执行操作时要排除对象类型或相关对象,用法:EXCLUDE=object_type[:name_clause] [,….]

10,include:用于指定执行操作时要包含的对象类型或相关对象,用法:INCLUDE=object_type[:name_clause] [,….]

11,query:导出符合条件的行。

12,attch:连接到现有的作业,可以用在中断导出任务后重新启动导出任务。----------------------------------------------------------------[oracle@localhost oracle]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 21 20:50:29 2015

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create directory test_impdp_expdp as ‘/u01/app/oracle/test_impdp_expdp‘;

Directory created.--创建目录

SQL>grant write,read on directory test_impdp_expdp to hr;

Grant succeeded.--给用户赋予权限

SQL> grant write,read on directory test_impdp_expdp to test1;

Grant succeeded.--给用户赋予权限

SQL>exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Productio

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@localhost oracle]$ cd test_impdp_expdp/

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP dumpfile

--默认是多出用户的所有的对象

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:14:04 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_SCHEMA_01”: hr/********@jiagulun directory=TEST_IMPDP_EXPDP dumpfi

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 768 KB

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE

Processing object type SCHEMA_EXPORT/CLUSTER/CLUSTER

Processing object type SCHEMA_EXPORT/CLUSTER/INDEX

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type SCHEMA_EXPORT/TABLE/COMMENT

Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC

Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE

Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC

Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE

Processing object type SCHEMA_EXPORT/VIEW/VIEW

Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/TRIGGER

Processing object type SCHEMA_EXPORT/EVENT/TRIGGER

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

Processing object type SCHEMA_EXPORT/JOB

. . exported “HR”.“ADDRESS”5.476 KB 2 rows

. . exported “HR”.“COUNTRIES” 6.367 KB25 rows

. . exported “HR”.“DEPARTMENTS” 7.007 KB27 rows

. . exported “HR”.“DEPT” 5.492 KB 3 rows

. . exported “HR”.“DROPPED_OBJ” 6.367 KB21 rows

. . exported “HR”.“EMPLOYEES” 16.81 KB 107 rows

. . exported “HR”.“JOBS” 6.992 KB19 rows

. . exported “HR”.“JOB_HISTORY” 7.054 KB10 rows

. . exported “HR”.“LOCATIONS” 8.273 KB23 rows

. . exported “HR”.“REGIONS”5.476 KB 4 rows

. . exported “HR”.“STUDENT”5.937 KB 3 rows

. . exported “HR”.“TEST_JOB” 24.74 KB 1684 rows

Master table “HR”.“SYS_EXPORT_SCHEMA_01” successfully loaded/unloaded

******************************************************************************

Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:

/u01/app/oracle/test_impdp_expdp/test_exp_01.dmp

Job “HR”.“SYS_EXPORT_SCHEMA_01” successfully completed at 22:16:07

[oracle@localhost test_impdp_expdp]$ ls

export.log test_exp_01.dmp

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP TABLES=Sexp_02.dmp EXCLUDE=INDEX:“=\‘INDEX_ADDRESS_NAME\‘”

LRM-00116: syntax error at ‘INDEX:‘ following ‘=‘

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP TABLES=Sexp_02.dmp EXCLUDE=INDEX:“IN\‘INDEX_ADDRESS_NAME\‘”

.--通过上面的导出你会发现需要对‘进行转义,而且是IN关键字Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:25:09 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_TABLE_01”: hr/********@jiagulun directory=TEST_IMPDP_EXPDP TABLES=_exp_02.dmp EXCLUDE=INDEX:IN\‘INDEX_ADDRESS_NAME\‘

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 128 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported “HR”.“ADDRESS”5.476 KB 2 rows

. . exported “HR”.“STUDENT”5.937 KB 3 rows

Master table “HR”.“SYS_EXPORT_TABLE_01” successfully loaded/unloaded

******************************************************************************

Dump file set for HR.SYS_EXPORT_TABLE_01 is:

/u01/app/oracle/test_impdp_expdp/test_exp_02.dmp

Job “HR”.“SYS_EXPORT_TABLE_01” successfully completed at 22:25:20

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student,address encryption=dmpfiles=test_exp_encrytion_reuse_01.dmp

LRM-00101: unknown parameter name ‘dumpfiles‘

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student,address encryption=dmpfile=test_exp_encrytion_reuse_01.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:32:31 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39002: invalid operation

ORA-39070: Unable to open the log file.

ORA-39145: directory object parameter must be specified and non-null

--对于上面的错误是因为没有打开或者不存在encryption wallet所以需要进行下面操作:

oracle Wallet的使用(即内部加密技术TDE(Transparent Data Encryption ))

1. TDE是Oracle10gR2中推出的一个新功能,使用时要保证Oracle版本是在10gR2或者以上

--查看oracle版本:

select * from v$version;

2、创建一个新目录,并指定为Wallet目录

D:\oracle\product\10.2.0\admin\ora10\ora_wallet

3. 设置wallet目录,在参数文件sqlnet.ora中(window+f,在你安装盘区查找sqlnet.ora),按照下面的格式加入信息:

ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)

(METHOD_DATA=(DIRECTORY=D:\oracle\product\10.2.0\admin\ora10\ora_wallet)))

4. 创建master key文件,指定wallet密码,使用SYS用户登入系统,建立加密文件

SQL>alter system set encryption key identified by “wallet”;

System altered

-- 密码“wallet”不加引号时,后面使用时也不需要用引号

此时在设置的目录下,多出一个Personal Information Exchange类型的文件,相当于我们生成的master key文件,

电脑资料

D:\oracle\product\10.2.0\admin\ora10\ora_wallet\ewallet.p12

5、启动、关闭Wallet

SQL>ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY “wallet”;

ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY “wallet”

ORA-28354: wallet 已经打开

SQL> ALTER SYSTEM SET ENCRYPTION WALLET CLOSE; --关闭

System altered

SQL>ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY “wallet”; --打开

System altered

到此,已经成功配置了Wallet,创建了master key。

--通过上面的创建并且开启encryption wallet后才可以进行如下[oracle@localhost wallet]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPDP_EXPDP dumpfile=test_exp_encryption_1.dmp encryption=data_only

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:57:01 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_TABLE_01”: hr/********@jiagulun tables=student directory=TEST_IMPDP_EXPDP dumpfile=test_exp_encryption_1.dmp encryption=data_only

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported “HR”.“STUDENT”5.945 KB 3 rows

Master table “HR”.“SYS_EXPORT_TABLE_01” successfully loaded/unloaded

******************************************************************************

Dump file set for HR.SYS_EXPORT_TABLE_01 is:

/u01/app/oracle/test_impdp_expdp/test_exp_encryption_1.dmp

Job “HR”.“SYS_EXPORT_TABLE_01” successfully completed at 23:57:08

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student compression=data_onl reuse_dumpfiles=y dumpfile=test_exp_01.dmp--reuse_dumpfiles表示可以覆盖原文件

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:41:57 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_TABLE_01”: hr/********@jiagulun tables=student compression=data_on reuse_dumpfiles=y dumpfile=test_exp_01.dmp

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported “HR”.“STUDENT”4.914 KB 3 rows

Master table “HR”.“SYS_EXPORT_TABLE_01” successfully loaded/unloaded

******************************************************************************

Dump file set for HR.SYS_EXPORT_TABLE_01 is:

/u01/app/oracle/test_impdp_expdp/test_exp_01.dmp

Job “HR”.“SYS_EXPORT_TABLE_01” successfully completed at 22:42:02

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPDP_EXPDP

EXCLUDE=CONSTRAINT:IN\‘PK_PRIMARY\‘“ dumpfile=test_exp_jobname.dmp job_name=test_exp_jobname

--需要转义和大写Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:56:23 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting ”HR“.”TEST_EXP_JOBNAME“: hr/********@jiagulun tables=student directory=TEST_IMPDP_EK_PRIMARY\‘ dumpfile=test_exp_jobname.dmp job_name=test_exp_jobname

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported ”HR“.”STUDENT“5.937 KB 3 rows

Master table ”HR“.”TEST_EXP_JOBNAME“ successfully loaded/unloaded

******************************************************************************

Dump file set for HR.TEST_EXP_JOBNAME is:

/u01/app/oracle/test_impdp_expdp/test_exp_jobname.dmp

Job ”HR“.”TEST_EXP_JOBNAME“ successfully completed at 22:56:28

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPIN\‘PK_PRIMARY\‘” dumpfile=test_exp_jobname.dmp job_name=test_exp_jobname

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 22:57:02 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39000: bad dump file specification

ORA-31641: unable to create dump file “/u01/app/oracle/test_impdp_expdp/test_exp_jobname.dmp”

ORA-27038: created file already exists

Additional information: 1

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPIN\‘PK_PRIMARY\‘“ dumpfile=test_exp_jobname.dmp job_name=test_exp_jobname REUSE_DUMPFILES=Y

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:16:05 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting ”HR“.”TEST_EXP_JOBNAME“: hr/********@jiagulun tables=student directory=TEST_IMPDP_EK_PRIMARY\‘ dumpfile=test_exp_jobname.dmp job_name=test_exp_jobname REUSE_DUMPFILES=Y

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported ”HR“.”STUDENT“5.937 KB 3 rows

Master table ”HR“.”TEST_EXP_JOBNAME“ successfully loaded/unloaded

******************************************************************************

Dump file set for HR.TEST_EXP_JOBNAME is:

/u01/app/oracle/test_impdp_expdp/test_exp_jobname.dmp

Job ”HR“.”TEST_EXP_JOBNAME“ successfully completed at 23:16:19

[oracle@localhost test_impdp_expdp]$ exp hr/hr@jiagulun TABLES=STUDENT DIRECTORY=test_impdp_etion.dmp

LRM-00101: unknown parameter name ‘DIRECTORY‘

EXP-00019: failed to process parameters, type ‘EXP HELP=Y‘ for help

EXP-00000: Export terminated unsuccessfully

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP id <2” dumpfile=test_exp_query.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:17:57 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP id <2“ dumpfile=test_exp_query.dmp reuse_dumpfile=y

LRM-00101: unknown parameter name ‘reuse_dumpfile‘

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP id <2” dumpfile=test_exp_query.dmp reuse_dumpfiles=y

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:18:28 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP id <2“ dumpfile=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:18:56 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP query=s=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:19:11 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP query=s=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:19:37 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP query=se=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:21:12 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP id \<2” dumpfile=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:21:41 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMP dumpfile=test_exp_query_1.dmp

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:26:04 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPery_1.dmp query=STUDENT:“WHERE ID < 2”

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:28:16 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPery_1.dmp query=STUDENT:“WHERE ID \< 2”

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:28:23 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: invalid argument value

ORA-39035: Data filter SUBQUERY has already been specified.

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun tables=student directory=TEST_IMPery_1.dmp query=STUDENT:\“WHERE ID \< 2\”

--通过上面的错误可以知道符号需要被转义和query的使用方式

Export: Release 11.2.0.1.0 - Production on Wed Jan 21 23:28:30 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_TABLE_01”: hr/********@jiagulun tables=student directory=TEST_IMPDry_1.dmp query=STUDENT:“WHERE ID < 2”

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 64 KB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported “HR”.“STUDENT”5.906 KB 1 rows

Master table “HR”.“SYS_EXPORT_TABLE_01” successfully loaded/unloaded

******************************************************************************

Dump file set for HR.SYS_EXPORT_TABLE_01 is:

/u01/app/oracle/test_impdp_expdp/test_exp_query_1.dmp

Job “HR”.“SYS_EXPORT_TABLE_01” successfully completed at 23:28:40

WRL_TYPE

--------------------

WRL_PARAMETER

--------------------------------------------------------------------------------

STATUS

------------------

file

/u01/app/oracle/admin/jiagulun/wallet

CLOSED

数据泵的导入:

1,content:指定要加载的数据, 其中有效关键字值为: (ALL), DATA_ONLY 和 METADATA_ONLY,当设置content为ALL 时,将加载对象定义及其所有数据;

DATA_ONLY时,只加载对象数据;为METADATA_ONLY时,只加载对象定义 。

2,estimate:估算所占用磁盘空间分方法.默认值是BLOCKS

3,remap_schema:用于将对象从一个用户下导入到另一个用户下。

4,remap_tablespace:用于将对象从一个表空间下导入到另一个表空间下。

5,remap_datafile:用于在不同文件系统的平台间,切换数据文件路径。

remap_achema:导入

[oracle@localhost test_impdp_expdp]$ expdp hr/hr@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_01.dmp schemas= hr

Export: Release 11.2.0.1.0 - Production on Thu Jan 22 00:59:42 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “HR”.“SYS_EXPORT_SCHEMA_01”: hr/********@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_01.dmp schemas=

Estimate in progress using BLOCKS method...

[oracle@localhost test_impdp_expdp]$ impdp test1/test1@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_01.dmpREMAP_SCHEMA=HR:TEST1

Import: Release 11.2.0.1.0 - Production on Thu Jan 22 01:10:11 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table “TEST1”.“SYS_IMPORT_FULL_01” successfully loaded/unloaded

Starting “TEST1”.“SYS_IMPORT_FULL_01”: test1/********@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_01.dmp REMAP_SCHEMA=HR:TEST1

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

remap_tablespace导入

通过remap_tablespace来变换表所属表空间:SQL>select segment_name,segment_type,tablespace_name from user_extents ;SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME-------------------------------------------------------------------------------- ------------------ ------------------------------REGIONS TABLE EXAMPLELOCATIONS TABLE EXAMPLEDEPARTMENTS TABLE EXAMPLEJOBS TABLE EXAMPLEEMPLOYEES TABLE EXAMPLEJOB_HISTORYTABLE EXAMPLEDEPT TABLE USERSDROPPED_OBJ TABLE USERSTEST_JOBTABLE USERSSTUDENT TABLE TEST_TRAN_TSADDRESS TABLE TEST_TRAN_TS

[oracle@localhost test_impdp_expdp]$ expdp \‘sys/oracle@jiagulun as sysdba\‘ directory=test_impdp_expdp dumpfile=exp_04.dmp tablespaces=users--导出表空间

Export: Release 11.2.0.1.0 - Production on Thu Jan 22 01:20:04 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Starting “SYS”.“SYS_EXPORT_TABLESPACE_01”: “sys/********@jiagulun AS SYSDBA” directory=test_impdp_expdp dumpfile=exp_02.dmp tablespaces=users

Estimate in progress using BLOCKS method...

SQL>drop table student purge;

Table dropped.--之所以要先删除再导入表是因为在一个数据库中一个用户中的对象是唯一的,所以先删除再导入

SQL>drop table address purge;

Table dropped.

SQL>commit;

Commit complete.

[oracle@localhost test_impdp_expdp]$ impdp \‘sys/oracle@jiagulun as sysdba\‘ directory=test_impdp_expdp dumpfile=exp_04.dmp REMAP_TABLESPACE=test_tran_ts:users--导入表空间到test_tran_ts

Import: Release 11.2.0.1.0 - Production on Thu Jan 22 01:28:45 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table “SYS”.“SYS_IMPORT_FULL_01” successfully loaded/unloaded

Starting “SYS”.“SYS_IMPORT_FULL_01”: “sys/********@jiagulun AS SYSDBA” directory=test_impdp_expdp dumpfile=exp_02.dmp REMAP_TABLESPACE=users:test_tran_ts

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

. . imported “HR”.“ADDRESS”5.476 KB 2 rows

. . imported “HR”.“STUDENT”5.937 KB 3 rows

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

SQL>select segment_name,segment_type,tablespace_name from user_extents ;SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME-------------------------------------------------------------------------------- ------------------ ------------------------------REGIONS TABLE EXAMPLELOCATIONS TABLE EXAMPLEDEPARTMENTS TABLE EXAMPLEJOBS TABLE EXAMPLEEMPLOYEES TABLE EXAMPLEJOB_HISTORYTABLE EXAMPLESTUDENT TABLE USERSADDRESS TABLE USERS

为了把用户按表空间归类,需要把用户所有的当前数据转移到另一个表空间里,那么可以使用impdp的remap_tablespace参数。下面就这一内容进行实验。

SQL>select du.username,du.default_tablespace,du.temporary_tablespace from dba_users du where du.username=‘HR‘;USERNAME DEFAULT_TABLESPACE TEMPORARY_TABLESPACE------------------------------ ------------------------------ ------------------------------HR USERS TEMP2

SQL>select segment_name,segment_type,tablespace_name from user_extents where rownum < 10;SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME-------------------------------------------------------------------------------- ------------------ ------------------------------REGIONS TABLE EXAMPLELOCATIONS TABLE EXAMPLEDEPARTMENTS TABLE EXAMPLEJOBS TABLE EXAMPLEEMPLOYEES TABLE EXAMPLEJOB_HISTORYTABLE EXAMPLESTUDENT TABLE USERSADDRESS TABLE USERSDEPT TABLE USERS9 rows selected

SQL>

[oracle@localhost test_impdp_expdp]$ expdp system/oracle@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_03.dmp schemas=hr

Export: Release 11.2.0.1.0 - Production on Thu Jan 22 02:22:28 2015

--导出hr用户对象信息,使用system导出的更加的全

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

[oracle@localhost test_impdp_expdp]$ impdp system/oracle@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_03.dmp remap_tablespace=users:test_tran_ts--导入hr用户中是users表空间的数据到test_tran_ts表空间中

Import: Release 11.2.0.1.0 - Production on Thu Jan 22 05:33:10 2015

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

SQL>select segment_name,segment_type,tablespace_name from user_extents where rownum < 10;SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME-------------------------------------------------------------------------------- ------------------ ------------------------------REGIONS TABLE EXAMPLELOCATIONS TABLE EXAMPLEDEPARTMENTS TABLE EXAMPLEJOBS TABLE EXAMPLEEMPLOYEES TABLE EXAMPLEJOB_HISTORYTABLE EXAMPLESTUDENT TABLE USERSADDRESS TABLE USERSDEPT TABLE USERS9 rows selected--会发现表所在表空间并没有变化,是因为原来的已经存在不会覆盖

SQL>select du.username,du.default_tablespace,du.temporary_tablespace from dba_users du where du.username=‘HR‘;USERNAME DEFAULT_TABLESPACE TEMPORARY_TABLESPACE------------------------------ ------------------------------ ------------------------------HR USERS TEMP2注意:经过导入后,用户test_user的缺省表空间被改成了remap_tablespace的目的表空间, 但是这里没有变化也是因为已经存在了。把表和用户删除了,就会发现他们的表空间变额

SQL>drop table student;

Table dropped.

SQL>drop table address;

Table dropped.

SQL>commit;

Commit complete.

SQL>purge recyclebin

2 ;

[oracle@localhost test_impdp_expdp]$ impdp system/oracle@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_03.dmp remap_tablespace=users:test_tran_ts

Import: Release 11.2.0.1.0 - Production on Thu Jan 22 05:48:49 2015

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 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Master table “SYSTEM”.“SYS_IMPORT_FULL_01” successfully loaded/unloaded

Starting “SYSTEM”.“SYS_IMPORT_FULL_01”: system/********@jiagulun directory=TEST_IMPDP_EXPDP dumpfile=exp_03.dmp remap_tablespace=users:test_tran_ts

Processing object type SCHEMA_EXPORT/USER

ORA-31684: Object type USER:“HR” already exists--由于存在所以直接跳过

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT

Processing object type SCHEMA_EXPORT/ROLE_GRANT

Processing object type SCHEMA_EXPORT/DEFAULT_ROLE

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE

ORA-31684: Object type SEQUENCE:“HR”.“EMPLOYEES_SEQ” already exists

ORA-31684: Object type SEQUENCE:“HR”.“DEPARTMENTS_SEQ” already exists

ORA-31684: Object type SEQUENCE:“HR”.“LOCATIONS_SEQ” already exists

Processing object type SCHEMA_EXPORT/CLUSTER/CLUSTER

ORA-31684: Object type CLUSTER:“HR”.“CLUSTER1” already exists

Processing object type SCHEMA_EXPORT/CLUSTER/INDEX

ORA-39111: Dependent object type INDEX:“HR”.“CLUSTER_INDEX” skipped, base object type CLUSTER:“HR”.“CLUSTER1” already exists

Processing object type SCHEMA_EXPORT/TABLE/TABLE

ORA-39151: Table “HR”.“COUNTRIES” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“REGIONS” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“LOCATIONS” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“DEPARTMENTS” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“JOBS” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“EMPLOYEES” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“JOB_HISTORY” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“DEPT” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“DROPPED_OBJ” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

ORA-39151: Table “HR”.“TEST_JOB” exists. All dependent metadata and data will be skipped due to table_exists_action of skip

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported “HR”.“ADDRESS”5.476 KB 2 rows

. . imported “HR”.“STUDENT”5.937 KB 3 rows

Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT

.. . . . . . . . ..

SQL>select segment_name,segment_type,tablespace_name from user_extents ;SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME-------------------------------------------------------------------------------- ------------------ ------------------------------STUDENT TABLE TEST_TRAN_TSADDRESS TABLE TEST_TRAN_TSCLUSTER1 CLUSTER USERS--你会发现他们的表空间变化了。

注意:一个用户对象是唯一的,即使在不同的表空间中也是一样的

SQL>create table test1(id number);--默认是使用sys

Table created.

SQL>create table test1(id number) tablespace test_tran_ts;--使用test_tran_ts

create table test1(id number) tablespace test_tran_ts

*

ERROR at line 1:

ORA-00955: name is already used by an existing object

SQL>

篇3:Linux中备份与恢复Linux系统linux操作系统

linux也查windows系统一相可以直接对系统进行备份以备系统出问题时我们进行还原了,下面我来给大家详细介绍Linux中备份与恢复Linux系统的方法,有需要学习的朋友可参考,

备份:

具体说来要这样做:

首先是要用root用户,必须的,然后是到/目录下,就是根目录下,然后就可以使用下面给出的命令一键备份了,easy:

代码如下复制代码

tar cvpzf backup.tgz / --exclude=/proc --exclude=/lost+found--exclude=/backup.tgz --

exclude=/mnt--exclude=/sys

这里稍微介绍一下代码,应该都认识的吧:

tar是Linux下的打包命令,就是类似于压缩的打包,加上参数‘cvpfz’用于表示创建一个打包文件,并且具有保存权限,后面的z表示使用gzip压缩,f参数后面就是街上名称了,这里的就是backup.tgz了。

后面加上的就是备份的目录,这里要备份所有的文件,自然就是根目录了:/。后面--exclude很明白吧,就是要排除的目录,这些目录下的文件我们不想备份,因为没有什么用,或者很大很大,严重影响备份的速度。当然了,不要笨到把自己想要备份的文件也排除了,那样结果会很怪异的。这里提醒一下,如果不想备份/mnt下,那就把它排除把,还有就是/media目录了,不要挂载东西,不然一起备份了,还是比较厉害的一个命令了。

可能在备份的最后会有一条信息,就是提示tar命令由于先前错误的耽搁存在错误之类的,不过这个不要紧,直接pass。

除此之外,还可以选择拥有较高压缩比率的Bzip来压缩文件,高压缩比意味着低压缩速度,那就需要很长的时间了,如果不是很着急,那就可以用下面的命令来做,其实也没什么,就是把上面的命令中的z参数替换成j参数,就可以了,这样的话命令就会变成这样:

代码如下复制代码

tar cvpzf backup.tgz / --exclude=/proc --exclude=/lost+found--exclude=/backup.tgz --

exclude=/mnt--exclude=/sys

恢复:

如果哪一天很不幸你的数据被毁掉了,你应该感到庆幸,因为你曾经备份过系统,但愿这个备份的时间不要太久了,

废话不多说,下面就是恢复。

我们已经将系统整个备份到了backup.tgz文件了

下面还是要确定你就是根用户,这样才能顺利进行,不然又得纠结的。

确定所拥有的备份文件在根目录下。这是必须的,不然会有意想不到的错误,你可以想象恢复到一般的时候恢复文件把自己给覆盖了的情况。

接下来我还是宣扬一下Linux的好处,就是不需要用光盘引导之类的,因为你就在操作的最底层,无需再次关开机什么的,额,这里除去你的系统已经被你搞得连shell都看不见了,还是老实点的引导吧,我们可以再Linux运行的时候还原文件,并且移除所有的其他文件,这是危险的。下面还是正题:

使用这个命令即可:

代码如下复制代码

tar xvpfz backup.tgz -C /

如果使用了bz2:,就是用下面的命令:

代码如下复制代码

tar xvpfj backup.tar.bz2 -C /

这回把分区里所有相同的文件用压缩文件里的文件代替,所有要三思而后行,除非你的系统的确需要还原。

下面的命令用于重新创建被排除的目录:

代码如下复制代码

mkdir proc

mkdir lost+found

mkdir mnt

mkdir sys

■/proc 权限:文件所有者:root群组:root所有者:读取 执行 群组:读取 执行 其它:读取 执行

■/lost+found 权限:文件所有者:root群组:root 所有者:读取 写入 执行 群组:读取 执行 其它:读取 执行

■/mnt 权限:文件所有者:root群组:root所有者:读取 写入 执行 群组:读取 执行其它:读取 执行

■/sys 权限:文件所有者:root群组:root所有者:读取 写入 执行 群组:读取 执行其它:读取 执行

篇4:postgres 数据备份与恢复

PostgreSQL自带一个客户端pgAdmin,里面有个备份,恢复选项,也能对数据库进行备份 恢复(还原),但最近发现数据库慢慢庞大的时候,经常出错,备份的文件过程中出错的几率那是相当大,手动调节灰常有限,所以一直寻找完美的备份恢复方案。

梦里寻他千百度,伊人却在灯火阑珊处...其实PostgreSQL内置不少的工具,寻找的备份恢复方案就在其中:pg_dump,psql。这两个指令在数据库的安装目录下,比如我自己本地安装的,路径形如:C:\Program Files\PostgreSQL\9.0\;然后进入到bin文件夹,会看到不少的exe文件,这就是PostgreSQL内置的工具了。里面会找到pg_dump.exe,psql.exe两个文件。我们怎么用他们?

用法:

备份数据库,指令如下:

pg_dump -h 164.82.233.54 -U postgres databasename >C:\databasename.bak

开始-运行-cmd 弹出dos控制台;然后 在控制台里,进入PostgreSQL安装目录bin下:

cd C:\Program Files\PostgreSQL\9.0\bin

最后执行备份指令:

pg_dump -h 164.82.233.54 -U postgres databasename >C:\databasename.bak

指令解释:如上命令,pg_dump 是备份数据库指令,164.82.233.54是数据库的ip地址(必须保证数据库允许外部访问的权限哦~),当然本地的数据库ip写 localhost;postgres 是数据库的用户名;databasename 是数据库名,

>意思是导出到C:\databasename.bak文件里,如果没有写路径,单单写databasename.bak文件名,那么备份文件会保存在C:\Program Files\PostgreSQL\9.0\bin 文件夹里。

恢复数据库,指令如下:

psql -h localhost -U postgres -d databasename < C:\databasename.bak

指令解释:如上命令,psql是恢复数据库命令,localhost是要恢复到哪个数据库的地址,当然你可以写上ip地址,也就是说能远程恢复(必须保证数据库允许外部访问的权限哦~);postgres 就是要恢复到哪个数据库的用户;databasename 是要恢复到哪个数据库。< 的意思是把C:\databasename.bak文件导入到指定的数据库里。

以上所有的是针对windows而言的,如果在linux下,会不会有效?

在linux里依然有效。有一个值得注意的是:如果直接进入PostgreSQL的安装目录bin下,执行命令,可能会出现 找不到pg_dump,psql的现象,我们在可以这样:

备份:

/opt/PostgreSQL/9.0/bin/pg_dump -h 164.82.233.54 -U postgres databasename >databasename.bak

恢复:

/opt/PostgreSQL/9.0/bin/psql -h localhost -U postgres -d databasename < databasename.bak

原文地址:2goo.info/blog/detail/516/

篇5:linux中mysql数据库备份与恢复linux操作系统

在linux中对数据库或表进行备份与恢复我们会要用于数据库常用命令mysqldump,下面我来利用mysqldump对mysql数据库进行备份与恢复操作,

备份与恢复

比如我们要备份mysql中已经存在的名为linux的数据库,要用到命令mysqldump

命令格式如下:

[root@linuxsir01 root]# mysqldump -u root -p linux >/root/linux.sql

Enter password:在这里输入数据库的密码

例如:将上例创建的aaa库备份到文件back_aaa中

1、备份

代码如下复制代码

[root@test1 root]# cd /home/data/mysql (进入到库目录,本例库已由val/lib/mysql转到/home/data/mysql,见

上述第七部分内容)

代码如下复制代码

[root@test1 mysql]# mysqldump -u root -p –opt aaa >back_aaa

2、恢复

代码如下复制代码

[root@test mysql]# mysql -u root -p ccc < back_aaa

篇6:硬盘分区表的备份与恢复

硬盘是很多病毒的攻击对象,而且,一些意外的情况,比如突然断电等也能使硬盘的主引导分区数据丢失。分区一损坏,系统则立即瘫痪,动弹不得。所以关于分区的恢复与备份的技巧,是必须要掌握的技巧:

首先,一旦发生计算机无法检测到硬盘的情况,排除了硬件上的问题,我们就应该开始检测分区。一般来说,如果主引导区或者引导程序和分区表中的一个被破坏的话,都会出现硬盘丢失的情况。我们一个个做一番检查:

分区表的检查与修复

若计算机不能从硬盘启动,则我们可以通过软盘启动后,试着访问硬盘。如果硬盘可以被访问,则说明只是操作系统被破坏,可以用重新安装操作系统的方法来恢复,或者直接把别的计算机上的硬盘拿过来进行数据对拷;如果不能访问硬盘,则可能是主引导区或者可引导分区的引导区被破坏了。这时候,我们可以应用DEBUG或者诸如NortonDiskEditor等工具软件查看硬盘的主引导区是否正常。下面我们给出一个利用DEBUG访问主引导区的实例:(其中XXXX表示内存段地址,由于计算机的BIOS、操作系统及配置文件等的不同,从而导致XXXX地址段不同),

a:\>DEBUG

-a汇编指令

XXXX:0100movax,201读取一个扇区

XXXX:0103movbx,600读至当前段

0600处XXXX:0106movcx,1柱面号=1

XXXX:0109movdx,80磁头号=0,驱动器号=80

XXXX:010Cint13磁盘读写中断

XXXX:010Eint3断点中断

XXXX:010F-g执行上述

点击阅读更多学院相关文章>>

分享到

篇7:Linux操作系统备份与恢复方法

无论什么系统,最安全的做法,就是调试好后,做个备份。到时遇到什么大问题,直接恢复出来,方便而省事。下面详细Linux备份与恢复方法:

备份与恢复系统承担着事前备份与事后恢复的职能。在当前高速发展的网络环境下,任何一个网络上的信息系统都不可能保证绝对的安全。只要有网络存在,就会有来自网络的形形色色的威胁。为了抵御网络的攻击和入侵,虽然我们引入了日趋成熟的入侵检测系统、防火墙系统等, 们的入侵手段也日益高明,他们总能找到这些系统的安全漏洞及不足进行入侵,因而网络入侵所引起的安全事件呈逐年增加之势。

在这种情况下,我们难以保证网络中关键系统的绝对安全,因而就需要采用备份及恢复技术。备份及恢复技术就是使用存储介质和一定的策略,定期将系统业务数据备份下来,以保证数据意外丢失时能尽快恢复,将用户的损失降到最低点。它是信息安全学科中一种非常重要的核心技术。

Linux下的备份技术

对于备份和恢复来说,Linux提供了诸如tar、cpio、dump等工具来实现。这样,用户无需花钱购买,便可根据系统的实际情况,结合使用相应的备份恢复工具实现备份与恢复的基本功能,

tar工具介绍

tar是一个已移植到Linux中的经典Unix命令。tar是tape archive(磁带归档)的缩写,最初设计用于将文件打包到磁带上,现在我们大都使用它来实现备份某个分区或者某些重要的文件目录。我们使用 tar可以打包整个目录树,这使得它特别适合用于备份。归档文件可以全部还原,或从中展开单独的文件和目录。备份可以保存到基于文件的设备或磁带设备上。文件可以在还原时重定向,以便将它们重新放到一个与最初保存它们的目录(或系统)不同的目录(或系统)。tar是与文件系统无关的,因而它的适用范围很广,它可以使用在ext2、ext3、jfs、Reiser和其他文件系统上。

使用tar非常类似于使用诸如Windows环境下的Winzip、WinRAR这样的文件实用工具。只需将它指向一个目的(可以是文件或设备),然后指定想要打包的文件,就可以通过标准的压缩类型来动态压缩归档文件,或指定一个自己选择的外部压缩程序。要通过bzip2压缩或解压缩文件,可使用tar -z命令。

下面是一个简单的使用该工具进行数据备份的例子:

tar czvf - /root/code

篇8:Windows优化大师备份与恢复方法

很多用户在自己的电脑使用久了后,都会选择自己进行重装,而为了防止用户误操作导致系统故障。Windows优化大师向用户提供了备份与恢复恢复管理器。目前,Windows优化大师的自动优化、注册表清理、冗余DLL清理、ActiveX清理,垃圾文件清理,软件智能卸载,驱动智能备份、开机速度优化、系统个性设置中的右键菜单设置、其他设置选项中的系统文件备份与恢复、系统安全优化的附加工具中IE插件管理均已纳入统一的备份与恢复模块。

Windows优化大师备份与恢复

Windows优化大师的备份时采用了高压缩率的快速压缩算法,经测试仅仅在Windows优化大师默认压缩率下即已超过Winzip压缩率,达到了WinRAR的最大压缩率。Windows优化大师用户若选用最大压缩率则可全面超越目前流行压缩软件的压缩率,为用户节省了大量备份的磁盘空间。据测试,WindowsXP的48MB注册表备份文件可以压缩到3MB(Windows98下更可压缩至1MB左右);9MB的动态链接库可以压缩到不到2MB。

进入Windows优化大师的备份与恢复窗口,列表中列出了当前可以恢复的备份,随Windows优化大师的操作界面不同,此处列出的备份可能是:注册表的全部信息、动态链接库备份、ActiveX/COM组件备份、垃圾文件清理备份、驱动备份、软件智能卸载备份、系统文件备份等。每一项备份信息从左到右分别是备份日期、备份文件名称、备份说明、备份文件大小以及备份时用户的操作系统等。

需要指出的是对于不同的备份存放格式Windows优化大师使用了不同图标来表示,如下所示:

黄色磁盘图标表示该备份文件经过Windows优化大师压缩存放,可以用Windows优化大师解压缩恢复;

Windows优化大师备份与恢复

蓝色磁盘图标表示该备份文件Windows优化大师没有进行压缩存放(可能是Windows优化大师压缩失败或待压缩的备份文件太小而没必要压缩),可以使用Windows优化大师进行恢复;

灰色磁盘图标表示该备份文件已经损坏或与备份文件相关的恢复信息已经损坏,Windows优化大师无法进行恢复,    Windows优化大师备份与恢复

在备份与恢复中,用户还可以对其属性进行设置。目前,Windows优化大师提供的设置选项包括:

1、备份压缩率设置。使用者可以设置Windows优化大师备份时的压缩率为最快压缩率(压缩速度最快,但压缩率较小,因此压缩后文件占用的磁盘空间较大);默认压缩率(Windows优化大师默认的压缩率,速度较快,压缩率较高,压缩后文件占用磁盘空间较小);最大压缩率(压缩速度较慢,压缩率最高,压缩后文件占用的磁盘空间最小)。

2、备份路径。Windows优化大师默认的备份目录为Windows优化大师目录下的Backup子目录。使用者也可以在此处重新定义。

3、恢复后Windows优化大师自动删除备份文件和备份的相关信息。选中此项,当备份项目进行恢复操作后将自动删除该项备份。建议用户不选择此项而采用手动删除备份的方式,以确保恢复万无一失。

SQL SERVER数据库备份和恢复存储过程(加强版本)数据库教程

竞争与合作演讲稿集合

Linux与Windows中定时备份与定时删除某天前的文件linux操作系统

win系统服务备份与保护服务器教程

与动物有关的英语演讲集合

松北湿地水环境分析与恢复方案

数学必修1集合与函数知识点与学习方法

word设置:Word中怎样设置自动恢复文件的保存位置

山东省矿山地质环境保护与治理恢复方案编制管理办法

青少年长跑运动员训练与比赛时的营养与恢复论文

网络管理员备份与恢复中常用术语表集合(精选8篇)

欢迎下载DOC格式的网络管理员备份与恢复中常用术语表集合,但愿能给您带来参考作用!
推荐度: 推荐 推荐 推荐 推荐 推荐
点击下载文档 文档为doc格式
点击下载本文文档