Results 1 to 11 of 11
  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Question Unanswered: 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.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    Join Date
    Dec 2008
    Location
    Toronto, Canada
    Posts
    399
    [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 9.5/9.7 on Unix/AIX 6.1/Linux

  4. #4
    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

  5. #5
    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.

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  7. #7
    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?

  8. #8
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  9. #9
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  10. #10
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  11. #11
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    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
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •