cancel
Showing results for 
Search instead for 
Did you mean: 

commandline for restoring files

Varma_Chiluvuri
Level 5
Certified

I need to restore files from a particular client using commandline, please help me on this.

1 ACCEPTED SOLUTION

Accepted Solutions

Varma_Chiluvuri
Level 5
Certified

Is aix123 the source or destination client?
 

source and destination are the same.

 Must files be restored to same or different location?
location is the folder/path where files must be restored to.
 

same location

Have you tried bplist as per my suggestion 4 days ago?

e.g. if aix123 is source client and policy type is Standard:

bplist -C aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -R 3 /tmp/dir1

BPLIST worked fine

If the above command is listing the files that you need to restore, we can use the same parameters with bprestore.
We just need to know if files must be restored back to same client and if restore must be to same or different path.

restoration for same client but  for different client where we should mention it in the command.

bprestore -C aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -R 3 /tmp/dir1

 

View solution in original post

12 REPLIES 12

Nicolai
Moderator
Moderator
Partner    VIP   

Use the bprestore command. The command is available for both Windows and UNIX/Linux clients.

http://www.symantec.com/docs/HOWTO43687

 

Marianne
Level 6
Partner    VIP    Accredited Certified

Nicolai is 100% correct. bprestore is the command you are looking for. 
The biggest problem with bprestore is to find the correct combination of options/parameters.

Before you try to run a restore, test search criteria with bplist.
Important options:
Client name: this is case sensitive and needs to correspond with Client name in the policy that performed the backup.
Policy type: needs to correspond with the policy type that did the backup (0 for standard, 13 for MS-Windows)
Date range: ensure start and end dates contain valid backups for this client.
Files/folders: ensure correct path names are specified.

The most common error with bplist and bprestore is 'No entity found'.
All it means is that nothing could be found for the parameters that you have specified.
So, check selection parameters carefully...

To troubleshoot, always add -L <log-file> to the command and create log folders:
On master: bprd (restart NBU after creating log folder)
On media server: bptm and bpbrm
On client: bpcd and tar

 

Good luck!

sdo
Moderator
Moderator
Partner    VIP    Certified

I see your O/S is AIX - so apologies, but I only have a test Windows box (so please also excuse the shocking date handling...)

Here's a grab of test restore that worked...

...which restores a file backed-up within the last week, and renames it.

 

>REM Show the empty folder...

>dir T:\TEST001\
Directory of T:\TEST001
22/02/2014  00:14    <DIR>          .
22/02/2014  00:14    <DIR>          ..
               0 File(s)              0 bytes

>REM Run the script (listed below...)
>restore.bat
Call to bpestore was successful.
Press any key to continue . . .

>REM Show the restored file...
>dir T:\TEST001\
Directory of T:\TEST001
22/02/2014  00:16    <DIR>          .
22/02/2014  00:16    <DIR>          ..
20/02/2014  23:23       815,567,966 abc.dat
 

 

...and these were the files:

>type restore.inp
16 T:\TEST001\a.dat

>type restore.ren
change /T/TEST001/a.dat to /T/TEST001/abc.dat

>type restore.bat
@echo off
setlocal enabledelayedexpansion

set z_path=%~dp0
set z_name=%~n0

set z_file_inp=!z_path!!z_name!.inp
set z_file_log=!z_path!!z_name!.log
set z_file_ren=!z_path!!z_name!.ren

set z_date_dd_mm_yyyy=!date!

set z_date_dd=!z_date_dd_mm_yyyy:~0,2!
set z_date_mm=!z_date_dd_mm_yyyy:~3,2!
set z_date_yyyy=!z_date_dd_mm_yyyy:~6,4!

set z_rest_dd=!z_date_dd!
set z_rest_mm=!z_date_mm!
set z_rest_yyyy=!z_date_yyyy!

set /a z_rest_dd=!z_date_dd! - 7
if !z_rest_dd! lss 1 (
  set /a z_rest_mm=!z_date_mm! - 1
  if !z_rest_mm! lss 1 (
    set /a z_rest_yyyy=!z_date_yyyy! - 1
    set z_rest_mm=12
  )
  if !z_rest_mm! equ  1  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ  2  set /a z_rest_dd=28 - !z_rest_dd! - 1
  if !z_rest_mm! equ  3  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ  4  set /a z_rest_dd=30 - !z_rest_dd! - 1
  if !z_rest_mm! equ  5  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ  6  set /a z_rest_dd=30 - !z_rest_dd! - 1
  if !z_rest_mm! equ  7  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ  8  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ  9  set /a z_rest_dd=30 - !z_rest_dd! - 1
  if !z_rest_mm! equ 10  set /a z_rest_dd=31 - !z_rest_dd! - 1
  if !z_rest_mm! equ 11  set /a z_rest_dd=30 - !z_rest_dd! - 1
  if !z_rest_mm! equ 12  set /a z_rest_dd=31 - !z_rest_dd! - 1
)

set z_beg_date_time=!z_rest_dd!/!z_rest_mm!/!z_rest_yyyy! 00:00:00
set z_end_date_time=!z_date_dd!/!z_date_mm!/!z_date_yyyy! 23:59:59

REM watch out for line wrap here...
bprestore -B -C hserver -D hserver -t 13 -w 00:30:00 -L "!z_file_log!" -R "!z_file_ren!" -s !z_beg_date_time! -e !z_end_date_time! -f "!z_file_inp!"

set z_sts=!errorlevel!

if !z_sts!==0 (
  echo Call to bpestore was successful.
) else (
  echo Call to bprestore failed, status !z_sts!...
)

