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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Restore Header Information

Author  Topic 

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2005-02-09 : 21:15:22
/*
I am trying to write an sp to handle restoring databases
I would like to get the header information to pass through to
the restore database. This is what I have so far
*/

Create Table #RestoreHeader
(
LogicalName nvarchar(128) NULL, --Logical name of the file
PhysicalName nvarchar(260) NULL, --Physical or operating-system name of the file
Type char(1) NULL, --Data file (D) or a log file (L)
FileGroupName nvarchar(128) NULL, --Name of the filegroup that contains the file
Size numeric(20,0) NULL, --Current size in bytes
MaxSize numeric(20,0) NULL, --Maximum allowed size in bytes
)

--does not work
insert #RestoreHeader exec RESTORE FILELISTONLY FROM DISK = '\\MYSERVERNAME\backup$\AdminTools\AdminTools_20050208200000.BAK'



nr
SQLTeam MVY

12543 Posts

Posted - 2005-02-09 : 22:25:00
see
http://www.mindsdoor.net/SQLAdmin/s_RestoreDatabase.html
It does it
I think
create table #files (lname varchar(128), pname VARCHAR(128), type varchar(10), fgroup varchar(128), size varchar(50), maxsize varchar(50))

You might want to increase some of the sizes if you have long paths but...

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2005-02-10 : 13:32:20
Thank you this looks great!
My db backups are password protected so I have to script the restore as the EM interface does not provide this option.

Go to Top of Page
   

- Advertisement -