Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mitin
Yak Posting Veteran
81 Posts |
Posted - 2012-05-05 : 05:48:42
|
Hi,Im using SQL Server 2005. I have "inherited" the task of looking after a database in my job role, and I am new to it. Although have a little background in Oracle (covered it at Uni).I have successfully backed up and restored my SQL Server 2005 database, however when I restored the database, I did it to an instance of SQL server that didnt actually have a database named the same as the one I was restoring.For example, say my database is called "database1", however I did not have a database set up on the instance of SQL Sever I was restoring into called "database1". (Actually I did at one point, but when I was trying to restore I was getting errors, and people on other forums told me it was because the databases had the same names(cant remember exactly now) but basically I deleted the database and the files on the new server))Anyway, the back up seems to have been a success, i can write queries in SQL Server Management Studio and view my tables. BUT i can not see the database in the Management Studio GUI, is this something to do with the way the DB was restored from the backup files? Whast can I do to make it be seen in management studio? Hopefully this is simple :)I think the command I used for my backup was something like:USE MASTERRESTORE FROM DISK = "C:\BACKUP\backup.bak, "D:\BACKUP\backup2.bak(I know this wont be exactly right because I cant check at the minute. However I did "use master".)On a side not, I remember at first, when I was trying to get my backup command to work, I was using "WITH MOVE" and specifying drives on the new VM (hosting my server) where the database files should be written to. However I couldnt get the command to work, so I deleted all the "WITH MOVE" stuff. and ran the code above, I was very pleasently surprised that SQL Server seemed to locate drives on the server that had enough space free to store the database fiels and write them there automatically. This is a feature of SQL Server yes? :)I appreciate this may seem a really lame question, but I'm just starting out. Cheers |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2012-05-05 : 07:08:54
|
The syntax you've posted would throw a syntax error.The correct syntax is RESTORE database mydb1 FROM DISK = 'H:\mydb1.bak'Do a select * from sys.sysdatabases and does the database appear in the list?Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
mitin
Yak Posting Veteran
81 Posts |
Posted - 2012-05-05 : 09:01:32
|
yeah, thats the command I used. but I knew the one I posted above wasn't right anyway.cool, I will try that, however I won't have access to the SQL Server install until a few days time. I think that it will show in the list though, since I can query it.I'm just hoping there is an easy way around this, surely its common. I'm thinking if worst comes to worst and there isn't a way to make it show in the GUI, then I'll delete the database and restore the .bk files again. Only this time I will try and restore to an empty database that I create in the GUI. Hopefully the restore will just write over the DB files that it would find under the different drive letters in such a scenario.Thanks |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2012-05-05 : 09:44:27
|
Did you refresh the database list in the GUI? Right-click on the databases folder and refresh?You do not have to pre-create a database to restore into. When you restore a database as a new database (new name) - SQL Server will create the database for you. |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2012-05-05 : 14:28:48
|
mitin, based on the details - it sounds like the RESTORE worked - because you're able to interact with the objects. Once you've tried the suggestion by jeffw8713 - and you still can't view the database on the GUI - could you try on another machineJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
|
|
|
|
|