本帖最后由 pcl_test 于 2016-8-16 20:08 编辑
- @echo off
- rem =======================================================================
- rem = 本批处理实现目录数据同步到中心 ---20160816 =
- rem =======================================================================
- set DumpFolder=d:\dmp
- set LogFolder=d:\log
- set FileDate=%Date:~0,4%%Date:~5,2%%Date:~8,2%
- set UserName=datacenter
- set Password=datacenter
- set NetServer=orcl
- for /f "tokens=1 delims=_" %%i in ('dir /a-d /b *.dmp') do (
- echo insert into rc_catalog_basic_bak select * from rc_catalog_basic where ORGANIZATION_ID = '%%i';>%DumpFolder%\pre.sql
- echo insert into rc_resource_info_bak select * from rc_resource_info t where (t.catalog_resource_id,t.version) in (select catalog_resource_id,version from rc_catalog_basic where ORGANIZATION_ID = '%%i');>>%DumpFolder%\pre.sql
- echo insert into rc_dynamic_authority_bak select * from rc_dynamic_authority t where (t.catalog_resource_id,t.version) in (select catalog_resource_id,version from rc_catalog_basic where ORGANIZATION_ID = '%%i');>>%DumpFolder%\pre.sql
- echo commit;>>%DumpFolder%\pre.sql
- echo delete from rc_catalog_basic where ORGANIZATION_ID = '%%i';>>%DumpFolder%\pre.sql
- echo delete from rc_resource_info t where (t.catalog_resource_id,t.version) in (select catalog_resource_id,version from rc_catalog_basic where ORGANIZATION_ID = '%%i');>>%DumpFolder%\pre.sql
- echo delete from rc_dynamic_authority t where (t.catalog_resource_id,t.version) in (select catalog_resource_id,version from rc_catalog_basic where ORGANIZATION_ID = '%%i');>>%DumpFolder%\pre.sql
- echo commit;>>%DumpFolder%\pre.sql
- echo 前置机%%i数据环境初始化开始。。。
- start /b /wait sqlplus %UserName%/%Password%@%NetServer% @%DumpFolder%\pre.sql >%LogFolder%\%%i_%Date:~0,4%%Date:~5,2%%Date:~8,2%.log
- echo 前置机%%i数据环境初始化完毕!
- )
- pause
复制代码 下面这个就没事,奇怪死了==- @echo off
- echo insert into rc_catalog_basic_bak select * from rc_catalog_basic where ORGANIZATION_ID = '%%i';>pre.sql
- echo insert into rc_resource_info_bak select * from rc_resource_info t where (t.catalog_resource_id,t.version) in (select catalog_resource_id,version from rc_catalog_basic where ORGANIZATION_ID = '%%i');>>pre.sql
- pause
复制代码 谢谢大神的帮助~~~~~ |