January 22, 2016 at 2:59 pm
hi,
i am planning automate my database new from shared backup location,
the requirement is need to auto pick up the full backup from shared location and do the restores.
can anyone suggest how to start with this
January 22, 2016 at 10:25 pm
Sree Divya (1/22/2016)
hi,i am planning automate my database new from shared backup location,
the requirement is need to auto pick up the full backup from shared location and do the restores.
can anyone suggest how to start with this
If the file names are consistent and contain a date/time stamp, the you can use the undocumented xp_DirTree path/unc,1,1 extended stored procedure to get the names of files from a shared folder. You could also have prod push the data from MSDB to a "maintenance table" on the server that you're restoring to.
Before you restore from prod, though, you should make sure that things like SSNs and other severe PII is encrypted.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 25, 2016 at 6:16 pm
hi,
in my shared location db backup is .lbak
January 25, 2016 at 6:42 pm
Sree Divya (1/25/2016)
hi,in my shared location db backup is .lbak
Like I said, use xp_DirTree. Here's an example...
EXEC xp_DirTree 'C:\',1,1
Replace the "C:\" with either the drive and path to your backups or the UNC (\\MachineName\share\path) to pickup your backups. The command does NOT take file names or wild cards so you need to route the output into a temp table to use it. Something like this...
--===== Create the table to store the file names in.
CREATE TABLE #FileInfo
(
RowNum INT IDENTITY(1,1) PRIMARY KEY CLUSTERED
,ObjectName VARCHAR(500)
,Depth TINYINT
,IsFile TINYINT --is a file if this column has a 1 in it
)
;
--===== Get the file names, which may include Directory names.
-- IsFile will contain a 0 for directories.
-- IsFile will contain a 1 for files.
INSERT INTO #FileInfo
(ObjectName, Depth, IsFile)
EXEC xp_DirTree 'C:\',1,1 --Again, change the "C:\" to the drive:path or UNC of your BAK files.
;
--===== Put your routine here to step through the files in the table.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 26, 2016 at 3:20 am
That will possible though SSIS package If you have any idea about SSIS it is easy to implement the same
January 26, 2016 at 7:11 am
New persopn (1/26/2016)
That will possible though SSIS package If you have any idea about SSIS it is easy to implement the same
Now's your chance... how do you do it through SSIS?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2016 at 2:47 am
You can create Stored procedure for restoring, with parameters , dbname and path. Best way, you need to pass paramaters and execute SP.
Sagar Sonawane
** Every DBA has his day!!:cool:
January 29, 2016 at 3:31 am
I have an SSIS package that does all this. It chooses ten databases at random from the whole estate and restores them one by one from the latest full, differential and log backups. It then does a DBCC check on each, before putting an F at the start of the name of each database that failed the DBCC, sending out a failure report if appropriate, and deleting all databases that restored and DBCCed successfully. When if finishes, it does the same thing again, excluding any database that's been randomly selected in the last 24 hours.
John
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply