DB2

DB2 is IBM's offering to the highend database market. The latest version of DB2 (Universal Database) is ideal for OLTP, Data Warehousing, Decision Support and everything in between. It's well priced, extremely scalable and runs on virtually every platform out there from handhelds to mainframes.

db2move export - path


Dear all,
I am using Db2 9.7 LUW on windows.
I am calling command
db2move mydb export
from inside a batch script but i am not able to give target path (where to store all IXF and MSG files) to this command.
is there any such option on db2look ?
regards
sumit
You can create a variable (in your batch file) whose value is the fully qualified path to where you want to store the output files, and then temporarily change to that directory for the duration of the db2move , for example:
set EXP_OUTPUT_DIR=j:\db2move\output
pushd .
chdir /d %EXP_OUTPUT_DIR%
if errorlevel 1 (#echo Failed to change to output directory && #goto :EOF )
db2move export ....
if errorlevel 2 (#echo db2move failed && #goto :EOF )
popd
...
Originally Posted by db2mor
You can create a variable (in your batch file) whose value is the fully qualified path to where you want to store the output files, and then temporarily change to that directory for the duration of the db2move , for example:
set EXP_OUTPUT_DIR=j:\db2move\output
pushd .
chdir /d %EXP_OUTPUT_DIR%
if errorlevel 1 (#echo Failed to change to output directory && #goto :EOF )
db2move export ....
if errorlevel 2 (#echo db2move failed && #goto :EOF )
popd
...
Dear all
My windows batch file is as follows:
db2cmd /c /w /i db2 -v -t -f "D:\db2scripts\export_script.db2" -z "D:\db2scripts\sqlres.txt"
content of D:\db2scripts\export_script.db2 file is:
!cd "D:/testistms";
connect to istms;
!db2look -d istms -e -l -x -o "D:/testistms/dbcreate.sql";
!db2move testdb export;
But still export content is not going to D:/testistms . export files are always created into the directory from where my batch script is launched.
Please help.
regards
sumit
Your batch file is not valid as regards the !cd "D:/testistms" ; line - it will not do what you think.
That's because the change-directory is only valid for the sub-shell created to run that single line only, and when that line completes the current-directory changes back to what it was before the !cd line.
Your options include
(a) changing the directory before running export_script.db2 or
(b) writing an NT-batch-script that runs db2 commands (like db2look, db2move, db2 connect etc) instead of writing a db2-script that runs those db2 commands.
Option (b) lets you create a more robust script that does error checking and reacts to errors. Your current script has no error checking.
Thanks db2mor..
I am not aware of NT -batch scripts can u provide me a hint/link/example for the same to learn.
There are many books and internet pages on this topic (Windows batch files) and this kind of scripting is decades old. Use Google...
For your simple needs a batch file like this "myexport.bat" will show some examples...
#if “%DB2CLP%” == “” db2cmd /c /i /w %0 %* & goto :eof
set targetdir=D:\testistms
set dbname=istms
db2 connect to %dbname%
if errorlevel 1 (#echo Failed to connect to %dbname% && #goto :EOF)
db2look -d %dbname% -e -l -x -o %targetdir%\dbcreate.sql
if errorlevel 2 (#echo db2look failed && #goto :EOF )
cd /d %targetdir%
if errorlevel 1 (#echo Failed to change to %targetdir% && #goto :EOF)
db2move istms export
if errorlevel 1 (#echo db2move failed && #goto :EOF)
#echo db2move completed successfully
Thanks Db2mor... i will do the rest .

Related Links

Migration AS/400 DB2 to Windows DB2 8.1
Creating a new database with the existing database with same structure
load error SQL0302N
load error SQL0302N
Db2 Udb Unix Aix
Dropping and recreating a primary key which has already unique index
Strange installation problem - please help!
DB2 Varchar characters truncated
ZRC=0x805C012D
How to pivot dates into columns?
Task center problem
can i use the list tablespaces command in a procedure
stored proc problem
Forgot db2admin password
Help !!!!
Problem in Installation of DB2 UDB 8.1

Categories

DataBase Dev
MongoDB
Adabas
DB2
Informix
Microsoft SQL Server
MySQL
Oracle
Pervasive.SQL
PostgreSQL
Sybase
Other
ASP
Crystal Reports
Delphi, C etc
JAVA
Perl and the DBI
PHP
ANSI SQL
Unix Shell Scripts
Visual Basic
Brilliant Database
Corel Paradox
FileMaker
Microsoft Access
Microsoft Excel
Other PC Databases
New Members & Introduc...
Applications & Tools
Database Concepts & De...
Chit Chat
Marketplace
Job Opportunities
Suggestions & Feedback

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App