Stored Procedure Accelerator Guide for Sybase

Stored Procedure Accelerator Guide for Sybase

Create the Cleanup Job on Linux

Create the Cleanup Job on Linux

Schedule a cronjob to run the cleanup job on Linux and UNIX.
Before you schedule the cleanup job, you must verify that the cleanup script file has the required permissions. The Octal parameter must be set to 0775.
The following image shows the file permissions:
The Octal parameter is set to 0755.
  1. Log in to the machine and run the following command:
    • On Linux, enter
      sudo crontab -e
    • On UNIX, enter
      crontab -e
    The shell lists the crontab file contents.
  2. Enter
    i
    to switch to insert mode.
  3. Enter the following command to schedule a cronjob to run the CLEANUP_TEMP_OBJECTS.sh script:
    * * * * *<Path_To_The_Script_File>/CLEANUP_TEMP_OBJECTS.sh {CREATED_BEFORE_SECONDS} {DATABASE_NAME} {SCHEMA_NAME} {DATABASE_SERVER_HOST} {DATABASE_USERNAME} {DATABASE_PASSWORD} {SYBASE_INSTALLATION_PATH} {USER_TEMP_DIRECTORY} >> {Output_Log_File_Path}
    The command uses the following parameters:
    CREATED_BEFORE_SECONDS
    Objects that have a creation time that is before the value of the created_before_seconds attribute are considered for deletion. Specify the time in seconds.
    DATABASE_NAME
    The name of the database where Dynamic Data Masking creates the temporary tables.
    SCHEMA_NAME
    The name of the schema where Dynamic Data Masking creates the temporary tables.
    DATABASE_SERVER_HOST
    The host name of the Sybase database server where Dynamic Data Masking creates the temporary tables and stored procedures.
    DATABASE_USERNAME
    The user name of the Sybase database user that Dynamic Data Masking uses to create the temporary tables and stored procedures.
    DATABASE_PASSWORD
    The password of the Sybase database user that Dynamic Data Masking uses to create the temporary tables and stored procedures.
    SYBASE_INSTALLATION_PATH
    The Sybase installation path. Dynamic Data Masking uses the value to run the SYBASE.sh file that sets the required environment variables for the isql command line tool.
    USER_TEMP_DIRECTORY
    The file path of a directory in which the user has permissions to create, delete, and modify a file.
    For example, you might enter the following text:
    */2 * * * * /export/home/dsgperf/CLEANUP_TEMP_OBJECTS.sh 10 tempdb ddmadmin SYBASESERVER ddmadmin ddmadmin /export/home/sybdba/ASE157 /export/home/dsgperf >> /export/home/dsgperf/cleanupJob.log
    In the example, cronjob is scheduled to run every two minutes and the shell script is defined as
    /export/home/dsgperf/CLEANUP_TEMP_OBJECTS.sh
    . The example defines the following parameters:
    • CREATED_BEFORE_SECONDS. 10 seconds
    • DATABASE_NAME. tempdb
    • SCHEMA_NAME. ddmadmin
    • DATABASE_SERVER_HOST. SYBASESERVER
    • DATABASE_USERNAME. ddmadmin
    • DATABASE_PASSWORD. ddmadmin
    • SYBASE_INSTALLATION_PATH. /export/home/sybdba/ASE157
    • USER_TEMP_DIRECTORY. /export/home/dsgperf
    For more information about cronjob options, see the nnCron documentation at the following URL: http://www.nncron.ru/help/EN/working/cron-format.htm
  4. Press escape to exit insert mode.
  5. Enter
    :wq!
    to save the changes that you made to the crontab file and exit.
    The cronjob runs at the frequency that you defined.
Each time the cronjob runs, the SQL in the CLEANUP_TEMP_OBJECTS.sh file is executed using the isql utility and the temporary tables and stored procedures are dropped.

0 COMMENTS

We’d like to hear from you!