Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Posts
    268

    Unanswered: Creating DB using command line

    Hi All,

    I was given a task of coming up with the script to recreate an existing database using a command line. I would use this script in case when the server is down and I can't get to Query Analyzer or EM to recreate it. I am not sure where to start. Any ideas are greatly appreciated.

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    If the server is down, how would you be able to create a database? Other than that, look up the OSQL utility.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I'm assuming they have another server with sql server installed...

    And you should have sql server client tools installed on your desktop so you can connect to any server...no need to log on to a particular box

    And how do you want o create a "new" database?

    I'm assuming from a backup...is the backup copied to another box?

    If not, then when the server is down, you are sol
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Jul 2004
    Posts
    268
    It is a clustered SQL Server, so dev will stand for prod. Yes, the backup is being copied to a drive on a dev box.

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    OK, so create a *.sql file that does the restore and either create a bat file, or type this in the command line

    osql /U <login> /P <password>/i <filename>.sql

    simple enough
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jul 2004
    Posts
    268
    Yes it is. Thanks a lot.

Posting Permissions

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