Hi All, I am facing a problem in restoring a database in MSSQL Server 2005. 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 !!
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.