DB2 Create a database on a server from the client using script

Hi experts, I'm trying to set up a script that can do my initial setup from one machine.  But I'm stuck on the syntax because up to now, I've just hopped over to the server and set up the database locally on the server first, then back to the client box for the rest of teh setup.  However, I'd like to automate this. so....

given that I have 2 machines: dbServer and dbClient.  I can run
C:\dbClient>db2 catalog tcpip node TESTNODE remote dbServer server 50000
<<  I need the command to create the remote database  >>
C:\dbClient>db2 catalog database MYDATABASE at TESTNODE
C:\dbClient>db2 connect to MYDATABASE

I'm setting the points high here as time is of the essence.

Thanks, Mike
MikeDelaneyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sachinwadhwaCommented:
db2 catalog tcpip node <nodename> remote <HostName> server 50000 REMOTE_INSTANCE <instanceName> OSTYPE <Win/Linux/AIX>
db2 catalog database <dbname> at node <nodename>
db2 connect to <dbname>


E.g.
db2 catalog tcpip node SAMPnode remote DB2serv.acme.com server 50000 REMOTE_INSTANCE db2 OSTYPE WIN
db2 catalog database sample at node SAMPnode
db2 connect to sample

Notes:

If you don't know your instance name, default iInstance name is DB2 in Windows and db2inst1 in Linux


0
sachinwadhwaCommented:
oh... command to create remote database.

to create database:

db2 attach to <NodeName> user <username> using <password>
db2 create database <dbname> ........
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MikeDelaneyAuthor Commented:
Okay, but the returned response is:

c:\work>db2 catalog tcpip SAMPnode test remote db2Server server 50000 REMOTE_I
NSTANCE db2 OSTYPE WIN
DB20000I  The CATALOG TCPIP NODE command completed successfully.
DB21056W  Directory changes may not be effective until the directory cache is
refreshed.

c:\work>db2 catalog database sample at node SAMPnode
DB20000I  The CATALOG DATABASE command completed successfully.
DB21056W  Directory changes may not be effective until the directory cache is
refreshed.

c:\work>db2 connect to sample
SQL1031N  The database directory cannot be found on the indicated file system.
SQLSTATE=58031

So, How do I create the database?
0
sachinwadhwaCommented:
forgot to add in 1st post...

to create database:

db2 attach to <NodeName> user <username> using <password>
db2 create database <dbname> ........
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB2

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.