Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    8

    Question Unanswered: Osql Syntax Help

    Dear friends,

    I was trying to run this script from a dos batch file under win xp but it's not working. Please help with the syntax.
    ================================================== =======
    OSQL -U sa -P samsde -S firebird /Q "RESTORE DATABASE NAVIMEX FROM DISK = 'C:\30704' WITH

    REPLACE, MOVE'NAVIMEX_Data' TO 'C:\Program Files\Microsoft SQL

    Server\MSSQL\Data\NAVIMEX_Data.MDF',MOVE 'NAVIMEX_Log' TO 'C:\Program Files\Microsoft SQL

    Server\MSSQL\Data\NAVIMEX_LOG.LDF'" QUIT
    ================================================== ========


    Please provide me with the correct syntax to be put in a 'restore.bat' file

    Thanks in advance.
    HotBird

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    What errors are you getting? You can add "/o<filename>" or use command line redirection to capture all errors. And don't use QUIT unless your RESTORE was unsuccessful.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    make sure that you dont hit enter after "microsoft sql" in the path
    try a shorter path
    also i believe that when you issue a restore cmd from disk, you have to specify the file name
    ex
    from disk = 'c:\data\northwind.mdf'

    to back up robert, what errors do you get?

  4. #4
    Join Date
    May 2004
    Posts
    8

    Arrow Works but...

    Dear Friends,

    Thank you for your replies,

    The script works but I'm facing a problem while trying to restore from a network drive or a remote path (\\xxx.xxx.xxx.xxx\mypath\filename)

    can you help please?

    Regards,

    Samer Chaer

  5. #5
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    It's usually due to a lack of necessary permissions on behalf of the security context under which the process is invoked.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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