Data Backup and Recovery
Data Backup and Recovery
Hello all,
I would like to run a script after my db2 database is unquiesced.
I use SnapCreator 3.5 and Linux.
So I created a test script and stored this in /tmp directory.
Then I implemented the script in my SnapCreator configuration file
PRE_APP_UNQUIESCE_CMD01=/tmp/delete.sh
Also I allowed this script to run in the Agent agent.conf
host: scServer@*
command:*
When I run this I get an error:
Mon Sep 10 13:46:14 2012] ERROR: Command [/tmp/delete.sh] failed with return code [256] and message []
[Mon Sep 10 13:46:14 2012] ERROR: [scf-00103] Running pre application unquiesce command [/tmp/delete.sh] failed with exit code [256] and message []
Did I miss something?
Thanks a lot.
BR,
Andreas
Yes you need a space between command: and * so "command: *" in agent.conf
Keith
Hi Keith,
thanks for your fast reply. I fixed this but I get the same error.
I now tested this with a standard db2 pluging configuration and it's working fine.
But I have another configuration here:
The customer wants to snapshot 4 dbs at the same time so I quiesce them serially, take a snapshot and unquiesce them again.
So I have a configuration for each database containing the db2 (un)quiesce command (db2 plugin), and one main configuration file with the filer logon and volumes. The main configuration calls each db2 configuration by e.g command
APP_QUIESCE_CMD01=snapcreator.exe -profile xxxx -config xxx -action quiesce
I entered my "delete.sh" in the main configuration and also for testing in the database relevant configuration file, I always get the error
Mon Sep 10 13:46:14 2012] ERROR: Command [/tmp/delete.sh] failed with return code [256] and message []
[Mon Sep 10 13:46:14 2012] ERROR: [scf-00103] Running pre application unquiesce command [/tmp/delete.sh] failed with exit code [256] and message []
Any idea?
Thank you very much.
BR,
Andreas
You need to put script under some other directory probably, not /tmp and not the directory where scAgent is. The 256 error is comming from your script so you need to troubleshoot why.
Keith
Hi Keith,
but the script is working well when I use a standard db2 plugin configuration.
I just have this lines:
#!/bin/bash
/usr/bin/touch /tmp/test
nothing special...
Thank you!
Br,
Andreas
Can you run with --debug argument and send output as well as config file settings?
Keith
Hi Keith,
here are the config files:
Main Configuration
########################
### Required Options ###
########################
CONFIG_TYPE=STANDARD
SNAME=S-Landschaft
SNAP_TIMESTAMP_ONLY=N
VOLUMES=xxx:sarch,sdata,slogs,ssoft
NTAP_SNAPSHOT_RETENTIONS=daily:5,weekly:1
NTAP_USERS=xxx:xxx
NTAP_PWD_PROTECTION=Y
TRANSPORT=HTTPS
PORT=443
LOG_NUM=30
LOG_TRACE_ENABLE=Y
SC_TMP_DIR=
########################
### Snapshot Options ###
########################
NTAP_SNAPSHOT_RETENTION_AGE=5
SNAPDRIVE=N
SNAPDRIVE_DISCOVERY=N
NTAP_SNAPSHOT_DISABLE=N
NTAP_SNAPSHOT_NODELETE=N
NTAP_CONSISTENCY_GROUP_SNAPSHOT=Y
NTAP_CONSISTENCY_GROUP_TIMEOUT=medium
NTAP_CONSISTENCY_GROUP_WAFL_SYNC=N
NTAP_SNAPSHOT_DELETE_BY_AGE_ONLY=N
NTAP_SNAPSHOT_DEPENDENCY_IGNORE=N
NTAP_SNAPSHOT_RESTORE_AUTO_DETECT=N
#####################
### Post Commands ###
#####################
POST_APP_QUIESCE_CMD01=
POST_NTAP_CMD01=
POST_NTAP_DATA_TRANSFER_CMD01=
POST_APP_UNQUIESCE_CMD01=/tmp/delete.sh
POST_RESTORE_CMD01=
POST_CLONE_CREATE_CMD01=
SC_AGENT=
SC_AGENT_TIMEOUT=
SC_AGENT_UNQUIESCE_TIMEOUT=
SC_CLONE_TARGET=
SC_AGENT_WATCHDOG_ENABLE=Y
SC_AGENT_LOG_ENABLE=Y
APP_QUIESCE_CMD01=snapcreator.exe -profile S-Landschaft -config xxx1 -action quiesce
APP_QUIESCE_CMD02=snapcreator.exe -profile S-Landschaft -config xxx2 -action quiesce
APP_UNQUIESCE_CMD01=snapcreator.exe -profile S-Landschaft -config xxx1 -action unquiesce
APP_UNQUIESCE_CMD02=snapcreator.exe -profile S-Landschaft -config xxx2 -action unquiesce
DB 1 specific Configuration
########################
### Required Options ###
########################
CONFIG_TYPE=PLUGIN
SNAME=
SNAP_TIMESTAMP_ONLY=N
VOLUMES=
NTAP_SNAPSHOT_RETENTIONS=
NTAP_USERS=
NTAP_PWD_PROTECTION=Y
TRANSPORT=
PORT=80
LOG_NUM=30
LOG_TRACE_ENABLE=Y
SC_TMP_DIR=
SC_AGENT=name.domain.xx:9090
SC_AGENT_TIMEOUT=60
SC_AGENT_UNQUIESCE_TIMEOUT=
SC_CLONE_TARGET=
SC_AGENT_WATCHDOG_ENABLE=Y
SC_AGENT_LOG_ENABLE=Y
APP_NAME=db2
FS_NAME=
Here is the debug out:
########## POST APPLICATION UNQUIESCE COMMANDS ##########
[Tue Sep 11 12:23:43 2012] INFO: Running post application unquiesce command POST_APP_UNQUIESCE_CMD01 [/tmp/delete.sh]
[Tue Sep 11 12:23:43 2012] DEBUG: Executing command [/tmp/delete.sh]
[Tue Sep 11 12:23:43 2012] TRACE: Command [/tmp/delete.sh] finished with
exit code: [256]
stdout: []
stderr: []
[Tue Sep 11 12:23:43 2012] ERROR: Command [/tmp/delete.sh] failed with return code [256] and message []
[Tue Sep 11 12:23:43 2012] ERROR: [scf-00103] Running post application unquiesce command [/tmp/delete.sh] failed with exit code [256] and message []
########## POST APPLICATION UNQUIESCE COMMANDS FINISHED WITH FAILURES ##########
########## PRE EXIT COMMANDS ##########
[Tue Sep 11 12:23:43 2012] INFO: No commands defined
########## PRE EXIT COMMANDS FINISHED SUCCESSFULLY ##########
[Tue Sep 11 12:23:43 2012] DEBUG: Exiting with error code - 1
Where does the /tmp/delete.sh script exist? On the SC server or SC agent?
By default if SC_AGENT is set all CMDs will be run on agent. If SC_AGENT is not set then all CMDs will be run on server.
You can override this behavior by specifying SERVER: or AGENT: and a space before command
I am thinking SC is running your script on the SC server and that isnt where it exists which is consistent with error 256 it means command not found.
SC_AGENT=myhost.mydomain.com
POST_APP_UNQUIESCE_CMD01=AGENT: /tmp/delete.sh
APP_QUIESCE_CMD01=SERVER: snapcreator.exe -profile S-Landschaft -config xxx1 -action quiesce
APP_QUIESCE_CMD02=SERVER: snapcreator.exe -profile S-Landschaft -config xxx2 -action quiesce
APP_UNQUIESCE_CMD01=SERVER: snapcreator.exe -profile S-Landschaft -config xxx1 -action unquiesce
APP_UNQUIESCE_CMD02=SERVER: snapcreator.exe -profile S-Landschaft -config xxx2 -action unquiesce
Regards,
Keith
Hi Keith,
thanks a lot, that's the solution ;o)
The script is running now on the first system.
As you can see we have two system in the configuration, is it also possible to specify different commands for the two agents?
e.g.
Agent1 should execute script delete.sh
Agent2 should execute script touch.sh
Thanks a lot for your help.
BR,
Andreas
No problem andreas!
Yeah I didnt understand that there was two systems involved until I saw the use of the CMDs and your configs.
This is a really cool feature of SC where you can run CMDs in different places but unfortunately not well documented, we will fix that.
In addition the one thing I didnt tell you is there is a third location you can run CMDs CLONETARGET the CLONETARGET acts as a second agent SC_CLONE_TARGET and is used mostly for cloning applications but you can also use it to fire CMDs, just an FYI in case your setup requires talking to a second host.
In SC 4.0 you can send CMDs to any agent so this is only getting better
Regards,
Keith
Hi Keith,
thanks ;o) Look forward to see Version 4.0 ;o)
But how should the configuration look like now if I want to specify script A on system A and script B on system B ?
Is there a solution?
Is there a good documentation about the configuration options of snapcreator? (beside the installation dokumentation).
Best Regards,
Andreas
If neither System A or B are SC server then you would
1) install agent on both hosts
2) use AGENT: in front of cmds to specify commands going to SC_AGENT
3) use CLONETARGET: in front of cmds to specify commands going to SC_CLONE_TARGET
If one of the systems is SC server then use SERVER: to specify cmds which should run on server and AGENT: command which should run on agent.
Keith
Hi Keith,
thank you very much for your help.
Have a nice weekend.
Best Regards,
Andreas