| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

01-28-09, 08:50
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 6
|
|
How to run a ddl script?
|
|
Let me first mention that i am a newbie.
I had developed a database. Before formatting my system, I had generated the ddl script and a backup of the database.
Now i want the same tables and the data that I had earlier.
I tried to run the command db2 -tvf TGMC2008 - DDL
But i am getting SQL5005C System Error.
Kindly guide me. also tell me how to use the backup data.
|
|

01-28-09, 09:37
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
Assume you script is named TGMC2008.DDL and contains the following
Code:
connect to sample;
select * from emp;
alter table emp add column imigration_status smallint;
connect reset;
The run the script with this:
db2 -tvf TGMC2008.DDL > TGMC2008.OUT
Note that in Linux and UNIX, the file names are case sensitive.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

01-28-09, 10:06
|
|
Registered User
|
|
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
|
|
|
|
[QUOTE=mahendrakariya]I had developed a database. Before formatting my system, I had generated the ddl script and a backup of the database. Now i want the same tables and the data that I had earlier.
QUOTE]
It might not answer your question but why don't you just restore your db? Then you don't need to create all objects one by one and load tables.
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
|
|

01-28-09, 10:10
|
|
Registered User
|
|
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
|
|
DDL scripts will only create your db structure but will have no data....so the best thing is to restore the db
__________________
IBM Certified Database Associate, DB2 9 for LUW
|
|

01-29-09, 08:20
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 6
|
|
Quote:
|
Originally Posted by nick.ncs
DDL scripts will only create your db structure but will have no data....so the best thing is to restore the db
|
Thanks... Can u tell me how can i restore the db. I have the ddl script as well as the backup of the db.
|
|

01-29-09, 10:40
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
Quote:
|
Originally Posted by mahendrakariya
Thanks... Can u tell me how can i restore the db. I have the ddl script as well as the backup of the db.
|
You use the RESTORE DATABASE command for that.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|

01-30-09, 08:35
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 6
|
|
Thanks for all this help. But i m still not getting it. The ddl file is named TGMC2008 - DDL.ddl and the backup file is named TGMC2008.0.DB2 -- Backup. The original db name was TGMC2008. I just want to restore it. What command should I use?
|
|

01-30-09, 09:18
|
|
Super Moderator
|
|
Join Date: Aug 2001
Location: UK
Posts: 4,534
|
|
If you have a bakcup file, then using RESTORE command will get both the table structures, indexes etc and the data. It is not necessary to run the DDL.
In your original post, you have mentioned about SQL5005C ... That has nothing to do with your ddl or restore ..
Code:
SQL5005C System Error.
Explanation:
A system error, probably an I/O error, was encountered while
accessing a configuration file.
The command cannot be processed.
User Response:
Resubmit the command.
If the error persists, check the db2diag.log file for details
and ensure that the configuration file is accessible. If unable
to resolve the problem, contact an IBM Service Representative for
assistance.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
|
|

01-30-09, 11:41
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
Quote:
|
Originally Posted by mahendrakariya
Thanks for all this help. But i m still not getting it. The ddl file is named TGMC2008 - DDL.ddl and the backup file is named TGMC2008.0.DB2 -- Backup. The original db name was TGMC2008. I just want to restore it. What command should I use?
|
Sorry, I don't understand your question at all. If you search in the DB2 manuals, you will find the "RESTORE" command that all of us are referring to. Is there some problem with using this command?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|

01-30-09, 11:59
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
Quote:
|
Originally Posted by mahendrakariya
Thanks for all this help. But i m still not getting it. The ddl file is named TGMC2008 - DDL.ddl and the backup file is named TGMC2008.0.DB2 -- Backup. The original db name was TGMC2008. I just want to restore it. What command should I use?
|
The command is:
find experienced DBA
We are not hear to help people who know absolutely nothing about DB2.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

01-31-09, 07:24
|
|
Registered User
|
|
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
|
|
please be more specific with all questions you ask
we can not see what you are doing or wanting todo
give as much as possible details with a complete scenario and why you want todo this. in that case we might be able to help
at least, have a look at infocenter/books for all possible commands/syntax as they have been created for that purpose
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|