#!/bin/bash
name=`date '+%Y%m%d_%H%M%S'`
echo $name
exp userid=c##scott/tiger owner=c##scott file=/home/oracle/expbk/to\_$name.dmp buffer=1048576 feedback=1000 log=/home/oracle/expbk/to\_$name.log
cd /home/oracle/expbk/
gzip to\_$name.dmp

 

 


 

导入

imp c##scott/tiger file=/home/oracle/expbk/to_20200305_110828.dmp buffer=100000 full=y

full=y,是导入文件中全部内容,有可能有多个用户的内容。
如果你联接的用户默认使用的表空间设置成system,则导入文件的内容会导到system上。

 ignore=y 

Ignore 参数在Oracle 的Exp/imp的意义是:

  • 如果用了参数ignore=y, 会把exp文件内的数据内容导入
  • 如果表有唯一关键字的约束条件, 不合条件将不被导入
  • 如果表没有唯一关键字的约束条件, 将引起记录重复

解释:

  1. 当要导入数据库中已经存在了某个表(test),如果该表没有唯一性约束,那么在导入时加参数ignore=y,则会把数据完全导入到表中,而且不报错。
  2. 当表已经存在了唯一性约束,特别是主键的约束,那么在导入时,只导入主键中不存在的记录. 导入过程中会有警告.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
EXP-00032: Non-DBAs may not export other users
EXP-00000: Export terminated unsuccessfully

 

提示需要dba权限,加个exp_full_database权限即可

grant exp_full_database to user1

同理:

IMP-00013: only a DBA can import a file exported by another DBA

提示需要dba权限,加个imp_full_database权限即可

grant imp_full_database to user1

 

IMP-00031: Must specify FULL=Y or provide FROMUSER/TOUSER or TABLES arguments

 

 

Oracle生产环境下的备份方案 
 
1.设置数据库自动备份控制文件、SPFILE文件 
 
2.每个星期天做RMAN 0级全库备份 
 
3.每日(星期天除外)做RMAN 1级增量备份 
 
4.在主服务器保留一个礼拜内的全库备份、增量备份 
 
5.将一个礼拜前的全库备份,增量备份数据FTP到其他环境 
RMAN备份管理 
  
显示配置命令 
  
show all; 
  
设置控制文件、SPFILE文件自动备份 
  
configure controlfile autobackup on; 
  
设置备份策略 
  
configure retention policy to recovery window of 7 days; 
  
检查备份数据 
  
crosscheck backupset; 
  
report obsolete; 
  
删除无效备份 
  
delete obsolete;
 

 

posted on 2020-03-05 10:35  我有我的信仰  阅读(641)  评论(0)    收藏  举报