Oracl百分百迁移数据库,不丢表和数据,恢复无错误提醒

必须:
使用exp/imp命令(plsql导入不行)sql


准备工做数据库

select 'alter table '||table_name||' allocate extent;' from user_tables;ide

查询的sql拷贝执行 ,不丢表code

exp:rem

===========================
@echo off   
echo ================================================   
echo  Windows环境下Oracle数据库的自动备份脚本  
echo  1. 使用当前日期命名备份文件。  
echo ================================================    
::设置用户名、密码和要备份的数据库。  
::set USER=detection1  
::set PASSWORD=detection1  
::set DATABASE=orcl  
::以“YYYYMMDD”格式取出当前时间。
set year=%DATE:~0,4%
rem get month 
set month=%DATE:~5,2%
rem get data 
set date=%DATE:~8,2%
rem get mydate 
set mydate=%year%%month%%date%  
::建立备份目录。
if not exist "D:\YtForever\YTPQM\DB\backup\"       mkdir D:\YtForever\YTPQM\DB\backup\   
set DATADIR=D:\YtForever\YTPQM\DB\backup\  
exp detection1/detection1@127.0.0.1/orcl  file=%DATADIR%\detection1_%mydate%.dmp
exp ytdetection1/ytdetection1@127.0.0.1/orcl  file=%DATADIR%\ytdetection1_%mydate%.dmp

exit

本地远程均可以,配置好,保存bat,双击运行get


imp

imp wqs803/wqs803@127.0.0.1/orcl file=E:\wqs803_20190916.DMP full=y ignore=y;it

相关文章
相关标签/搜索