echo+
pause
exit /b

 

>REM And this is the log file created...

>type restore.log

Restore started 22/02/2014 00:15:55
00:15:55 (2384.001) Restoring from copy 1 of image created 21/02/2014 23:35:34
00:15:58 (2384.001) INF - TAR STARTED 7820
00:15:59 (2384.001) INF - Beginning restore from server hserver to client hserver.
00:16:01 (2384.001) TAR - T:\TEST001\a.dat
00:16:01 (2384.001) MNR - The file was renamed to the following:
00:16:01 (2384.001) UTF - T:\TEST001\abc.dat
00:16:02 (2384.001) INF - TAR EXITING WITH STATUS = 0
00:16:02 (2384.001) INF - TAR RESTORED 1 OF 1 FILES SUCCESSFULLY
00:16:02 (2384.001) INF - TAR KEPT 0 EXISTING FILES
00:16:02 (2384.001) INF - TAR PARTIALLY RESTORED 0 FILES
00:16:02 (2384.001) Status of restore from copy 1 of image created 21/02/2014 23:35:34 = the requested operation was successfully completed
00:16:03 (2384.xxx) INF - Status = the requested operation was successfully completed.
 

 

HTH,

Dave.

Marianne
Level 6
Partner    VIP    Accredited Certified

An NO RESPONSE from the OP in 4 days... surprise  Guess this is not urgent...indecision

Varma_Chiluvuri
Level 5
Certified

I am trying the options in bprestore command, my requirement is

server        : aix123

directory    : /tmp/dir1

/tmp/dir1 contains a,b,c,d,e,f files

 

from the command line I need to restore b,c,d files in server aix123.

Can you suggest the command line for my above query in unix operating system (AIX).

Marianne
Level 6
Partner    VIP    Accredited Certified

Some questions that are not clear from your post:

  1. Is aix123 the source or destination client? Or both?
  2. Do you want to start the restore from the master or the client?
  3. Must files be restored to same or different location?
  4. Do you want to restore entire folder or just the specific files in the folder?
  5. Do you want to restore from a specific backup (particular date) or simply from last successful backup?

Varma_Chiluvuri
Level 5
Certified
  1. Is aix123 the source or destination client? Or both?

           aix123 is the client

      2. Do you want to start the restore from the master or the client?

          I want to start the restore from the master.

      3.  Must files be restored to same or different location?

          I want to restore files to destination client aix123

      4. Do you want to restore entire folder or just the specific files in the folder?

          I need to restore specific files b, c, d in /tmp/dir1 directory.

      5. Do you want to restore from a specific backup (particular date) or simply from last successful backup?

          specific backup (date Dec 21 2013)

Marianne
Level 6
Partner    VIP    Accredited Certified

Again:
Is aix123 the source or destination client?
Source client: the client that performed the backup
Destination client: the client where files must be restored to.

 Must files be restored to same or different location?
location is the folder/path where files must be restored to.
Same location will overwrite original files.
Different location will create new files (copy).

Have you tried bplist as per my suggestion 4 days ago?

e.g. if aix123 is source client and policy type is Standard:

bplist -C aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -R 3 /tmp/dir1

If the above command is listing the files that you need to restore, we can use the same parameters with bprestore.
We just need to know if files must be restored back to same client and if restore must be to same or different path.

Varma_Chiluvuri
Level 5
Certified

Is aix123 the source or destination client?
 

source and destination are the same.

 Must files be restored to same or different location?
location is the folder/path where files must be restored to.
 

same location

Have you tried bplist as per my suggestion 4 days ago?

e.g. if aix123 is source client and policy type is Standard:

bplist -C aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -R 3 /tmp/dir1

BPLIST worked fine

If the above command is listing the files that you need to restore, we can use the same parameters with bprestore.
We just need to know if files must be restored back to same client and if restore must be to same or different path.

restoration for same client but  for different client where we should mention it in the command.

bprestore -C aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -R 3 /tmp/dir1

 

Marianne
Level 6
Partner    VIP    Accredited Certified

Well, almost all parameters.... not -R as with bplist command...
We also need to specify destination client, or else the files will be restored to the master server.

To restore only the 3 files (b, c, d) you need to mention them explicitly or else create a text file that lists all the files you need to restore. 

bprestore -C aix123 -D aix123 -t 0 -s 12/21/2013 -e 12/21/2013 /tmp/dir1/b /tmp/dir1/c /tmp/dir1/d

The alternative: create a file with a list of filenames, e.g. /tmp/rest-files with the following in the file:
/tmp/dir1/b 
/tmp/dir1/c 
/tmp/dir1/d

Now run the restore with -f <filename>:

bprestore -C aix123 -D aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -f /tmp/rest-files

You may want to add a log file to monitor progress or for troubleshooting purposes (-L option):

bprestore -C aix123 -D aix123 -t 0 -s 12/21/2013 -e 12/21/2013 -L /tmp/rest.out -f /tmp/rest-files

Varma_Chiluvuri
Level 5
Certified

Marianne

It worked thanks,

Why we need to give policy type -t as 0 ?

Marianne
Level 6
Partner    VIP    Accredited Certified

Why we need to give policy type -t as 0 ?

Because there are many Policy types in NBU.

If you have a Unix/Linux master server, the default policy type will be 0 (Standard), so, no need to specify if the policy is Standard. 

If you have a Windows master server, the default will be 13 (MS-Windows). So, here the policy type must be specified if you want to restore non-Windows backups.