关闭

恢复数据使用记录

317人阅读 评论(0) 收藏 举报
@echo off & setlocal enabledelayedexpansion
set TODAYS_DATE=%date:~0,4%%date:~5,2%%date:~8,2%
set source_path=c:\t1\
set target_path=c:\t2\
set tmp1=c:\4.txt
set tmp2=c:\5.txt
set tmp3=c:\2.txt
set result=c:\result_%TODAYS_DATE%.txt
for /f "tokens=*" %%i in ('dir/b %source_path%') do @echo %source_path%%%i >>%tmp1%
for /f "tokens=*" %%i in ('dir/b %target_path%') do @echo %target_path%%%i >>%tmp2%
@echo on
@for /f "delims==" %%I IN (%tmp1%) DO (
@for /f "delims==" %%j IN (%tmp2%) DO (
findstr /i /x /g:"%%I" "%%j" >%tmp3% & for /f "delims=" %%f in ("%tmp3%") DO (
if not %%~zf == 0 echo "%%I" "%%j" >>%result%))) >>c:\log_%TODAYS_DATE%.txt
@del /q %tmp1%
@del /q %tmp2%
@del /q %tmp3%
@pause


 

--创建外部表
create directory test as 'c:\test';
create table exttable(
text varchar2(4000)
)organization external
(type oracle_loader
default directory ext
access parameters
(records delimited by newline
fields terminated by ','
)location('test.txt')
);
--格式化没有system.dbf需要抽取数据的脚本--源数据通过没有system数据文件提取
select * from alert_log where text like 'Unloading table: %'
--格式化对应data_object_id table_name--源数据通过有最新的system恢复对象
create table name_id as 
select 
substr(text,instr(text,':')+1,instr(text,'object ID')-length('Unloading table: ')) name,
substr(substr(text,instr(text,'object ID:')+1),instr(substr(text,instr(text,'object ID:')+1),':')+1) id
from alert_log where text like 'Unloading table: %'
--ODU_0000051149.txt
--ren
select 'ren'||' '||'ODU_00000'||trim(ID)||'.txt'||' '||'SBOUSERPSZX_'||trim(name)||'.txt'||' >>c:\ren.log' name from name_id
--ctl



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:17617次
    • 积分:536
    • 等级:
    • 排名:千里之外
    • 原创:37篇
    • 转载:8篇
    • 译文:1篇
    • 评论:0条