Oracle命令--导出表结构和表数据

备份  
命令详解  
exp system/test1234@imapdb full=y file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log
exp: 备份命令字
system/test1234@imapdb :数据库用户名/数据库密码@数据库实例名

full=y: 全量备份

file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp : 备份的目的文件

log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log :备份过程中的日志


oracle数据库恢复:

删除数据库表和表空间:

登录oracle数据库:sqlplus -L -S $DB_USER/$DB_PWD@$DB_SRV_NAME

drop tablespace IMAP_DB including contents and datafiles cascade constraints; //IMAP_DB为oracle表名称
commit; //提交数据库操作


恢复oracle数据库:

imp system/test1234@imapdb full=y file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp DESTROY=y log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log

 

 

 


补充:sybase数据库备份和恢复

登录sybase数据库:isql -S$DB_SRV_NAME -U$DB_USER -P$DB_PWD

备份sybase数据库:dump database alarmdb to "/export/dbBackup/alarmdb_dump"

go

alarmdb为数据库实例名,/export/dbBackup/alarmdb_dump为备份路径和文件名.
恢复sybase数据库:load database alarmdb from "/export/dbBackup/alarmdb_dump"
go

alarmdb为数据库实例名,/export/dbBackup/alarmdb_dump为备份路径和文件名.


示例  
oracle@LmtATCAn4:~> exp system/test1234@imapdb full=y file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log


Export: Release 11.1.0.6.0 - Production on Tue Apr 17 14:54:42 2012


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

 


Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export done in ZHS16GBK character set and UTF8 NCHAR character set


About to export the entire database ...
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions
. exporting system procedural objects and actions


常见错误  
数据库用户名或密码错
oracle@LmtATCAn4:~> exp system/test124@imapdb full=y file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log


Export: Release 11.1.0.6.0 - Production on Tue Apr 17 14:59:12 2012


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

 


EXP-00056: ORACLE error 1017 encountered
ORA-01017: invalid username/password; logon denied
Username:
命令名字写错
oracle@LmtATCAn4:~> export system/test124@imapdb full=y file=/opt/oracle/dbbackup/imapdb/20120416/201204016.dmp log=/opt/oracle/dbbackup/imapdb/20120416/20120416.log
-bash: export: `system/test124@imapdb': not a valid identifier
oracle@LmtATCAn4:~>
[ 编辑本段 ]   [ 回目录 ]恢复  
[ 编辑本段 ]   [ 回目录 ]相关命令  
[ 编辑本段 ]   [ 回目录 ]帮助:  
oracle@LmtATCAn4:~> exp help=y
oracle@LmtATCAn4:~> imp help=y

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值