必須:
使用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 wqs803/wqs803@127.0.0.1/orcl file=E:\wqs803_20190916.DMP full=y ignore=y;it