As already mentioned in my previous blog post Autosave of SAP instances' work folder sometimes it is really necessary to keep content of work folder. For SAP systems running on Unix (AIX, HP-UX, Oracle-Solaris, Linux) I already have found a workaround. But how about Windows? Well, after some testing I can share my experiences with you. Count with the same Pros and Cons as previously:
Pro
Con
Are you curious? Let's check the steps.
First of all, please note, that it's Windows, therefore some more manual steps will be necessary. Why exactly? Because regional setting, in this case datum and time format may be different on operating system level depending on your region.
Okay, and what now? Tell me more, I can't wait. Let the show begin!
Steps:
Result:
dir <drive>:\usr\sap\<SID>\D<VEBMGS><NR> | findstr /I "work"
15.10.2015 15:50 <DIR> work
15.10.2015 15:44 252.201 work_15102015_154442,47.SAR
Method 2:
If echo %date%_%time% has this format Mon 10/19/15_11:02:04.65 create a command script (e.g.: backup.cmd) in DIR_INSTACE folder (<drive>:\usr\sap\<SID>\D<VEBMGS><NR>) with content
@echo off
set date=%date:~4,8%
set date=%date:/=%
set date=%date: =0%
set time=%time:~0,8%
set time=%time::=%
set time=%time: =0%
SAPCAR -cfi ..\work_"%date%_%time%".SAR -C ..\work . -F "core*"
set date=
set time=
exit
and add this line in profile: Start_Program_<NR> = immediate $(DIR_INSTANCE)\<name>.cmd
Example: Start_Program_05 = immediate $(DIR_INSTANCE)\backup.cmd
Result: SAR looks like work_101915_105336.SAR
Adam, and what is your recommendation? Which method is the simplest?
This one:
Method 3:
The most common solution is to use powershell for date and time formatting. In this case you don't have to mess with command line but powershell does it. You only have to add this line in profile: Start_Program_<NR> = immediate powershell -ExecutionPolicy bypass -command SAPCAR -cfi ..\work_$(Get-Date -format yyyyMMdd_HHmmss).SAR -C ..\work . -F "core*"
Result: SAR looks like work_20151019_105337.SAR
Explanation of profile entry and SAPCAR options:
Same is valid as in Autosave of SAP instances' work folder
Success. Or rather almost success.
We're already close to the end. If you want to extract the archive created according to method 1, an error appears:
SAPCAR -xvf <drive>:\usr\sap\<SID>\D<VEBMGS><NR>\work_15102015_154442,47.SAR -R <path\work_test
SAPCAR: error opening <drive>:\usr\sap\<SID>\D<VEBMGS><NR>\work_15102015_154442 (error 6). The system cannot find the file specified.
SAPCAR: 0 file(s) extracted
SAPCAR: error opening 47.SAR (error 6). The system cannot find the file specified.
SAPCAR: 0 file(s) extracted
Just run SAPCAR without arguments and you'll find the answer. "," is the trick.
And what's our trick to overcome this?
Oh, yeah.
Enjoy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
36 | |
18 | |
13 | |
13 | |
13 | |
10 | |
10 | |
9 | |
8 | |
8 |