Resolving 'Invalid filename' Error During autobcpMSQ.pl Execution with sqlcmd
search cancel

Resolving 'Invalid filename' Error During autobcpMSQ.pl Execution with sqlcmd

book

Article ID: 418586

calendar_today

Updated On:

Products

Autosys Workload Automation

Issue/Introduction

When attempting to execute the autobcpMSQ.pl script, users may encounter an 'Invalid filename' error reported by sqlcmd. This issue typically occurs during the execution of a SQL command that attempts to access a specific file, as indicated by the following specific error message:

sqlcmd -C -U autosys -P <password> -S "<server>" -dAEDB -i delete_data.sql
Sqlcmd: 'delete_data.sql': Invalid filename

This error suggests that sqlcmd is unable to locate or access the specified delete_data.sql file, often due to insufficient permissions or an incorrect working directory when the script is executed.

Environment

  • AutoSys Workload Automation
  • Microsoft SQL Server
  • Windows Operating System

Resolution

Follow these steps to diagnose and resolve the 'Invalid filename' error:

  1. Open an elevated AutoSys Command Prompt:
    Right-click the AutoSys command prompt shortcut and select "Run as administrator." This ensures the command prompt has the necessary permissions.

  2. Verify write permissions in critical directories:
    From this elevated command prompt, test if files can be created in the temporary directory (%TEMP%) and the AutoSys MSQ directory (%AUTOSYS%\dbobj\MSQ).

  3. Execute perl autobcpMSQ.pl:
    If the permission tests in the previous step are successful, proceed to run the autobcpMSQ.pl script from the same elevated command prompt: perl autobcpmsq.pl    Respond interactively to any prompts during the script's execution.                                                         
  4.  Important Consideration for Dumpfile Path:
    When prompted by the autobcpMSQ.pl script to specify a dumpfile path, do not specify a custom path. Accept the default path. This default behavior ensures that the necessary files are correctly placed in the %AUTOSYS%\dbobj\MSQ directory, which is crucial for the script's successful operation.