Thursday, March 22, 2012

Restoring a BAK Do I Need the Schema ?

Hello everyone,
I'm new to SQL Server 2005. I'm using the Express version.
A co-worker sent me a BAK file which I need to restore. My question is, do I
need to have the database structure already in place before I can do the
restore? I was wondering if there's a way to simply restore the BAK file
into an empty database and have underlying tables/sprocs automatically
created as part of the restore process. Is this possible?
Thanks very much.
Yes. You can either just restore the bak file and let it create what it
needs or you can
1. Create empty, new database with the same name
2. Do a backup of the same name as your backup
3. Put the co-worker's backup in place of the backup in 2
4. Restore the backup and tell it to overwrite an existing DB.
Alan Foxmore wrote:
> Hello everyone,
> I'm new to SQL Server 2005. I'm using the Express version.
> A co-worker sent me a BAK file which I need to restore. My question is, do I
> need to have the database structure already in place before I can do the
> restore? I was wondering if there's a way to simply restore the BAK file
> into an empty database and have underlying tables/sprocs automatically
> created as part of the restore process. Is this possible?
> Thanks very much.
>
|||Actually, step 1 to 3 are unnecessary and a waste of time. The restore process will create the
database for you.
You might need to investigate what files were used for the original database (RESTORE HEADERONLY and
RESTORE FILELISTONLY) and then specify new physical filenames when you restore (using the MOVE
option of the RESTORE command).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"MSDN" <Grunt@.newsgroup.nospam> wrote in message news:eAc3EaxkHHA.492@.TK2MSFTNGP04.phx.gbl...[vbcol=seagreen]
> Yes. You can either just restore the bak file and let it create what it needs or you can
> 1. Create empty, new database with the same name
> 2. Do a backup of the same name as your backup
> 3. Put the co-worker's backup in place of the backup in 2
> 4. Restore the backup and tell it to overwrite an existing DB.
>
> Alan Foxmore wrote:
|||I always wondered about that. I've taken to just restoring the file as I
suggested. However, when I inherited the SQL stuff that was the
technique the current admin used and recommended. It didn't make much
sense to me but at the time he new much more than I did <G>.
Tibor Karaszi wrote:
> Actually, step 1 to 3 are unnecessary and a waste of time. The restore
> process will create the database for you.
> You might need to investigate what files were used for the original
> database (RESTORE HEADERONLY and RESTORE FILELISTONLY) and then specify
> new physical filenames when you restore (using the MOVE option of the
> RESTORE command).
>
|||Perhaps that person had worked with the old architecture (6.5 and older), where you actually *had*
to create the database first?
:-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"MSDN" <Grunt@.newsgroup.nospam> wrote in message news:%23e7CJmykHHA.568@.TK2MSFTNGP02.phx.gbl...[vbcol=seagreen]
>I always wondered about that. I've taken to just restoring the file as I suggested. However, when
>I inherited the SQL stuff that was the technique the current admin used and recommended. It didn't
>make much sense to me but at the time he new much more than I did <G>.
>
> Tibor Karaszi wrote:
|||That would explain it. I picked it up when I migrated a SQL 7 to SQL
2000. He did have 6.5 or earlier experience. Thanks.
Tibor Karaszi wrote:
> Perhaps that person had worked with the old architecture (6.5 and
> older), where you actually *had* to create the database first?
> :-)
>
|||Thank you all... It works now. I had to change to the account under which
the service was running to the Local Account.
Thanks again.
"Alan Foxmore" <afoxmore@.yahoo.com> wrote in message
news:upPyLKxkHHA.4112@.TK2MSFTNGP04.phx.gbl...
> Hello everyone,
> I'm new to SQL Server 2005. I'm using the Express version.
> A co-worker sent me a BAK file which I need to restore. My question is, do
> I need to have the database structure already in place before I can do the
> restore? I was wondering if there's a way to simply restore the BAK file
> into an empty database and have underlying tables/sprocs automatically
> created as part of the restore process. Is this possible?
> Thanks very much.
>

No comments:

Post a Comment