Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   MSSQL Server 2005 (http://www.go4expert.com/forums/mssql-server-2005-t732/)

ArunVeera 17Apr2006 10:14

MSSQL Server 2005
 
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 !!

coderzone 17Apr2006 21:36

Re: MSSQL Server 2005
 
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.


All times are GMT +5.5. The time now is 14:15.