EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set - r

I'm trying to run a simple R code in SQL Server 2016:
EXEC sp_execute_external_script
#language =N'R',
#script=N'OutputDataSet<-InputDataSet',
#input_data_1 =N'SELECT 1 AS hello'
WITH RESULT SETS (([hello] int not null));
GO
I have followed this link to configure: https://tomaztsql.wordpress.com/2016/07/26/enabling-sp_execute_external_script-to-run-r-scripts-in-sql-server-2016/
I'm getting error:
Msg 39023, Level 16, State 1, Procedure sp_execute_external_script,
Line 1 [Batch Start Line 0]
'sp_execute_external_script' is disabled on this instance of SQL
Server. Use sp_configure 'external scripts enabled' to enable it.
Msg 11536, Level 16, State 1, Line 1
EXECUTE statement failed because its WITH RESULT SETS clause specified 1
result set(s), but the statement only sent 0 result set(s) at run time.
when I checked with :
EXECUTE sp_configure;
GO
The result shows like this:
name minimum maximum config_value run_value
external scripts enabled 0 1 1 0
Why the run value is still 0 (note-I have SQL Server Launchpad restarted)? What is the resolution for this?

Issue resolved. need to restart SQL Server services. Which will restart everything. And its working fine.

Related

handler command failed after migrating mariadb from 10.5.15 to 10.5.16

I have a HANDLER command which works in MariaDB 10.5.15 but fails on 10.5.16.
HANDLER INDEX_NAME READ INDEX_NAME = (....,'......') LIMIT 1;
The failure happens in'mysql_store_result'.
is there any change in 10.5.16 causing the failure?
from 10.6.x, works again.

About expected timeouts in RobotFramework SSHLibrary

I’m a newb with respect to Robot Framework.
I’m writing a test procedure that is expected to
connect to another machine
perform an image update (which causes the unit to close all services and reboot itself)
re-connect to the unit
run a command that returns a known string.
This is all supposed to happen within the __init__.robot module
What I have noticed is that I must invoke the upgrade procedure in a synchronous, or blocking way, like so
Execute Command sysupgrade upgrade.img
This succeeds in upgrading the unit, but the robotframework script hangs executing the command. I suspect this works because it keeps the ssh session alive long enough for the upgrade to reach a critical junction where the session is closed by the remote host, the host expects this, the upgrade continues, and this does not cause the upgrade to fail.
But the remote host appears to close the ssh session in such a way that the robotframework script does not detect it, and the script hangs indefinitely.
Trying to work around this, I tried invoking the remote command like so
Execute Command sysupgrade upgrade.img &
But then the update fails because the connection appear to drop and leaves the upgrade procedure incomplete.
If instead I execute it like this
Execute Command sysupgrade upgrade.img &
Sleep 600
Then this also fails, for some reason I am unable to deduce.
However, if I invoke it like this
Execute Command sysupgrade upgrade.img timeout=600
The the command succeeds in updating the unit, and after the set timeout period, the robotframework script does indeed resume, but since it has arrived at the timeout, the test has (from the point of view of robotframework) failed.
But this is actually an expected failure, and should be ignored. The rest of the script would then reconnect to the host and continue the remaining test(s)
Is there a way to treat the timeout condition as non-fatal?
Here is the code, as explained above, the __init__.robot initialization module is expected to perform the upgrade and then reconnect, leaving the other xyz.robot files to be run and continue testing the applications.
The __init__.robot file:
*** Settings ***
| Library | OperatingSystem |
| Library | SSHLibrary |
Suite Setup ValidationInit
Suite Teardown ValidationTeardown
*** Keywords ***
ValidationInit
Enable SSH Logging validation.log
Open Connection ${host}
Login ${username} ${password}
# Upload the firmware to the unit.
Put File ${firmware} upgrade.img scp=ALL
# Perform firmware upgrade on the unit.
log "Launch upgrade on unit"
Execute Command sysupgrade upgrade.img timeout=600
log "Restart comms"
Close All Connections
Open Connection ${host}
Login ${username} ${password}
ValidationTeardown
Close All Connections
log “End tests”
This should work :
Comment Change ssh client timeout configuration set client configuration timeout=600 Comment "Launch upgrade on unit" SSHLibrary.Write sysupgrade upgrade.img SSHLibrary.Read Until expectedResult Close All Connections
You can use 'Run Keyword And Ignore Error' to ignore the failgure. Or here I think you should use write command if you do not care the execution result.

Autosys job shows success but failed

I've some weird situation. My autosys job status shows that it ran successfully but when I checked the logs it showed it was failed.
Is that possible ? Has anyone encountered this kind of issue ?
Use the -b option in the SQLCMD. This post gives a good explanation, and the solution worked for me... https://dba.stackexchange.com/questions/77298/how-to-make-sqlcmd-return-an-errorlevel-other-than-0-when-the-sql-script-fails
Taken from the above link...
You should use the option -b in sqlcmd.
-b Specifies that sqlcmd exits and returns a DOS ERRORLEVEL value when an error occurs. The value that is returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity level greater than 10; otherwise, the value returned is 0.
http://msdn.microsoft.com/en-us/library/ms162773.aspx

salt ignore specific exit codes

I need to execute a local command with salt on several servers which returns different error codes then 0 and 1.
The success code could be 2 or 4 and failure is 5.
Is there any possibility to react with salt if a process return a specific return value?
test_cmd:
cmd.run:
- name: my_test.exe

FAST LOAD - FDL4818 FastLoad Terminated Error

I have created Below fast load scripts which is loading data from flat file to teradata table.
fastload << EOF >> ${BASE_DIR}/Test_Load_Fastload_log
SESSIONS 4;
.logon ${TDPID}/${TD_LOGON}
SET RECORD VARTEXT " ";
Define
WSID (VARCHAR(10)),
Server_Name (VARCHAR(30)),
Technology (VARCHAR(50)),
Env (VARCHAR(10))
File=$BASE_DIR/workstation_source.dat;
BEGIN LOADING WORK_DB.WS_test
ERRORFILES WORK_DB.WS_test_Err1,WORK_DB.WS_test_Err2
;
INSERT INTO WORK_DB.WS_test VALUES
(:WSID,
:Server_Name,
:Technology,
:Env );
END LOADING;
This is loading data successfully in table but giving return code as 0.
But after that fast load is being teminated with FDL4818 FastLoad Terminated Error.
Below is the log.
06:37:08 Logging off all sessions
* 06:37:09 Total processor time used = '0.1 Seconds'
. Start : Thu Jun 6 06:37:04 2013
. End : Thu Jun 6 06:37:09 2013
. Highest return code encountered = '0'.
*** 06:37:09 FDL4818 FastLoad Terminated
Try including a .QUIT; or a .LOGOFF; command at the end of your script.
EDIT
The FDL4818 FastLoad Terminated message is a normal part of the completion message for a FastLoad job that has completed outside the Loading Phase. FastLoad jobs completing within the Loading Phase will display FDL4818 FastLoad Paused instead.
This completion message will not affect the return code that is returned to the operating system or parent process.
This a message not an error.
You should check the following part of the message to check if there was an error or not:
* Highest return code encountered = *
If the value is 0, as in your case, the job is completed successfully without any ERROR.
If value is other than 0, e.g 8 or 12, there is some error.

Resources