Вы находитесь на странице: 1из 4

@echo off

Rem ===========================================================================
Rem Migrate Project
Rem Written by Praj Basnet & Copyright 2008.
Rem http://peoplesoft.wikidot.com/migrate-project
Rem ===========================================================================
Rem Runs Application Designer in command line mode to:
Rem 1) Compare the project between the source and target environments
Rem 2) Copy objects from the source to the target environment
Rem 3) Re-compare the project between the source and target environments
Rem 4) Generate a build script to build the project in the target environment
Rem ===========================================================================
Rem Command Line Usage
Rem ===========================================================================
Rem
Rem migrate_project [option] [project] [username] [password] [source] [target]
Rem
Rem [option] = COMPARE, COPY, EXPORT, BUILD or MIGRATE
Rem [project] = Application Designer Project Name
Rem [username] = Username to access both source and target environments
Rem [password] = Password to access both source and target environments
Rem [source] = Source database name
Rem [target] = Target database name
Rem
Rem See http://peoplesoft.wikidot.com/migrate-project for more information.
Rem
Rem ===========================================================================

if "%1"=="" goto usage


if "%2"=="" goto usage
if "%3"=="" goto usage
if "%4"=="" goto usage
if "%5"=="" goto usage

Rem ===========================================================================
Rem Define Variables and Display Program Header
Rem ===========================================================================

set option=%1
set project=%2
set user=%3
set pwd=%4
set srcdb=%5
set tgtdb=%6

Rem ===========================================================================
Rem Environment Setup
Rem ===========================================================================
Rem * pside should point to the path of the pside.exe
Rem * compare_path is where you want to store compare reports
Rem * copy_path is where you want to store copied project files
Rem * dbtype is the database platform you are using
Rem ===========================================================================

set pside=pside.exe
set compare_path=C:\PS\COMPARE\
set copy_path=C:\PS\COPY\
set copy_logfile=%copy_path%%project%.log
set export_path=C:\PS\EXPORT\
set dbtype=ORACLE

echo.
echo.
echo Migrate Project v1.0
echo Written by Praj Basnet
echo.

if "%1"=="COMPARE" goto compare


if "%1"=="COPY" goto copy
if "%1"=="EXPORT" goto export
if "%1"=="BUILD" goto build
if "%1"=="MIGRATE" goto migrate
goto usage

:compare
Rem ===========================================================================
Rem Compare project between Source & Target Environments
Rem ===========================================================================

Rem Check the user has specified a target database


if "%6"=="" goto usage

echo * Comparing %project% between %srcdb% and %tgtdb%

%pside% -HIDE -PJM %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %srcdb% -TD
%tgtdb% -TO %user% -TP %pwd% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -CMT 1 -TGT
1 -ROD %compare_path% -CMXML 1

echo.
echo Compare complete.
echo.

goto end

:copy
Rem ===========================================================================
Rem Copy project between Source & Target Databases
Rem ===========================================================================

Rem Check the user has specified a target database


if "%6"=="" goto usage

echo * Copying %project% from %srcdb% to %tgtdb%

%pside% -HIDE -PJC %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %srcdb% -TD
%tgtdb% -TO %user% -TP %pwd% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -LF
%copy_logfile%

echo.
echo Copy between source and target databases complete.
echo.

goto end

:export
Rem ===========================================================================
Rem Export project to a file
Rem ===========================================================================

echo * Exporting %project% as a file. It will be stored in following location:


%copy_path%%project%

%pside% -HIDE -PJTF %project% -FP %export_path% -CT %dbtype% -CO %user% -CP %pwd%
-CD %srcdb% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -LF %copy_logfile%

echo.
echo Export complete.
echo.

goto end

:build
Rem ===========================================================================
Rem Build Project
Rem ===========================================================================

echo * Generating Build script for %project%. This will created in %Temp%

%pside% -HIDE -PJB %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %tgtdb%

echo.
echo Build complete.
echo.

goto end

:migrate

Rem ===========================================================================
Rem Step 1: Compare project between Source & Target Environments
Rem ===========================================================================

Rem Check the user has specified a target database


if "%6"=="" goto usage

echo * Comparing %project% between %srcdb% and %tgtdb%

%pside% -HIDE -PJM %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %srcdb% -TD
%tgtdb% -TO %user% -TP %pwd% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -CMT 1 -TGT
1 -ROD %compare_path% -CMXML 1

Rem ===========================================================================
Rem Step 2: Copy project between Source & Target Environments
Rem ===========================================================================

echo * Copying %project% from %srcdb% to %tgtdb%

%pside% -HIDE -PJC %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %srcdb% -TD
%tgtdb% -TO %user% -TP %pwd% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -LF
%copy_logfile%

Rem ===========================================================================
Rem Step 3: Build Project
Rem ===========================================================================

echo * Generating Build script for %project%. This will created in %Temp%

%pside% -HIDE -PJB %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %tgtdb%

Rem ===========================================================================
Rem Step 4: Re-Compare project between Source & Target Environments
Rem ===========================================================================

echo * Re-Comparing %project% between %tgtdb% and %srcdb%

%pside% -HIDE -PJM %project% -CT %dbtype% -CO %user% -CP %pwd% -CD %tgtdb% -TD
%srcdb% -TO %user% -TP %pwd% -QUIET -AF 0 -DDL 1 -PPL 0 -CFD 0 -CFF 0 -CMT 1 -TGT
1 -ROD %compare_path% -CMXML 1

echo.
echo Copy complete. Manual steps to perform now are:
echo * Check compare reports in %compare_path%CompareViewer.html
echo * Build project in target environment
echo.

goto end

:usage
echo.
echo Incorrect Parameters. Please refer to usage below:
echo.
echo migrate_project [option] [project] [username] [password] [source] [target]
echo.
echo [option] = COMPARE, COPY, EXPORT, BUILD or MIGRATE
echo [project] = Application Designer Project Name
echo [username] = Username to access both source and target environments
echo [password] = Password to access both source and target environments
echo [source] = Source database name
echo [target] = Target database name
echo.
echo See http://peoplesoft.wikidot.com/migrate-project for more information.
echo.

:end

Вам также может понравиться