恢复数据使用记录

@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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值