|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:35 PM
Points: 5,269,
Visits: 11,208
|
|
so if the restore worked thats not the problem. What status does the database show as in SSMS?
What does 'select state_desc from master.sys.databases' return for your database
If the name of the database is the same, and the logical file names are the same for the two files prod has, a straight restore database with no extra clauses should work.
---------------------------------------------------------------------
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:35 PM
Points: 5,269,
Visits: 11,208
|
|
Tripz (3/14/2013) To avoid all the confusions and complications I created a fresh db on dev and restored the backup to this freshly created db.
and now things seems to be clean and now the dev website is pointing to new dev db and seems to be fine now.
But - I am still not sure how to delete the extra ldf files in the backup file restore to db which has only one mdf and one ldf
what did you do with the original dev db?
The restore would remove the extra .ldf file for you.
---------------------------------------------------------------------
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 04, 2013 8:20 AM
Points: 33,
Visits: 124
|
|
I restored the db using interface. Not using the command
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 5:56 AM
Points: 525,
Visits: 1,004
|
|
Instead of creating fresh DB if we restore directly it is better and after restoring all files suppose it it not in appropriate drives modify it
or attach the database the database files in the dev server.
Thanks & Regards NAGA.ROHITKUMAR
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 8:42 AM
Points: 159,
Visits: 191
|
|
How big is the mdf file? Can you tolerate a little downtime?
I ask because I find the simplest way is to copy the mdf to the DEV environment and run the following:
create database <db_name> on (filename='<path to mdb>') on attach_rebuild_log;
That will create the database as per the orginal
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:35 PM
Points: 5,269,
Visits: 11,208
|
|
as far as i know this restore is done. ending up with the files you want is all doable via a restore of a bak file, starting to take risks and outages with detaching prod databases and then risking an inconsistent test database is not necessary.
---------------------------------------------------------------------
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 8:42 AM
Points: 159,
Visits: 191
|
|
Actually, it can be faster and more reliable than a backup and whats more it will always be consistent. The reason for that is in what happens when the database starts up and performs a recovery. All uncommited transactions are rolled back and makes the file consistent together with all the settings and transaction logs of the original.
As you quite rightly mentioned though, if downtime (not outage) is not an option then it isn't a viable option anyway.....
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:35 PM
Points: 5,269,
Visits: 11,208
|
|
kevaburg (3/20/2013) Actually, it can be faster and more reliable than a backup and whats more it will always be consistent. The reason for that is in what happens when the database starts up and performs a recovery. All uncommited transactions are rolled back and makes the file consistent together with all the settings and transaction logs of the original.
sorry, it won't be able to do that without the log file. you will only get away with it with a clean shutdown, so this is a risky way to do this and is unnecessary because a straight restore will take care of it.
---------------------------------------------------------------------
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 8:42 AM
Points: 159,
Visits: 191
|
|
Of course it will! It doesn't even need a clean shutdown because every time a SQL Server database starts, it performs a recovery, whether we want it to or not!
With the parameter FOR ATTACH_REBUILD_LOG the logs will be rebuilt as the MDF expects them to be! It is clean, very safe, extremely consistent and a great deal faster because you aren't restoring the data, simply attaching the database to the host instance!
Honestly, on the databases I create for testing, it has proven to me that there are options far beyond simple restores that can be multiple times faster and this is one of them!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:35 PM
Points: 5,269,
Visits: 11,208
|
|
to everyone out there, attach with rebuild log is a last resort, please don't replace restores with it.
---------------------------------------------------------------------
|
|
|
|