MSSQL Server 2005

Discussion in 'SQL Server' started by ArunVeera, Apr 17, 2006.

  1. ArunVeera

    ArunVeera New Member

    Joined:
    Apr 17, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi All,

    I am facing a problem in restoring a database in MSSQL Server 2005. :mad:

    Our requirement is to restore a database from a backup file. We are using the following query for restoring the database.

    "RESTORE DATABASE <New Database Name> FROM DISK = '<Physical Location of backup file>' WITH REPLACE, MOVE '<Logical name of database file>' TO '<Physical location of database file>', MOVE '<Logical name of transaction log file>' TO '<Physical location of transaction log file>'"

    After this execution, we will be giving some user privilages to this restored database. We are executing the query using ODBC API SQLExecute(). The query is getting executed successfully. But, the problem is, API returns control before complete restoration. So, the program continues to execute the next operation of assigning privilages before restoration, which results in error.

    So, we want to know if there are any methods to check whether the restoration is completed, so that we can use that before assigning privilages.

    Thanks in Advance !!
     
  2. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    736
    Likes Received:
    38
    Trophy Points:
    28
    I always used the enterprise manager for the database backup and restore but I also faced the same problem. The problem was with the relationship and it used to create a table which had a relationship with the other table which was being created at later stage. I just ran the schema restoration more than couple of times and that solved the problem. You probably need to be doing something similar. Restore the database schema first then data and then proceed on.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice