Need help in Restoring a SQL Database

  • Hello,

    I am running into an ironic situation. Here is the description:

    On a server X, I have databases named 'Sales' and 'ABCCom'.

    Now - on a differrent server Y, I have the database 'Sales'. Now I took a backup of 'Sales' as SalesDB.bak from server Y, and wanted to update the "one" at server X with this backup. But here is the problem - the "one" in the above statement is basically 'ABCCom' and NOT 'Sales'.

    I was wondering if the logical names of the database will clash while updating the database from the backup and will inturn update the one with 'Sales' name on Server X instead of 'ABCCom'.

    However, I wanted to update 'ABCCom' from the backup. Please help. Thanks

  • DO you want to overwrite the database?

    Then I can help....

    Chandrachurh Ghosh
    DBA – MS SQL Server
    Ericsson India Global Services Limited
    Quality is not an act, it is a habit.

  • You can try the SQL Tool belt from Redgate......and synchronize the databases if the schemas are almost similar....in case you want to do update selective changes........but be careful and take your time....but it will always be better to overwrite the database, if the Sales database is all you want....

    Chandrachurh Ghosh
    DBA – MS SQL Server
    Ericsson India Global Services Limited
    Quality is not an act, it is a habit.

  • ankitwaitshere (4/23/2008)


    Hello,

    I am running into an ironic situation. Here is the description:

    On a server X, I have databases named 'Sales' and 'ABCCom'.

    Now - on a differrent server Y, I have the database 'Sales'. Now I took a backup of 'Sales' as SalesDB.bak from server Y, and wanted to update the "one" at server X with this backup. But here is the problem - the "one" in the above statement is basically 'ABCCom' and NOT 'Sales'.

    I was wondering if the logical names of the database will clash while updating the database from the backup and will inturn update the one with 'Sales' name on Server X instead of 'ABCCom'.

    However, I wanted to update 'ABCCom' from the backup. Please help. Thanks

    logical names are unique within each database, you can have databases with the same logical file names, just not actual names. so you can restore a backup to sales even if the logical files are called ABCCom. Is that what your asking?

  • I don't want to destroy/modify any of the databases on server 'X'.

    I just thought of a cumbersome solution and could be better explained with normal maths (or, rather C language variables):

    int s = 21; // say this represents X.[Sales]

    int a = 31; //say this represents X.ABCCom

    int s1 = 41; // say this is Y.[Sales]

    desired result: a = 41 i.e. contents of s1

    take a new variable (i.e. create a new database X.[tempZ])

    int temp;

    temp = s;

    s = s1;

    a = s;

    s = temp;

    delete temp;

    But this is very ugly and tedious process to create a new database and copy the databases 4 fold.

    Please suggest a better alternative.

    Thanks.

  • It seems what you require is to use SSIS (SQL Server Integration Services).....something similar to a DTS, as you had in SQL 2000

    Chandrachurh Ghosh
    DBA – MS SQL Server
    Ericsson India Global Services Limited
    Quality is not an act, it is a habit.

  • Yes 'Animal Magic' , you precisely hit the problem. Server X has Databases' logical names 'Sales' and 'ABCCom'. And Server Y has the name 'Sales'. When I will backup Y.'Sales', and then restore it on X; I wonder it could update the 'Sales' database. However I dont want any change in the X.'Sales' database and wanted to update X.'ABCCom' from the backup. Please advice. Thanks.

  • Use SSMS, select the ABCCom database on X and right click, tasks, restore database. Choose the backup file you want and go to the options tab. Select "overwrite the existing database" and change the file names to either match those currently in use by the ABCCom database or choose new filenames. This will overwrite your ABCCom database.

    If in any doubt, just backup both databases on X before you start so that you can recover if needed.

  • As Matt listed, you can restore any backup to any name on the server. If a database with that name exists, you need to overwrite it.

    By default, the restore looks for the same name as the source database backed up, but it can be changed.

  • The problem doesn't seem to be solving yet. I am overwriting the database, while restoring.

    But Still I am getting an "internal inconsistency check" erorr.

    Please guide me, what could be the possibility?

  • When do you get the internal consistency error? Perhaps you have a corrupt backup?

  • I think you have a duff backup - try taking a fresh backup.

    Also for this sort of thing I would strongly recommend restoring first to a SQL server instance that does not have any of the possible clash issues you are worried about - maybe just install SQL on an oridnary PC somewhere to do this (don't know what size DB you have but with 1000GB < GBP120 now it is unusual to not have the space) and then you will at least know you have a good backup etc. Also this gives you the option of renaming the db and/or logical devices and/or physical file names on the intermediate copy and then you could rebackup this and restore to your live place without grief. With disk space so cheap I think you should always experiment on a copy ....

  • Ankit,

    this is problem for which table data imported to destination table.

    becoz this is datatype are not same or column name are difference.

    first check,

    1) both tables datatype & data size same or not

    2) column name or data length are exceeded.

    if any issues, let me know...

  • Ankit,

    this is problem for which table data imported to destination table.

    becoz this is datatype are not same or column name are difference.

    first check,

    1) both tables datatype & data size same or not

    2) column name or data length are exceeded.

    if any issues, let me know...

Viewing 14 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic. Login to reply